Esempio n. 1
0
        public async Task <string> CreateAntiBodyTestReport(LabOrderReport dataSource, string templateName)
        {
            string filePath = System.Configuration.ConfigurationManager.AppSettings["ReportTemplateLocation"].ToString() + "\\" + templateName + ".trdx";

            XmlReaderSettings settings = new XmlReaderSettings();

            settings.IgnoreWhitespace = true;

            Telerik.Reporting.Report report = null;

            using (XmlReader xmlReader = XmlReader.Create(filePath, settings))
            {
                ReportXmlSerializer xmlSerializer = new ReportXmlSerializer();
                report = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
            }

            report.DataSource = dataSource;


            ReportProcessor      reportProcessor      = new ReportProcessor();
            InstanceReportSource instanceReportSource = new InstanceReportSource();

            instanceReportSource.ReportDocument = report;
            RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);

            return(Convert.ToBase64String(result.DocumentBytes));
        }
        public async Task <string> CreateAntiBodyTestReport([FromBody] LabOrderReport reportInfo)
        {
            string templateName = "AntiBodyTestReport";

            if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.TemplateName))
            {
                templateName = templateName + "_" + reportInfo.TemplateName;
            }

            ReportCreator report = new ReportCreator();

            return(await report.CreateAntiBodyTestReport(reportInfo, templateName));
        }
        public async Task <string> CreateLabOrderRequisitionReport([FromBody] LabOrderReport reportInfo)
        {
            string templateName = "ToxicologyAccessionCaseReport";

            if (reportInfo != null && !string.IsNullOrEmpty(reportInfo.TemplateName))
            {
                templateName = "MolecularRequisitionReport" + reportInfo.TemplateName;
            }

            ReportCreator report = new ReportCreator();

            return(await report.CreateLabOrderRequisitionReport(reportInfo, templateName));
        }