コード例 #1
0
        private CompactionReportResult ConvertStationOffsetResult(CompactionReportStationOffsetRequest request, Stream stream)
        {
            log.LogDebug($"{nameof(ConvertStationOffsetResult)}");

            // Unpack the data for the report and construct a stream containing the result
            var reportPackager = new TRaptorReportsPackager(TRaptorReportType.rrtStationOffset)
            {
                ReturnCode = TRaptorReportReturnCode.rrrcUnknownError
            };

            log.LogDebug($"{nameof(ConvertStationOffsetResult)}: Retrieving response data");
            reportPackager.ReadFromStream(stream);

            var stationRows = new StationRow[reportPackager.StationOffsetReport.NumberOfStations];

            for (var i = 0; i < reportPackager.StationOffsetReport.NumberOfStations; i++)
            {
                var station    = reportPackager.StationOffsetReport.Stations[i];
                var stationRow = StationRow.Create(station, request);

                for (var j = 0; j < station.NumberOfOffsets; j++)
                {
                    stationRow.Offsets[j] = StationOffsetRow.CreateRow(station.Offsets[j], request);
                }

                stationRows[i] = stationRow;
            }

            var startAndEndTime     = request.Filter.StartUtc ?? DateTime.UtcNow;
            var stationOffsetReport = new StationOffsetReport(startAndEndTime, startAndEndTime, stationRows, request);

            return(CompactionReportResult.CreateExportDataResult(stationOffsetReport, 1));
        }
コード例 #2
0
        private CompactionReportResult ConvertGridResult(CompactionReportGridRequest request, Stream stream)
        {
            log.LogDebug($"{nameof(ConvertGridResult)}");

            // Unpack the data for the report and construct a stream containing the result
            var reportPackager = new TRaptorReportsPackager(TRaptorReportType.rrtGridReport)
            {
                ReturnCode = TRaptorReportReturnCode.rrrcUnknownError
            };

            reportPackager.GridReport.ElevationReport   = request.ReportElevation;
            reportPackager.GridReport.CutFillReport     = request.ReportCutFill;
            reportPackager.GridReport.CMVReport         = request.ReportCMV;
            reportPackager.GridReport.MDPReport         = request.ReportMDP;
            reportPackager.GridReport.PassCountReport   = request.ReportPassCount;
            reportPackager.GridReport.TemperatureReport = request.ReportTemperature;

            log.LogDebug($"{nameof(ConvertGridResult)}: Retrieving response data");

            reportPackager.ReadFromStream(stream);

            var gridRows = new GridRow[reportPackager.GridReport.NumberOfRows];

            // Populate an array of grid rows from the data
            for (var i = 0; i < reportPackager.GridReport.NumberOfRows; i++)
            {
                gridRows[i] = GridRow.CreateRow(reportPackager.GridReport.Rows[i], request);
            }

            var startTime = request.Filter != null && request.Filter.StartUtc.HasValue
        ? request.Filter.StartUtc.Value
        : DateTime.Now;
            var endTime = request.Filter != null && request.Filter.EndUtc.HasValue
        ? request.Filter.EndUtc.Value
        : DateTime.Now;

            var gridReport = GridReport.CreateGridReport(startTime, endTime, gridRows);

            return(CompactionReportResult.CreateExportDataResult(gridReport, 1));
        }