From d7bed1516f89cc6d00f978499faf4501461dde38 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 26 Jun 2024 16:46:40 +0700 Subject: [PATCH] command report 01-09 --- .../Controllers/CommandReportController.cs | 858 ++++++++++-------- 1 file changed, 481 insertions(+), 377 deletions(-) diff --git a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs index 1221274d..45fde803 100644 --- a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs @@ -54,7 +54,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-01 " - private async Task GenerateCommandReportType01_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType01_Cover(Guid commandId, string exportType) { try { @@ -83,34 +83,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-1.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -118,7 +118,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType01_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType01_Attachment(Guid commandId, string exportType) { try { @@ -129,39 +129,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType01AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -173,7 +173,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-02 " - private async Task GenerateCommandReportType02_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType02_Cover(Guid commandId, string exportType) { try { @@ -202,34 +202,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-3.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-3.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -237,7 +237,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType02_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType02_Attachment(Guid commandId, string exportType) { try { @@ -248,39 +248,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType02AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -292,7 +292,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-03 " - private async Task GenerateCommandReportType03_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType03_Cover(Guid commandId, string exportType) { try { @@ -321,34 +321,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน-Head.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน-Head.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -356,7 +356,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType03_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType03_Attachment(Guid commandId, string exportType) { try { @@ -367,39 +367,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"03-คำสั่งแต่งตั้งผู้สอบแข่งขัน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -411,7 +411,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-04 " - private async Task GenerateCommandReportType04_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType04_Cover(Guid commandId, string exportType) { try { @@ -440,34 +440,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน-Head.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน-Head.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -475,7 +475,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType04_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType04_Attachment(Guid commandId, string exportType) { try { @@ -486,38 +486,38 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType03AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"04-คำสั่งย้ายผู้สอบแข่งขัน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //var content = result.DocumentBytes; - var content = result.DocumentBytes; - - return content; + //return content; } catch { @@ -529,7 +529,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-05 " - private async Task GenerateCommandReportType05_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType05_Cover(Guid commandId, string exportType) { try { @@ -560,34 +560,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -595,7 +595,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType05_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType05_Attachment(Guid commandId, string exportType) { try { @@ -606,39 +606,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -650,7 +650,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-06 " - private async Task GenerateCommandReportType06_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType06_Cover(Guid commandId, string exportType) { try { @@ -681,34 +681,34 @@ namespace BMA.EHR.Report.Service.Controllers ConclusionMeetingDate = raw_data.ConclusionMeetingDate == null ? "" : raw_data.ConclusionMeetingDate.Value.ToThaiFullDate3().ToThaiNumber(), Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-คำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -716,7 +716,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType06_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType06_Attachment(Guid commandId, string exportType) { try { @@ -727,39 +727,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -771,7 +771,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-07 " - private async Task GenerateCommandReportType07_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType07_Cover(Guid commandId, string exportType) { try { @@ -800,34 +800,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-คำสั่งย้าย.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-คำสั่งย้าย.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -835,7 +835,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType07_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType07_Attachment(Guid commandId, string exportType) { try { @@ -846,39 +846,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType07AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-แนบท้ายคำสั่งย้าย.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-แนบท้ายคำสั่งย้าย.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -890,7 +890,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-08 " - private async Task GenerateCommandReportType08_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType08_Cover(Guid commandId, string exportType) { try { @@ -921,34 +921,34 @@ namespace BMA.EHR.Report.Service.Controllers ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(), Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //report.DataSource = command; - report.DataSource = command; + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //if (exportType == "docx") + // deviceInfo["OutputFormat"] = "DOCX"; - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - if (exportType == "docx") - deviceInfo["OutputFormat"] = "DOCX"; - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -956,7 +956,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType08_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType08_Attachment(Guid commandId, string exportType) { try { @@ -967,39 +967,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp"); + //ReportPackager reportPackager = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //{ + // report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); + //} - ReportPackager reportPackager = new ReportPackager(); - Telerik.Reporting.Report? report = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - { - report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream); - } + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblData.DataSource = data; - tblData.DataSource = data; + //report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; + //report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); + //report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); + //report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); - report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; - report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); - report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report - }; + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report + //}; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo); - var content = result.DocumentBytes; + //var content = result.DocumentBytes; - return content; + //return content; } catch { @@ -2640,7 +2640,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType01_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-01", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2679,7 +2686,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType01_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-01", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2722,8 +2736,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType02_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); - + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-02", + reportName = "docx-report", + data = contentData + }; + return Success(data); //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-3.trdp"); //var contentData = _reportGenerator.GenerateReport(rptFile, exportType); @@ -2767,7 +2787,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType02_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-02", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2810,7 +2837,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType03_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-03", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2849,7 +2883,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType03_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-03", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2892,7 +2933,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType04_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-04", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2931,7 +2979,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType04_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-04", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -2974,7 +3029,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType05_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-05", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3013,7 +3075,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType05_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-05", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3056,7 +3125,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType06_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-06", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3095,7 +3171,7 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType06_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); } catch { @@ -3138,7 +3214,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType07_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-07", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3177,7 +3260,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType07_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-07", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3220,7 +3310,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType08_Cover(id, exportType); - return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-08", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3259,7 +3356,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType08_Attachment(id, exportType); - return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); + var data = new + { + template = "C-PM-08", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch {