The last parameter DayOfWeek.Monday the function will start first day of week on Monday.
int intWeekNO = 0;
intWeekNO = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(
pTimesheetDate,
System.Globalization.CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
Sunday, November 4, 2012
Get week no from date time C# .Net
Posted by demo at 11:10 PM 0 comments
First Date of Week C# .Net
When you need to find first date of week?
public static DateTime FirstDateOfWeek(int year, int weekOfYear)
{
DateTime jan1 = new DateTime(year, 1, 1);
int daysOffset = (int)System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek - (int)jan1.DayOfWeek;
DateTime firstMonday = jan1.AddDays(daysOffset);
int firstWeek = System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(jan1, System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule, System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek);
if (firstWeek <= 1)
{
weekOfYear -= 1;
}
return firstMonday.AddDays(weekOfYear * 7);
}
Labels: FirstDateOfWeek, FirstDateOfWeek function
Posted by demo at 11:07 PM 0 comments
Monday, October 29, 2012
Enable log4net read from Configuration file for windows services
The logging component for .Net one of greatest is log4net.It is very simple, powerful, and extensible.
We can use for the windows, console or asp.net web application and can setting syntax in configuration file (App.config, Web.config).
When using log4net for windows service application you should
Add this line in assembly information file (AssemblyInfo.cs), it will read from your App.config within log4net section.
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
The example in App.config
Posted by demo at 1:29 AM 0 comments
Sunday, July 22, 2012
Drag and Drop function stop working in Windows 7 (64 bits)
I’ve found in Windows 7 sometimes it unable to use drag and drop files from the explorer shell. Whatever If you have that problem try this to fix it: Press Ctrl+Alt+Del. Press Esc. It's worked great for me. By the way: Thanks Microsoft for yet another reason to use a Mac instead of a PC.
Labels: 64bits, Drag and Drop, Windows 7
Posted by demo at 11:41 PM 0 comments
Tuesday, July 17, 2012
How to Setup for create Metro Style apps with Visual Studio 2012
Visual Studio 2012 RC is a family of products, tools, and technologies that you can use to build powerful, high-performance apps. You can create Metro style apps, in addition to desktop, web, phone, and game-console apps, in this release of Visual Studio 2012.
You can develop Metro style apps in a variety of languages:
If you know web development technologies, you can develop a Metro style app using HTML5, Cascading Style Sheets, Level 3 (CSS3), and JavaScript.
If you have developed .NET, Windows Presentation Foundation, or Microsoft Silverlight applications, you can develop a Metro style app using XAML, with code-behind in C++, C#, or Visual Basic.
If you know DirectX, you can develop a Metro style DirectX app using native C++ and HLSL to take full advantage of graphics hardware.
This guide tells you why you want to develop Metro style apps, where to get the tools you need, and how to build your first app.
Important Metro style app development is supported only on Windows 8 Release Preview. You can't develop Metro style apps on Windows 7 or Windows Server 2012.
What's a Metro style app?
At this point, you might be asking, "OK, so what are Metro style apps and how do they differ from desktop apps?" Read this article to learn about what makes Metro style apps different.
Get the Visual Studio 2012 and Windows 8 tools
Download Windows 8 and the free developer tools you need to create Metro style apps: Microsoft Visual Studio Express 2012 RC for Windows 8, Blend for Microsoft Visual Studio 2012 RC for Windows 8, the Windows 8 software development kit (SDK), and project templates for creating new Metro style apps.
Get a free developer license
Before you can start creating Metro style apps, you need a developer license. Fortunately, it's quick and easy to get one.
Labels: Metro Style, Visual Studio 2012, Windows 8
Posted by demo at 9:49 PM 0 comments