Example #1
0
        } // EndWeekOfYearName

        // ----------------------------------------------------------------------
        public DateTime GetStartOfWeek(int weekIndex)
        {
            if (weekIndex < 0 || weekIndex >= weekCount)
            {
                throw new ArgumentOutOfRangeException("weekIndex");
            }

            DateTime startDate = TimeTool.GetStartOfYearWeek(year, startWeek, Calendar.Culture, Calendar.YearWeekType);

            return(startDate.AddDays(weekIndex * TimeSpec.DaysPerWeek));
        } // GetStartOfWeek
Example #2
0
        } // GetStartOfWeek

        // ----------------------------------------------------------------------
        public ITimePeriodCollection GetDays()
        {
            TimePeriodCollection days      = new TimePeriodCollection();
            DateTime             startDate = TimeTool.GetStartOfYearWeek(year, startWeek, Calendar.Culture, Calendar.YearWeekType);
            int dayCount = weekCount * TimeSpec.DaysPerWeek;

            for (int i = 0; i < dayCount; i++)
            {
                days.Add(new Day(startDate.AddDays(i), Calendar));
            }
            return(days);
        } // GetDays
Example #3
0
        } // GetPeriodOf

        // ----------------------------------------------------------------------
        private static TimeRange GetPeriodOf(int year, int weekOfYear, int weekCount, ITimeCalendar calendar)
        {
            if (weekCount < 1)
            {
                throw new ArgumentOutOfRangeException("weekCount");
            }

            DateTime start = TimeTool.GetStartOfYearWeek(year, weekOfYear, calendar.Culture, calendar.YearWeekType);
            DateTime end   = start.AddDays(weekCount * TimeSpec.DaysPerWeek);

            return(new TimeRange(start, end));
        } // GetPeriodOf
Example #4
0
        } // GetNextWeek

        // ----------------------------------------------------------------------
        public Week AddWeeks(int weeks)
        {
            DateTime startDate = TimeTool.GetStartOfYearWeek(Year, StartWeek, Calendar.Culture, Calendar.YearWeekType);

            return(new Week(startDate.AddDays(weeks * TimeSpec.DaysPerWeek), Calendar));
        } // AddWeeks
Example #5
0
        } // GetWeekOfYear

        // ----------------------------------------------------------------------
        public virtual DateTime GetStartOfYearWeek(int year, int weekOfYear)
        {
            return(TimeTool.GetStartOfYearWeek(year, weekOfYear, culture, yearWeekType));
        } // GetStartOfYearWeek