Click here to Skip to main content
14,733,262 members
Home » Discussions » .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionRun Applications as an Administrator using Scheduled Task Pin
indian14325-Apr-17 14:36
Memberindian14325-Apr-17 14:36 
QuestionType thanglish in keyboard when display tamil letters in textbox Pin
Member 1296305725-Apr-17 2:34
MemberMember 1296305725-Apr-17 2:34 
AnswerRe: Type thanglish in keyboard when display tamil letters in textbox Pin
User 418025425-Apr-17 2:59
MemberUser 418025425-Apr-17 2:59 
AnswerRe: Type thanglish in keyboard when display tamil letters in textbox Pin
Afzaal Ahmad Zeeshan25-Apr-17 3:51
mveAfzaal Ahmad Zeeshan25-Apr-17 3:51 
QuestionGet the week of the month in string using C# Pin
indian14320-Apr-17 14:02
Memberindian14320-Apr-17 14:02 
AnswerRe: Get the week of the month in string using C# Pin
Afzaal Ahmad Zeeshan20-Apr-17 14:24
mveAfzaal Ahmad Zeeshan20-Apr-17 14:24 
AnswerRe: Get the week of the month in string using C# Pin
Richard MacCutchan20-Apr-17 23:26
mveRichard MacCutchan20-Apr-17 23:26 
GeneralRe: Get the week of the month in string using C# Pin
indian14325-Apr-17 14:29
Memberindian14325-Apr-17 14:29 
Sorry I was busy in other stuff and with my kids, yes I came back, yes I did my friend. It was more logical but I want to do it.
Here it is.
        public static bool RunForTheDay(bool IsTheJobWeekly, bool IsTheJobMonthly, bool IsTheJobYearly,
           int WhatDayOfMonthJobRuns, int WhatWeekOfMonthJobRuns, int WhatMonthOfYearJobRuns,
           int WhatDayOfYearJobRuns, bool RunForTheDay, string strDayOfTheWeek)
        {
            bool retRunForTheDay = false;

            //string strDayOfTheWeek = DateTime.Now.ToString("dddd");

            if (IsTheJobYearly)
            {
                if (WhatDayOfYearJobRuns > 0)
                {
                    if (WhatDayOfYearJobRuns == DateTime.Now.DayOfYear)
                        retRunForTheDay = true;
                }
                else if ((WhatMonthOfYearJobRuns > 0) && (WhatMonthOfYearJobRuns == DateTime.Now.Month))
                {
                    if ((WhatDayOfMonthJobRuns > 0) && (WhatDayOfMonthJobRuns == DateTime.Now.Day))
                    {
                        retRunForTheDay = true;
                    }
                    else if (WhatWeekOfMonthJobRuns > 0)
                    {
                        int tempWeekOfTheMonth = GetWeekOfMonth(DateTime.Now);

                        if ((tempWeekOfTheMonth == WhatWeekOfMonthJobRuns) && RunForTheDay)
                            retRunForTheDay = true;
                    }
                }
            }
            else if (IsTheJobMonthly)
            {
                if ((WhatDayOfMonthJobRuns > 0) && (WhatDayOfMonthJobRuns == DateTime.Now.Day))
                {
                    retRunForTheDay = true;
                }
                else if (WhatWeekOfMonthJobRuns > 0)
                {
                    int tempWeekOfTheMonth = GetWeekOfMonth(DateTime.Now);

                    if ((tempWeekOfTheMonth == WhatWeekOfMonthJobRuns) && RunForTheDay)
                        retRunForTheDay = true;
                }
            }
            else
            {
                retRunForTheDay = RunForTheDay;
            }

            return retRunForTheDay;
        }

        public static int GetWeekOfMonth(DateTime date)
        {
            DateTime beginningOfMonth = new DateTime(date.Year, date.Month, 1);

            while (date.Date.AddDays(1).DayOfWeek != CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek)
                date = date.AddDays(1);

            return (int)Math.Truncate((double)date.Subtract(beginningOfMonth).TotalDays / 7f) + 1;
        }

Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."
QuestionMy (previously working) DateTimePickers have gone nuts! Pin
Peter R. Fletcher18-Apr-17 13:55
MemberPeter R. Fletcher18-Apr-17 13:55 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Richard MacCutchan18-Apr-17 21:44
mveRichard MacCutchan18-Apr-17 21:44 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Peter R. Fletcher19-Apr-17 4:16
MemberPeter R. Fletcher19-Apr-17 4:16 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Richard MacCutchan19-Apr-17 6:33
mveRichard MacCutchan19-Apr-17 6:33 
AnswerRe: My (previously working) DateTimePickers have gone nuts! Pin
Gerry Schmitz19-Apr-17 10:37
mveGerry Schmitz19-Apr-17 10:37 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Peter R. Fletcher19-Apr-17 11:50
MemberPeter R. Fletcher19-Apr-17 11:50 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Gerry Schmitz19-Apr-17 12:27
mveGerry Schmitz19-Apr-17 12:27 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Peter R. Fletcher19-Apr-17 13:33
MemberPeter R. Fletcher19-Apr-17 13:33 
GeneralRe: My (previously working) DateTimePickers have gone nuts! Pin
Gerry Schmitz19-Apr-17 14:26
mveGerry Schmitz19-Apr-17 14:26 
AnswerRe: My (previously working) DateTimePickers have gone nuts! Pin
leon de boer22-Apr-17 20:27
Memberleon de boer22-Apr-17 20:27 
QuestionFind a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Jyoti Lal13-Apr-17 21:59
MemberJyoti Lal13-Apr-17 21:59 
AnswerRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Dave Kreskowiak14-Apr-17 6:52
mveDave Kreskowiak14-Apr-17 6:52 
GeneralRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Jyoti Lal16-Apr-17 22:41
MemberJyoti Lal16-Apr-17 22:41 
GeneralRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Dave Kreskowiak17-Apr-17 4:16
mveDave Kreskowiak17-Apr-17 4:16 
GeneralRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Jyoti Lal17-Apr-17 21:26
MemberJyoti Lal17-Apr-17 21:26 
AnswerRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
ZurdoDev14-Apr-17 8:46
professionalZurdoDev14-Apr-17 8:46 
AnswerRe: Find a solution for automating a manual task for searching a TFS change-set dot-net technology Pin
Pete O'Hanlon14-Apr-17 9:36
mvePete O'Hanlon14-Apr-17 9:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.