public static string GetWeekTitle(WeekYear dto) { DateTime firstday = DateOfWeekIso8601(dto.Year, dto.Week, 1); DateTime lastday = DateOfWeekIso8601(dto.Year, dto.Week, 5); CultureInfo myCi = new CultureInfo("en-US"); return ($"Week {dto.Week} {firstday.Date.ToString("ddd:dd-MM-yy", myCi)} {lastday.Date.ToString("ddd:dd-MM-yy", myCi)}"); }
public CourseManager(IUnitOfWork unitOfWork, WeekYear curWeekYear) { Week = curWeekYear.Week; Year = curWeekYear.Year; var courseRepo = unitOfWork.Repository <Course>(); Courses = courseRepo.GetAll(); var hoursRepo = unitOfWork.Repository <CourseHour>(); WeekCourseHours = hoursRepo.Select(h => h.Week == Week && h.Year == Year).ToList(); WeekTitle = GetWeekTitle(curWeekYear); }
public static WeekYear GetPrevWeekYear(WeekYear wyDto) { WeekYear result = new WeekYear(); if (wyDto.Week == 1) { result.Week = YearWeekCount(wyDto.Year); result.Year = wyDto.Year - 1; } else { result.Week = wyDto.Week - 1; result.Year = wyDto.Year; } return(result); }
public static WeekYear GetNextWeekYear(WeekYear wyDto) { WeekYear result = new WeekYear(); if (wyDto.Week >= 52) { DateTime lastDay = new DateTime(wyDto.Year, 12, 31); if ((wyDto.Week == 52 && lastDay.DayOfWeek > DayOfWeek.Thursday) || wyDto.Week == 53) { result.Week = 1; result.Year = wyDto.Year + 1; } } else { result.Week = wyDto.Week + 1; result.Year = wyDto.Year; } return(result); }