Ejemplo n.º 1
0
        public static StudyProgramShowViewModel Build(IEnumerable <StudyProgram> studyPrograms, PublicDivision publicDivision)
        {
            var firstStudyProgram = studyPrograms.First();
            var session           = firstStudyProgram.Session;

            var admissionYear = firstStudyProgram.AdmissionYear;
            var language      = CultureHelper.CurrentLanguage;

            var currentStudyYear  = StudyYearHelper.GetDefaultCurrentStudyYear(session);
            var previousStudyYear = StudyYearHelper.GetPreviousStudyYear(session);
            var studentGroups     = GetStudentGroups(studyPrograms);
            var studentGroupsForCurrentStudyYear  = studentGroups.Where(sg => sg.CurrentStudyYear == currentStudyYear);
            var studentGroupsForPreviousStudyYear = previousStudyYear.IsWebAvailable ? studentGroups.Where(sg => sg.CurrentStudyYear == previousStudyYear) : new List <StudentGroup>();

            return(new StudyProgramShowViewModel
            {
                StudyProgramDisplayText = GetStudyProgramDisplayText(firstStudyProgram),
                AdmissionYearText = GetAdmissionYearText(admissionYear),
                StudentGroupsForCurrentStudyYear = studentGroupsForCurrentStudyYear.Select(sg => StudentGroupItemViewModel.Build(sg, publicDivision)),
                StudentGroupsForPreviousStudyYear = studentGroupsForPreviousStudyYear.Select(sg => StudentGroupItemViewModel.Build(sg, publicDivision)),
                CurrentStudyYearDisplayText = currentStudyYear.GetDisplayNameByLanguage(language),
                PreviousStudyYearDisplayText = previousStudyYear.GetDisplayNameByLanguage(language),
                PublicDivisionAlias = publicDivision.Alias,
                Breadcrumb = new Breadcrumb()
                {
                    BreadcrumbHelper.GetBreadcrumbRootItem(false),
                    BreadcrumbHelper.GetBreadcrumbPublicDivisionItem(publicDivision, false),
                    BreadcrumbHelper.GetBreadcrumbCourseItem(publicDivision, firstStudyProgram, true),
                }
            });
        }
 public StudyYear GetCurrentStudyYear()
 {
     return(StudyYearHelper.GetDefaultCurrentStudyYear(this.Session));
 }