Ejemplo n.º 1
0
 public Report GenerateProfessorReport(Person professor, TimeInterval interval)
 {
     _reportDataProvider.ReportDataProvidersContainer.SetProfessorModificator(professor, interval);
     return new Report(professor.FullName.ToString(), _reportTableResolver(typeof (Person)),
         _formulaProvider,
         _reportDataProvider);
 }
        private void SaveReport(ReportView.CreateReport viewModel, CreateReport view)
        {
            // TODO add validation
            try
            {
                var timeInterval = new TimeInterval(viewModel.StartDate, viewModel.EndDate);
                var reportParameters = viewModel.ReportParameters;
                var filePath = viewModel.FilePath;

                if (reportParameters is ReportView.PersonReportParameters)
                {
                    var personParameters = reportParameters as ReportView.PersonReportParameters;
                    var persons = personParameters.ChoosenPersons;
                    var reports =
                        persons.Select(p => _reportGenerator.GenerateProfessorReport(p.Model, timeInterval))
                               .ToList();

                    var report = Report.Unify(reports);
                    _excelService.ExportReport(filePath, report);
                }
                else if (reportParameters is ReportView.CathedraReportParameters)
                {
                    var cathedraParameters = reportParameters as ReportView.CathedraReportParameters;
                    var cathedra = cathedraParameters.SelectedCathedra;
                    var report = _reportGenerator.GenerateCathedraReport(cathedra, timeInterval);
                    _excelService.ExportReport(filePath, report);
                }
                else
                {
                    var report = _reportGenerator.GenerateFacultyReport(timeInterval);
                    _excelService.ExportReport(filePath, report);
                }

                view.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка при генерации отчёта. Проверьте введённые данные",
                                "Ошибка");
            }
        }
Ejemplo n.º 3
0
 public Report GenerateFacultyReport(TimeInterval interval)
 {
     _reportDataProvider.ReportDataProvidersContainer.SetFacultyModificator(interval);
     return new Report("Факультет", _reportTableResolver(typeof (Cathedra)), _formulaProvider,
         _reportDataProvider);
 }
Ejemplo n.º 4
0
 public Report GenerateCathedraReport(Cathedra cathedra, TimeInterval interval)
 {
     _reportDataProvider.ReportDataProvidersContainer.SetCathedraModificator(cathedra, interval);
     return new Report(cathedra.Name, _reportTableResolver(typeof (Cathedra)), _formulaProvider,
         _reportDataProvider);
 }