private static string GetDateRangeText(SubscriptionDetails subscriptionDetails) { var recurrencePattern = (WeeklyRecurrence)subscriptionDetails.ScheduleDefinition.Item; string endDate = subscriptionDetails.EndDateTime != DateTime.MinValue ? " " + Resources.ReportFrequencyEnding + " " + subscriptionDetails.EndDateTime.ToShortDateString() : ""; if (recurrencePattern.ReportFrequency() == ReportFrequency.Daily) { return string.Format(CultureInfo.InvariantCulture, Resources.ReportFrequencyDailyText, subscriptionDetails.StartDateTime.ToShortTimeString(), " " + Resources.ReportFrequencyStarting + " " + subscriptionDetails.StartDateTime.ToShortDateString(), endDate); } string dayOfWeek = recurrencePattern.DayOfWeek(); return string.Format(CultureInfo.InvariantCulture, Resources.ReportFrequencyWeeklyText, dayOfWeek, subscriptionDetails.StartDateTime.ToShortTimeString(), " " + Resources.ReportFrequencyStarting + " " + subscriptionDetails.StartDateTime.ToShortDateString(), endDate); }
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; }