private static ReportSchedulerModel CreateReportSchedulerModel(IReportingClient reportingClient, string reportUiCulture, Report report, SubscriptionDetails subscriptionDetails) { var subscriptionParameters = reportingClient.GetParameters(report.Id, DefaultReportDataSouce, subscriptionDetails.Parameters); bool endDateSpecified = subscriptionDetails.EndDateTime != DateTime.MinValue; var model = new ReportSchedulerModel { ReportId = report.Id, ScheduleId = subscriptionDetails.ScheduleId, ReportUiCulture = reportUiCulture, ReportName = report.Name, Description = subscriptionDetails.Description, Parameters = new ReportParameters(subscriptionParameters, true), ParametersView = DynamicParameters, ReportOutputType = ReportOutputTypeFromDeliverySettings( subscriptionDetails.DeliverySettings), ReportFrequency = ReportFrequencyFromScheduleDefinition(subscriptionDetails.ScheduleDefinition), ScheduledTime = subscriptionDetails.StartDateTime.ToShortTimeString(), StartDate = subscriptionDetails.StartDateTime.ToShortDateString(), EndDateSpecified = endDateSpecified, ReportDestination = ReportDestinationFromDeliverySettings( subscriptionDetails.DeliverySettings) }; if (model.ReportFrequency == ReportFrequency.Weekly) { model.Weekday = WeeklyRecurrencePatternFromScheduleDefintion(subscriptionDetails.ScheduleDefinition); } if (endDateSpecified) model.EndDate = subscriptionDetails.EndDateTime.ToShortDateString(); if (subscriptionDetails.DeliverySettings.ReportDestination == ReportDestination.FileShare) { LoadModelWithFileShareValues(model, subscriptionDetails.DeliverySettings.ToFileShareSettings()); } else { LoadModelWithEmailValues(model, subscriptionDetails.DeliverySettings.ToEmailSettings()); } return model; }
private IList<string> DataSourcesForReport(IReportingClient reportingClient, Report report) { var path = IsCustomReport(report.Id) ? _customReportsPath : _cannedReportsPath; var reports = reportingClient.GetReports(path); String baseReportName = string.Join("/", SplitReportId(report.Id), 0, DataSourcePartIndex); return (from reportInfo in reports where reportInfo.Id.StartsWith(baseReportName, StringComparison.OrdinalIgnoreCase) select SplitReportId(reportInfo.Id)[DataSourcePartIndex]).ToList(); }
private Report RetrieveReportForReportId(IReportingClient reportingClient, string reportId, string dataSource, out string reportUiCulture) { reportUiCulture = CultureInfo.CurrentCulture.Name; Report report = reportingClient.GetReport(reportId, dataSource, LanguageParameterArrayForCulture(reportUiCulture)); if (report != null) { ReportInfo reportInfo; string reportName; string reportDescription; List<ItemParameter> parameters = report.Parameters.ToList(); if (TryGetReportInfo(reportId, out reportInfo)) { // Attempt to identify a CannedReport with the specified reportId, // to use the Name and Description from Resources reportName = reportInfo.Name; reportDescription = reportInfo.Description; } else { // If the reportId does not match a CannedReport, then use the // Name and Description from the report itself (not localized) reportName = GetCustomReportName(report.Id); reportDescription = report.Description; } if (!IsRequestedLanguageSupported(parameters)) { // fall back to English (United States) reportUiCulture = "en-US"; parameters = reportingClient.GetParameters(report.Id, dataSource, LanguageParameterArrayForCulture(reportUiCulture)).ToList(); } report = new Report(report.Id, reportName, reportDescription, parameters); } return report; }