private Dictionary <string, List <StreamPayloadBaseType> > m_reportIntervalPayloads = new Dictionary <string, List <StreamPayloadBaseType> >(); // payloads for an interval for a date public ReportWrapper(string reportSpecifierID, ReportName reportName, int duration, DurationModifier durationModifier) { ReportSpecifierID = reportSpecifierID; m_reportName = reportName; m_reportDuration = new DurationPropType(); m_reportDuration.duration = "PT" + duration.ToString() + durationModifier.Value; }
/**********************************************************/ public oadrReportType generateReport(string reportSpecifierID, DateTime dtstartUTC) { oadrReportType report = _reports[reportSpecifierID]; ReportName reportName = _reportNames[reportSpecifierID]; report.reportName = reportName.Name; // save the duration and restore after generating the report // the duration is only required when registering the report; it indicates // the max history that is recorded, and the max time frame the can be included in a report DurationPropType duraton = report.duration; report.duration = null; report.createdDateTime = DateTime.UtcNow; List <IntervalType> reportIntervals; try { reportIntervals = _reportIntervals[reportSpecifierID]; } catch (System.Collections.Generic.KeyNotFoundException) { // the report does not have any descriptors return(report); } // the dtstart of the report must match the dtstart of the first interval report.dtstart = new dtstart(); report.dtstart.datetime = reportIntervals[0].dtstart.datetime; IntervalType[] intervalsArray = new IntervalType[reportIntervals.Count]; int intervalIndex = 0; foreach (IntervalType interval in reportIntervals) { intervalsArray[intervalIndex] = interval; List <oadrReportPayloadType> reportIntervalPayloads = _reportIntervalPayloads[reportSpecifierID][intervalIndex]; interval.streamPayloadBase = new StreamPayloadBaseType[reportIntervalPayloads.Count]; int payloadIndex = 0; foreach (oadrReportPayloadType reportPayload in reportIntervalPayloads) { interval.streamPayloadBase[payloadIndex] = reportPayload; payloadIndex++; } reportIntervalPayloads.Clear(); intervalIndex++; } _reportIntervals.Remove(reportSpecifierID); _reportIntervalPayloads.Remove(reportSpecifierID); report.oadrReportDescription = null; report.intervals = intervalsArray; return(report); }