/// <summary>
        /// Собирает данные и сохраняет отчет в указанное место
        /// </summary>
        private string SaveTagsReport(string pathToSave, string reportName, DSRouterTagsReportSettings reportSettings)
        {
            string result = null;

            // Получаем тренды
            var trends = GetTrends(reportSettings.Tags, reportSettings.StartDateTime, reportSettings.EndDateTime);
            if (trends == null || trends.Count == 0)
                return null;

            // Если надо, то приводим тренды к единому шагу
            Dictionary<DateTime, Tuple<object, object, object, object>> trendsWithFixStep = null;
            if (reportSettings.Interval != 0)
            {
                trendsWithFixStep = GetTrendsWithFixStep(trends, reportSettings.Interval, reportSettings.StartDateTime, reportSettings.EndDateTime);
            }

            // Заполняем DataSet
            var dataSource = FillDataSet(null, trends, trendsWithFixStep);

            #region Формирование отчета

            string reportTemplateName = String.IsNullOrWhiteSpace(reportSettings.ReportTamplateName) ? "TagsReport" : reportSettings.ReportTamplateName;

            var report = new Report(reportTemplateName);
            report.SetDataSource(dataSource);

            report.SaveReportFile(pathToSave, reportName, reportSettings.ReportExtension.ToString());

            result = Path.Combine(pathToSave, reportName + "." + reportSettings.ReportExtension.ToString());

            #endregion

            return result;
        }
예제 #2
0
파일: brh.cs 프로젝트: vijayamazon/ezbob
        }         // BuildUiXls

        public ExcelPackage BuildUiExtXls(Report report, DateTime today, DateTime tomorrow)
        {
            KeyValuePair <ReportQuery, DataTable> oData = CreateUiExtReport(report, today, tomorrow);

            return(AddSheetToExcel(oData.Value, report.GetTitle(today, oToDate: tomorrow), "RptUiExtReport"));
        }         // BuildUiExtXls
        /// <summary>
        /// Собирает данные и сохраняет отчет в указанное место
        /// </summary>
        private string SaveEventsReport(string pathToSave, string reportName, DSRouterEventsReportSettings reportSettings)
        {
            string result = null;

            #region Получение данных

            var dsGuid = reportSettings.DsGuid;
            var deviceGuid = reportSettings.DeviceGuid;

            var events = (this as IDSRouter).GetEvents(reportSettings.StartDateTime, reportSettings.EndDateTime,
                false, false, true, new List<Tuple<ushort, uint>> { new Tuple<ushort, uint>(dsGuid, deviceGuid) });

            if (events == null)
                return null;

            #endregion

            #region Подготовка данных

            var dataSource = FillDataSet(events, null, null);

            #endregion

            #region Формирование отчета

            string reportTemplateName = String.IsNullOrWhiteSpace(reportSettings.ReportTamplateName) ? "EventsReport" : reportSettings.ReportTamplateName;

            var report = new Report(reportTemplateName);
            report.SetDataSource(dataSource);

            report.SaveReportFile(pathToSave, reportName, reportSettings.ReportExtension.ToString());

            result = Path.Combine(pathToSave, reportName + "." + reportSettings.ReportExtension.ToString());

            #endregion

            return result;
        }
예제 #4
0
파일: brh.cs 프로젝트: vijayamazon/ezbob
        }         // BuildUiExtReport

        public ExcelPackage BuildLoansIssuedXls(Report report, DateTime today, DateTime tomorrow)
        {
            KeyValuePair <ReportQuery, DataTable> pair = CreateLoansIssuedReport(report, today, tomorrow);

            return(AddSheetToExcel(pair.Value, report.GetTitle(today, oToDate: tomorrow), "RptLoansIssued"));
        }         // BuildLoansIssuedXls