Example #1
0
        public static ReportExecution GetReportExecutionFromRow(GetExecutionFromQueueRow execRow, GetFormatRow formatRow, GetReportRow reportRow, GetSubscriptionRow subscriptionRow, string destTimeZone)
        {
            var curPrms        = GetActualParameterValuesFromXml(execRow.Parameters, reportRow.ReportPath, execRow.ScheduledStartDate);
            var baseCoTimeZone = !string.IsNullOrEmpty(destTimeZone) ? destTimeZone : Report.GetBaseCompanyTimeZoneIdentifier(reportRow.ReportPath, curPrms, ServerTimeZoneIdentifier);

            Logger.TraceEvent(TraceEventType.Verbose, 0, "{0}: Base TranCo Time Zone={1}", System.Threading.Thread.CurrentThread.ManagedThreadId, baseCoTimeZone);

            var startDateInBaseCoTimeZone = TimeZoneInfoExtension.SafeConvertTimeBySystemTimeZoneId(execRow.ScheduledStartDate.Value, ServerTimeZoneIdentifier, baseCoTimeZone);
            var schedule = (subscriptionRow != null ?
                            new Schedule(
                                subscriptionRow.ScheduleFrequencyID,
                                subscriptionRow.FrequencyInterval,
                                subscriptionRow.FrequencyRecurrenceFactor,
                                subscriptionRow.FrequencyRelativeInterval,
                                (DateTime?)startDateInBaseCoTimeZone,
                                subscriptionRow.StartTime,
                                subscriptionRow.EndTime) :
                            null);
            var nextRun  = schedule.RecurrenceOption != ScheduleRecurrence.Once ? schedule.GetNextRunDate(startDateInBaseCoTimeZone) : null;
            var nextPrms = GetActualParameterValuesFromXml(subscriptionRow.Parameters, reportRow.ReportPath, nextRun);

            //build the execution
            var exec = new ReportExecution
            {
                Id                = execRow.ReportExecutionID.ToString(),
                Name              = subscriptionRow.Name,
                ReportPath        = Report.GetSpecificReportPath(reportRow.ReportID.ToString(), reportRow.ReportPath, curPrms),
                FormatId          = formatRow.ReportFormatID,
                Format            = formatRow.SSRSFormat,
                FileType          = formatRow.Extension,
                DeviceInfo        = formatRow.SSRSDeviceInfo,
                Error             = null,
                HistoryId         = null,
                ParameterLanguage = "en-us",
                Parameters        =
                    (from p in curPrms
                     select new Emdat.InVision.SSRSExecution.ParameterValue
                {
                    Name = p.Name,
                    Value = p.Value
                }).ToList(),
                ScheduledRunTime     = execRow.ScheduledStartDate,
                State                = (ReportExecutionStateEnum)execRow.ReportExecutionStatusID,
                Data                 = null,
                SubscriptionId       = execRow.ReportSubscriptionID.Value,
                ReportId             = execRow.ReportID.Value,
                NextScheduledRunTime = nextRun.HasValue ?
                                       (DateTime?)TimeZoneInfoExtension.SafeConvertTimeBySystemTimeZoneId(nextRun.Value, baseCoTimeZone, ServerTimeZoneIdentifier) :
                                       null,
                NextScheduledRunParameters = nextPrms,
                ErrorCount          = execRow.ErrorCount.HasValue ? execRow.ErrorCount.Value : 0,
                SubscriptionOptions = subscriptionRow.Options,
                ReportOptions       = reportRow.Options
            };

            return(exec);
        }
Example #2
0
 public static ReportExecution GetReportExecutionFromRow(GetExecutionFromQueueRow execRow, GetFormatRow formatRow, GetReportRow reportRow, GetSubscriptionRow subscriptionRow)
 {
     return(GetReportExecutionFromRow(execRow, formatRow, reportRow, subscriptionRow, null));
 }