示例#1
0
                public StudyEventAggregateContingentsHelperKey(TimeEventAppointment appointment)
                {
                    StudyEventsTimeTableKindCode = appointment.StudyEventsTimeTableKind != null
                        ? appointment.StudyEventsTimeTableKind.Code
                        : StudyEventsTimeTableKindCode.Unknown;
                    Start                = appointment.Start;
                    End                  = appointment.End;
                    Subject              = appointment.GetSubjectByLanguage(CultureHelper.CurrentLanguage);
                    ShowCohort           = appointment.ShowCohort;
                    Cohort               = appointment.GetCohortDisplayTextByLanguage(CultureHelper.CurrentLanguage);
                    EventLocations       = appointment.EventLocations;
                    EducatorsDisplayText = appointment.GetEducatorsDisplayTextByLanguage(CultureHelper.CurrentLanguage);
                    DontShowEndTimeOnWeb = appointment.DontShowEndTimeOnWeb;
                    var language = CultureHelper.CurrentLanguage;

                    EducatorIds = appointment.EventLocations
                                  .SelectMany(el => el.Educators)
                                  .Select(le => le.EducatorEmployment != null
                            ? new Tuple <int, string>(
                                              le.EducatorEmployment.EducatorPerson.MasterPerson != null
                                    ? le.EducatorEmployment.EducatorPerson.MasterPerson.Id
                                    : -1,
                                              le.EducatorEmployment.GetDisplayNameByLanguageFormated(language))
                            : le.Educator != null
                                ? new Tuple <int, string>(le.Educator.Id, le.Educator.GetDisplayNameByLanguage(language))
                                : null)
                                  .ToArray();
                }
            public AggregatedContingentKey(TimeEventAppointment appointment, LanguageCode language)
            {
                this.language = language;

                StudyEventsTimeTableKindCode = appointment.StudyEventsTimeTableKind != null
                    ? appointment.StudyEventsTimeTableKind.Code
                    : StudyEventsTimeTableKindCode.Unknown;
                Start                = appointment.Start;
                End                  = appointment.End;
                Subject              = appointment.GetSubjectByLanguage(language);
                EventLocations       = appointment.EventLocations;
                EducatorsDisplayText = appointment.GetEducatorsDisplayTextByLanguage(language);
                DontShowEndTimeOnWeb = appointment.DontShowEndTimeOnWeb;
            }
示例#3
0
        public static IEnumerable <StudyEventMonthViewModel> GetStudyEventsMonthsViewModelsForTerm(
            StudentGroup studentGroup,
            StudyEventsTimeTableKind studyEventsTimeTableKind,
            StudyEventsTimeTableKindCode studyEventsTimeTableKindCode)
        {
            var monthsViewModels = GetStudyEventIndexViewModelsForTerm(studentGroup, studyEventsTimeTableKind, studyEventsTimeTableKindCode)
                                   .GroupBy(vm => GetFirstDayOfMonth(vm.Start))
                                   .OrderBy(g => g.Key)
                                   .Select(g => StudyEventMonthViewModel.Build(g.Key, g.AsEnumerable()))
                                   .ToList();

            SetActiveMonth(monthsViewModels);
            return(monthsViewModels);
        }
示例#4
0
            public AggregatedDatesKey(AggregatedContingent g, LanguageCode language)
            {
                this.language = language;

                StudyEventsTimeTableKindCode = g.Key.StudyEventsTimeTableKindCode;
                Start                = g.Key.Start.TimeOfDay;
                End                  = g.Key.End.TimeOfDay;
                Subject              = g.Key.Subject;
                EventLocations       = g.Key.EventLocations;
                ContingentUnits      = new[] { g.Appointment.ContingentUnit };
                EducatorsDisplayText = g.Key.EducatorsDisplayText;
                IsCanceled           = g.Appointment.IsCancelled;
                DontShowEndTimeOnWeb = g.Key.DontShowEndTimeOnWeb;
            }
示例#5
0
 public StudyEventAggregateDatesHelperKey(StudyEventAggregateContingentsHelper g)
 {
     StudyEventsTimeTableKindCode = g.Key.StudyEventsTimeTableKindCode;
     Start                = g.Key.Start.TimeOfDay;
     End                  = g.Key.End.TimeOfDay;
     Subject              = g.Key.Subject;
     Cohort               = g.Key.Cohort;
     ShowCohort           = g.Key.ShowCohort;
     EventLocations       = g.Key.EventLocations;
     ContingentUnits      = new[] { g.Appointment.ContingentUnit };
     EducatorsDisplayText = g.Key.EducatorsDisplayText;
     IsCanceled           = g.Appointment.IsCancelled;
     EducatorIds          = g.Key.EducatorIds;
     DontShowEndTimeOnWeb = g.Key.DontShowEndTimeOnWeb;
 }
示例#6
0
 public static IEnumerable <StudyEventItemViewModel> GetStudyEventIndexViewModelsForTerm(
     StudentGroup studentGroup,
     StudyEventsTimeTableKind studyEventsTimeTableKind,
     StudyEventsTimeTableKindCode studyEventsTimeTableKindCode)
 {
     if (IsTimeTableKindWebAvailable(studentGroup, studyEventsTimeTableKind))
     {
         using (var appointmentsRepository = new StudentGroupAppointmentsRepository(studentGroup, studyEventsTimeTableKind))
         {
             var appointments = appointmentsRepository.GetAppointments();
             return(appointments
                    .Where(a => a.IsPublicMaster)
                    .Where(a => !String.IsNullOrEmpty(a.EducatorsDisplayText))
                    .OrderBy(a => a.Start)
                    .ThenBy(a => a.Subject)
                    .Select(a => StudyEventItemViewModel.Build(a)));
         }
     }
     return(Enumerable.Empty <StudyEventItemViewModel>());
 }
示例#7
0
 public StudyEventsTimeTableKind Get(StudyEventsTimeTableKindCode timetable)
 {
     return(TimeTableHelper.GetStudyEventsTimeTableKindForCode(session, timetable));
 }
        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
            });
        }