Inheritance: RatingReportSettings
Beispiel #1
0
 public async Task<byte[]> GetServiceRatingReport(ServiceRatingReportSettings settings)
 {
     return await Task.Run(() =>
     {
         CheckPermission(UserRole.Administrator, AdministratorPermissions.Reports);
         return GenerateReport(new ServiceRatingReportProvider(settings));
     });
 }
 public ServiceRatingReportProvider(ServiceRatingReportSettings settings)
 {
     this.settings = settings;
 }
        private async Task<ServiceRatingReportSettings> GetReportSettings()
        {
            ServiceRatingReportSettings settings;
            switch ((ReportDetailLevel)detailLevelTabControl.SelectedIndex)
            {
                case ReportDetailLevel.Year:
                    settings = new ServiceRatingReportSettings()
                    {
                        StartYear = (int)startYearComboBox.SelectedItem,
                        FinishYear = (int)finishYearComboBox.SelectedItem,
                    };
                    break;

                case ReportDetailLevel.Month:
                    settings = new ServiceRatingReportSettings()
                    {
                        StartYear = startMonthPicker.Value.Year,
                        StartMonth = startMonthPicker.Value.Month,
                        FinishYear = finishMonthPicker.Value.Year,
                        FinishMonth = finishMonthPicker.Value.Month
                    };
                    break;

                case ReportDetailLevel.Day:
                    settings = new ServiceRatingReportSettings()
                    {
                        StartYear = startDatePicker.Value.Year,
                        StartMonth = startDatePicker.Value.Month,
                        StartDay = startDatePicker.Value.Day,
                        FinishYear = finishDatePicker.Value.Year,
                        FinishMonth = finishDatePicker.Value.Month,
                        FinishDay = finishDatePicker.Value.Day
                    };
                    break;

                default:
                    throw new ApplicationException("Неверный тип детализации");
            }

            settings.DetailLevel = (ReportDetailLevel)detailLevelTabControl.SelectedIndex;
            settings.Services = isFullCheckBox.Checked ? new Guid[0] : await GetSelectedServices();
            settings.IsServiceTypes = isServiceTypesCheckBox.Checked;

            return settings;
        }