Ejemplo n.º 1
0
        private Stream GetWeekExcelContentAsStream(StudentGroup studentGroup, StudentGroupEventsWeekModel model, DateTime from, DateTime to)
        {
            var eventDayModels = model.Days.Select(day =>
                                                   new EventDayModel(day.DayString, day.DayStudyEvents.Select(@event =>
                                                                                                              new EventModel(
                                                                                                                  @event.DateTime.Time.Value,
                                                                                                                  @event.Subject,
                                                                                                                  @event.Cohort,
                                                                                                                  @event.ShowCohort,
                                                                                                                  string.Join("\n", @event.EventLocations.Select(el => el.DisplayName)),
                                                                                                                  string.Join("\n", @event.EventLocations.Select(el => string.Join("; ", el.Educators.Select(e => e.Name))))
                                                                                                                  ))));
            var stream = AppointmentsSpreadsheetsHelper.GetStudentGroupWeekTimetableWorkbookStream(from, to,
                                                                                                   $"{studentGroup.Name}", eventDayModels);

            return(stream);
        }
        private Stream GetEducatorWeekExcelContentAsStream(EducatorMasterPerson masterPerson, EducatorEventsShowModel model, DateTime?weekMonday)
        {
            var eventDayModels = model.EducatorEventsDays.Select(day =>
                                                                 new EventDayModel(day.DayString, day.DayStudyEvents.Select(@event =>
                                                                                                                            new EventModel(
                                                                                                                                @event.DateTime.Time.Value,
                                                                                                                                @event.Subject,
                                                                                                                                @event.Cohort,
                                                                                                                                @event.ShowCohort,
                                                                                                                                string.Join("\n", @event.EventLocations.Select(el => el.DisplayName)),
                                                                                                                                string.Join("\n", @event.ContingentUnits.Select(cu => cu.Name))
                                                                                                                                ))));
            var stream = AppointmentsSpreadsheetsHelper.GetEducatorWeekTimetableWorkbookStream(weekMonday.Value, weekMonday.Value.AddDays(7),
                                                                                               $"{masterPerson.DisplayName}", eventDayModels);

            return(stream);
        }
Ejemplo n.º 3
0
        private Stream GetXmlContentAsStream(StudentGroup studentGroup, StudentGroupEventsSemesterViewModel viewModel)
        {
            var aggregatedEventDayModels = viewModel.Days.Select(day =>
                                                                 new AggregatedEventDayModel(day.DayString, day.DayStudyEvents.Select(aggregatedEvent =>
                                                                                                                                      new AggregatedEventModel(
                                                                                                                                          aggregatedEvent.DateTime.Time.Value,
                                                                                                                                          string.Join("\n", aggregatedEvent.DateTime.Dates.Select(d => d.Value)),
                                                                                                                                          aggregatedEvent.Subject,
                                                                                                                                          aggregatedEvent.Cohort,
                                                                                                                                          aggregatedEvent.ShowCohort,
                                                                                                                                          string.Join("\n", aggregatedEvent.EventLocations.Select(el => el.DisplayName)),
                                                                                                                                          string.Join("\n", aggregatedEvent.EventLocations.Select(el => string.Join("; ", el.Educators.Select(e => e.Name)))),
                                                                                                                                          null))));
            var stream = AppointmentsSpreadsheetsHelper.GetStudentGroupSemesterTimetableWorkbookStream(studentGroup.TermStart, studentGroup.TermEnd,
                                                                                                       $"{studentGroup.Name}", aggregatedEventDayModels);

            return(stream);
        }
        private Stream GetXmlContentAsStream(EducatorMasterPerson masterPerson, EducatorEventsShowAllViewModel viewModel)
        {
            var aggregatedEventDayModels = viewModel.EducatorEventsDays.Select(day =>
                                                                               new AggregatedEventDayModel(day.DayString, day.DayStudyEvents.Select(aggregatedEvent =>
                                                                                                                                                    new AggregatedEventModel(
                                                                                                                                                        aggregatedEvent.DateTime.Time.Value,
                                                                                                                                                        string.Join("\n", aggregatedEvent.DateTime.Dates.Select(d => d.Value)),
                                                                                                                                                        aggregatedEvent.Subject,
                                                                                                                                                        aggregatedEvent.Cohort,
                                                                                                                                                        aggregatedEvent.ShowCohort,
                                                                                                                                                        aggregatedEvent.EventLocations.FirstOrDefault().DisplayName,
                                                                                                                                                        string.Join("; ", aggregatedEvent.ContingentUnits.Select(cu => $"{cu.Name} ({cu.DivisionAndCourse})")),
                                                                                                                                                        null))));
            var stream = AppointmentsSpreadsheetsHelper.GetEducatorTimetableWorkbookStream(viewModel.From, viewModel.To,
                                                                                           $"{masterPerson.LastName} {masterPerson.FirstName} {masterPerson.MiddleName}", aggregatedEventDayModels);

            return(stream);
        }