Exemplo n.º 1
0
        static DateTimeUtil()
        {
            var now = DateTime.Now.Date;

            Today = now;

            FirstDayOfTheMonth  = now.AddDays(now.Day * -1 + 1);
            LastDayOfTheMonth   = FirstDayOfTheMonth.AddMonths(1).AddDays(-1);
            FirstDayOfLastMonth = FirstDayOfTheMonth.AddMonths(-1);
            LastDayOfLastMonth  = FirstDayOfTheMonth.AddDays(-1);

            int      i  = now.DayOfWeek - DayOfWeek.Monday == -1 ? 6 : -1;
            TimeSpan ts = new TimeSpan(i, 0, 0, 0);

            Monday    = now.Subtract(ts).Date;
            Tuesday   = Monday.AddDays(1);
            Wednesday = Monday.AddDays(2);
            Thursday  = Monday.AddDays(3);
            Friday    = Monday.AddDays(4);
            Saturday  = Monday.AddDays(5);
            Sunday    = Monday.AddDays(6);

            LastMonday    = Monday.AddDays(-7);
            LastTuesday   = LastMonday.AddDays(1);
            LastWednesday = LastMonday.AddDays(2);
            LastThursday  = LastMonday.AddDays(3);
            LastFriday    = LastMonday.AddDays(4);
            LastSaturday  = LastMonday.AddDays(5);
            LastSunday    = LastMonday.AddDays(6);

            NextMonday    = Sunday.AddDays(1);
            NextTuesday   = Monday.AddDays(1);
            NextWednesday = Monday.AddDays(2);
            NextThursday  = Monday.AddDays(3);
            NextFriday    = Monday.AddDays(4);
            NextSaturday  = Monday.AddDays(5);
            NextSunday    = Monday.AddDays(6);

            RunIdOfToday   = now.ToString("yyyy-MM-dd");
            RunIdOfMonthly = FirstDayOfTheMonth.ToString("yyyy-MM-dd");
            RunIdOfMonday  = Monday.ToString("yyyy-MM-dd");
        }
Exemplo n.º 2
0
 private void SetOneMonthQuery(DataQuery query)
 {
     query.Ids         = TableId;
     query.GAStartDate = FirstDayOfTheMonth.ToString("yyyy-MM-dd");
     query.GAEndDate   = LastDayOfTheMonth.ToString("yyyy-MM-dd");
 }