private async Task <ReportModel> GetReportModel(string filter)
        {
            string html = null;

            if (!string.IsNullOrEmpty(filter))
            {
                var request = new AReport_GetReport()
                {
                    ReportName = filter
                };

                var response = await ReportAdminService.GetReportAsync(request);

                html = response.Html;
            }

            var model = ModelFactory.CreateReportModel(html, filter);

            return(model);
        }
Exemple #2
0
        public async Task <AReport_Report> GetReportAsync(AReport_GetReport request)
        {
            using var log = BeginFunction(nameof(ReportAdminService), nameof(AReport_Report), request);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var report = request.ReportName switch
                {
                    "RecordCountReport" => new RecordCountReport(),
                    "OrderLedgerAccountBalancesReport" => new OrderLedgerAccountBalancesReport(),
                    "OrderStatusReport" => new OrderStatusReport(),
                    "TypeTableSummaryReport" => new TypeTableSummaryReport(),
                    _ => (IReport)null,
                };

                var result = new AReport_Report();

                //if (report != null)
                //{
                //    var writer = new HtmlReportWriter();
                //    report.Run(writer, QuiltContextFactory);

                //    using var stringWriter = new StringWriter();

                //    writer.RenderHtmlTable(stringWriter);
                //    result.Html = stringWriter.ToString();
                //}

                log.Result(result);
                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }