diff --git a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs index 99245de5..1221274d 100644 --- a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs @@ -1011,7 +1011,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-09 " - private async Task GenerateCommandReportType09_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType09_Cover(Guid commandId, string exportType) { try { @@ -1045,34 +1045,34 @@ namespace BMA.EHR.Report.Service.Controllers MilitaryCommanDate = raw_data.MilitaryCommanDate == null ? "" : raw_data.MilitaryCommanDate.Value.ToThaiFullDate3().ToThaiNumber(), Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.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 { @@ -1080,7 +1080,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType09_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType09_Attachment(Guid commandId, string exportType) { try { @@ -1091,39 +1091,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType09AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.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 { @@ -1135,7 +1135,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-10 " - private async Task GenerateCommandReportType10_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType10_Cover(Guid commandId, string exportType) { try { @@ -1176,34 +1176,34 @@ namespace BMA.EHR.Report.Service.Controllers Duration = raw_data.ProbationStartDate == null || raw_data.ProbationEndDate == null ? "" : raw_data.ProbationStartDate.Value.CalculateBetweenDateV2(raw_data.ProbationEndDate.Value).ToThaiNumber(), Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"10-แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"10-แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ.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 { @@ -1215,7 +1215,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-11 " - private async Task GenerateCommandReportType11_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType11_Cover(Guid commandId, string exportType) { try { @@ -1226,31 +1226,31 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType11Async(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"11-คำสั่งให้ข้าราชการที่ผ่านการประเมิน รับราชการต่อไป.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"11-คำสั่งให้ข้าราชการที่ผ่านการประเมิน รับราชการต่อไป.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 = data; - report.DataSource = data; + //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 { @@ -1262,7 +1262,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-12 " - private async Task GenerateCommandReportType12_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType12_Cover(Guid commandId, string exportType) { try { @@ -1273,31 +1273,31 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType11Async(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"12-คำสั่งให้ข้าราชการที่ไม่ผ่านการประเมิน ออกจากราชการ.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"12-คำสั่งให้ข้าราชการที่ไม่ผ่านการประเมิน ออกจากราชการ.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 = data; - report.DataSource = data; + //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 { @@ -1309,7 +1309,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-13 " - private async Task GenerateCommandReportType13_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType13_Cover(Guid commandId, string exportType) { try { @@ -1339,34 +1339,34 @@ namespace BMA.EHR.Report.Service.Controllers ReceiveOrganizationName = raw_data.ReceiveOrganizationName, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-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 { @@ -1374,7 +1374,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType13_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType13_Attachment(Guid commandId, string exportType) { try { @@ -1385,39 +1385,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType13AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-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["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 { @@ -1429,7 +1429,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-14 " - private async Task GenerateCommandReportType14_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType14_Cover(Guid commandId, string exportType) { try { @@ -1461,34 +1461,34 @@ namespace BMA.EHR.Report.Service.Controllers ConclusionReceiveDate = raw_data.ConclusionReceiveDate == null ? "" : raw_data.ConclusionReceiveDate.Value.ToThaiFullDate3().ToThaiNumber(), Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-5.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ-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 { @@ -1496,7 +1496,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType14_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType14_Attachment(Guid commandId, string exportType) { try { @@ -1507,39 +1507,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType14AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.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 { @@ -1551,7 +1551,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-15 " - private async Task GenerateCommandReportType15_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType15_Cover(Guid commandId, string exportType) { try { @@ -1580,34 +1580,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-1.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-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 { @@ -1615,7 +1615,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType15_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType15_Attachment(Guid commandId, string exportType) { try { @@ -1626,39 +1626,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType15AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-2.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-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["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 { @@ -1670,7 +1670,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-16 " - private async Task GenerateCommandReportType16_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType16_Cover(Guid commandId, string exportType) { try { @@ -1702,34 +1702,34 @@ namespace BMA.EHR.Report.Service.Controllers //}; var data = await _commandReportRepository.GetCommandType16Async(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"30-คำสั่งส่งตัวกลับไปปฏิบัติงานทางต้นสังกัดเดิม.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"30-คำสั่งส่งตัวกลับไปปฏิบัติงานทางต้นสังกัดเดิม.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 = data; - report.DataSource = data; + //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 { @@ -1741,7 +1741,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-17 " - private async Task GenerateCommandReportType17_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType17_Cover(Guid commandId, string exportType) { try { @@ -1770,34 +1770,34 @@ namespace BMA.EHR.Report.Service.Controllers AuthorizedPosition = raw_data.AuthorizedPosition, Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-4.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-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); - } + //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 { @@ -1805,7 +1805,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType17_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType17_Attachment(Guid commandId, string exportType) { try { @@ -1816,39 +1816,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType17AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-5.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"34-คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ-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); - } + //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 { @@ -1860,7 +1860,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-18 " - private async Task GenerateCommandReportType18_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType18_Cover(Guid commandId, string exportType) { try { @@ -1871,31 +1871,31 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType18Async(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งให้ออกจากราชการ.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งให้ออกจากราชการ.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 = data; - report.DataSource = data; + //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 { @@ -2093,7 +2093,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-21 " - private async Task GenerateCommandReportType21_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType21_Cover(Guid commandId, string exportType) { try { @@ -2123,40 +2123,40 @@ namespace BMA.EHR.Report.Service.Controllers Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var receiver = await _commandReportRepository.GetCommandType21AttachmentAsync(commandId); - var receiver = await _commandReportRepository.GetCommandType21AttachmentAsync(commandId); + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"20-คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ-2.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"20-คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ-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); - } + //report.DataSource = command; - report.DataSource = command; + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblData.DataSource = receiver; - tblData.DataSource = receiver; + //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 { @@ -2168,7 +2168,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-22 " - private async Task GenerateCommandReportType22_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType22_Cover(Guid commandId, string exportType) { try { @@ -2199,34 +2199,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", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).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 { @@ -2234,7 +2234,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType22_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType22_Attachment(Guid commandId, string exportType) { try { @@ -2245,39 +2245,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.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 { @@ -2288,7 +2288,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-23 " - private async Task GenerateCommandReportType23_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType23_Cover(Guid commandId, string exportType) { try { @@ -2318,40 +2318,40 @@ namespace BMA.EHR.Report.Service.Controllers Subject = $"เรื่อง {raw_data.CommandSubject}", }; + return command; + //var receiver = await _commandReportRepository.GetCommandType23AttachmentAsync(commandId); - var receiver = await _commandReportRepository.GetCommandType23AttachmentAsync(commandId); + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"35-คำสั่งอนุญาตให้ลูกจ้างลาออก.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"35-คำสั่งอนุญาตให้ลูกจ้างลาออก.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; + //var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblData.DataSource = receiver; - tblData.DataSource = receiver; + //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 { @@ -2363,7 +2363,7 @@ namespace BMA.EHR.Report.Service.Controllers #region " C-PM-24 " - private async Task GenerateCommandReportType24_Cover(Guid commandId, string exportType) + private async Task GenerateCommandReportType24_Cover(Guid commandId, string exportType) { try { @@ -2396,34 +2396,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", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).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 { @@ -2431,7 +2431,7 @@ namespace BMA.EHR.Report.Service.Controllers } } - private async Task GenerateCommandReportType24_Attachment(Guid commandId, string exportType) + private async Task GenerateCommandReportType24_Attachment(Guid commandId, string exportType) { try { @@ -2442,39 +2442,39 @@ namespace BMA.EHR.Report.Service.Controllers } var data = await _commandReportRepository.GetCommandType24AttachmentAsync(commandId); + return data; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp"); - var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.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 { @@ -3302,7 +3302,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType09_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-09", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3341,7 +3348,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType09_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 = "DP6_006", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3384,7 +3398,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType10_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-10", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3427,7 +3448,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType11_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-11", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3470,7 +3498,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType12_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-12", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3513,7 +3548,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType13_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-13", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3552,7 +3594,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType13_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-13", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3595,7 +3644,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType14_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-14", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3634,7 +3690,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType14_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-14", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3677,7 +3740,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType15_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-15", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3716,7 +3786,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType15_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-15", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3759,7 +3836,15 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType16_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-16", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3802,7 +3887,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType17_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-17", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3841,7 +3933,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType17_Attachment(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-17", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -3884,7 +3983,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType18_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-18", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4055,7 +4161,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType21_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-21", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4098,7 +4211,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType22_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-22", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4137,7 +4257,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType22_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-22", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4180,7 +4307,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType23_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-23", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4223,7 +4357,14 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); var contentData = await GenerateCommandReportType24_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-24", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch { @@ -4262,7 +4403,14 @@ namespace BMA.EHR.Report.Service.Controllers } var contentData = await GenerateCommandReportType24_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-24", + reportName = "docx-report", + data = contentData + }; + return Success(data); } catch {