public static WeekDelete ( |
||
week | ||
return | bool |
public static void WeekAdd(DateTime startDate, DayOfWeek firstDayOfWeek, int numberOfPeriods, int year) { if (startDate.DayOfWeek != firstDayOfWeek) { throw new Csla.Rules.ValidationException("The start date's day of the week is not correct"); } foreach (var week in WeekRepository.WeekFetchInfoList(year)) { WeekRepository.WeekDelete(week.WeekId); } var numberOfWeeks = numberOfPeriods * 4; var endDate = startDate.AddDays(numberOfWeeks * 7); var weekCounter = 0; var periodCounter = 0; while (startDate < endDate) { var week = WeekRepository.WeekNew(); week.StartDate = startDate; week.EndDate = week.StartDate.AddDays(6); week.Year = year; week.Period = periodCounter + 1; WeekRepository.WeekSave(week); startDate = startDate.AddDays(7); weekCounter++; if (weekCounter % 4 == 0) { periodCounter++; } } }
public static bool WeekDelete(int weekId) { return(WeekRepository.WeekDelete( WeekRepository.WeekFetch(weekId))); }