} // 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
} // 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
} // 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
} // GetWeekOfYear // ---------------------------------------------------------------------- public virtual DateTime GetStartOfYearWeek(int year, int weekOfYear) { return(TimeTool.GetStartOfYearWeek(year, weekOfYear, culture, yearWeekType)); } // GetStartOfYearWeek
} // 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