public static StudentGroupEventsSemesterViewModel Build(StudentGroup studentGroup, PublicDivision publicDivision, int?autumn) { var autumnSemesterStartDate = new DateTime(studentGroup.CurrentStudyYear.Number, 8, 1); var semesterStartDate = (autumn == 1 || autumn == null && NowIsAutumnSemester()) ? autumnSemesterStartDate : autumnSemesterStartDate.AddMonths(6); var semesterEndDate = semesterStartDate.AddMonths(6); var days = StudyEventsViewModelHelper.GetStudentGroupAggregatedEventsDays(studentGroup, null, semesterStartDate, semesterEndDate).ToList(); return(new StudentGroupEventsSemesterViewModel { Autumn = autumn, PublicDivisionAlias = publicDivision.Alias, StudentGroupId = studentGroup.Id, StudentGroupDisplayName = GetStudentGroupDisplayName(studentGroup), TimeTableDisplayName = TimeTableHelper.GetStudentGroupTimeTableDisplayNameForCodeByLanguage(StudyEventsTimeTableKindCode.Primary, CultureHelper.CurrentLanguage), Days = days, Breadcrumb = GetBreadcrumb(publicDivision, studentGroup.StudyProgram), SemesterStartDate = semesterStartDate, SemesterEndDate = semesterEndDate, SemesterDurationDisplayText = $"{semesterStartDate:d MMMM yyyy} - {semesterEndDate:d MMMM yyyy}", IsSpringSemester = semesterStartDate.Month == 2, HasEvents = days.Any(seadivm => seadivm.DayStudyEvents.Any()), }); }
internal static StudentGroupEventsWeekModel Build(StudentGroup studentGroup, DateTime from, DateTime to) { var days = StudyEventsViewModelHelper.GetStudyEventsDaysViewModelsForDateRange(studentGroup, null, from, to).ToList(); return(new StudentGroupEventsWeekModel { StudentGroupId = studentGroup.Id, StudentGroupDisplayName = studentGroup.Name, TimeTableDisplayName = TimeTableHelper.GetStudentGroupTimeTableDisplayNameForCodeByLanguage(StudyEventsTimeTableKindCode.Primary, CultureHelper.CurrentLanguage), Days = days, DurationDisplayText = $"{from:d MMMM yyyy} - {to:d MMMM yyyy}", HasEvents = days.Any(seadivm => seadivm.DayStudyEvents.Any()), }); }
public static StudentGroupEventsAttestationViewModel Build(StudentGroup studentGroup, PublicDivision publicDivision, StudyEventsTimeTableKindCode studyEventsTimeTableKindCode) { var language = CultureHelper.CurrentLanguage; var studyEventsTimeTableKind = TimeTableHelper.GetStudyEventsTimeTableKindForCode( studentGroup.Session, studyEventsTimeTableKindCode); return(new StudentGroupEventsAttestationViewModel { StudentGroupId = studentGroup.Id, StudentGroupDisplayName = GetStudentGroupDisplayName(studentGroup), TimeTableDisplayName = TimeTableHelper.GetStudentGroupTimeTableDisplayNameForCodeByLanguage(studyEventsTimeTableKindCode, language), StudyEventsMonths = StudyEventsViewModelHelper.GetStudyEventsMonthsViewModelsForTerm(studentGroup, studyEventsTimeTableKind, studyEventsTimeTableKindCode), Breadcrumb = GetBreadcrumb(publicDivision, studentGroup.StudyProgram), StudyEventsTimeTableKindCode = studyEventsTimeTableKindCode }); }
public static StudentGroupEventsPrimaryViewModel Build(StudentGroup studentGroup, PublicDivision publicDivision, DateTime?weekMonday) { var defaultWeekStart = DateTimeHelper.GetWeekStart(DateTime.Today); var weekStart = weekMonday ?? defaultWeekStart; var weekEnd = weekStart.AddDays(7); var language = CultureHelper.CurrentLanguage; return(new StudentGroupEventsPrimaryViewModel { StudentGroupId = studentGroup.Id, StudentGroupDisplayName = GetStudentGroupDisplayName(studentGroup), TimeTableDisplayName = TimeTableHelper.GetStudentGroupTimeTableDisplayNameForCodeByLanguage(StudyEventsTimeTableKindCode.Primary, language), WeekDisplayText = DateTimeHelper.GetWeekDisplayText(language, weekStart, weekEnd), PreviousWeekMonday = DateTimeHelper.GetDateStringForWeb(weekStart.AddDays(-7)), WeekMonday = DateTimeHelper.GetDateStringForWeb(weekStart), NextWeekMonday = DateTimeHelper.GetDateStringForWeb(weekEnd), IsCurrentWeekReferenceAvailable = (defaultWeekStart != weekStart), Days = StudyEventsViewModelHelper.GetStudyEventsDaysViewModelsForDateRange(studentGroup, null, weekStart, weekEnd), Breadcrumb = GetBreadcrumb(publicDivision, studentGroup.StudyProgram) }); }