diff --git a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs index 6046d317..89a83e31 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs @@ -92,7 +92,7 @@ namespace BMA.EHR.Application.Repositories.Commands Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" : p.PlacementEducations.FirstOrDefault().Degree, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Oc = p.root == null ? "" : p.root, PositionName = p.positionName == null ? "" : p.positionName, @@ -151,7 +151,7 @@ namespace BMA.EHR.Application.Repositories.Commands Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" : p.PlacementEducations.FirstOrDefault().Degree, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Oc = p.root == null ? "" : p.root, PositionName = p.positionName == null ? "" : p.positionName, @@ -215,7 +215,7 @@ namespace BMA.EHR.Application.Repositories.Commands Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" : p.PlacementEducations.FirstOrDefault().Degree, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "), Probation = pf.IsProbation ? "(อยู่ระหว่างปฏิบัติหน้าที่ราชการ)" : "", @@ -285,7 +285,7 @@ namespace BMA.EHR.Application.Repositories.Commands Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" : p.PlacementEducations.FirstOrDefault().Degree, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "), OldPositionName = pf.Position == null ? "" : pf.Position.Name, @@ -351,13 +351,13 @@ namespace BMA.EHR.Application.Repositories.Commands { Education = p.EducationOld == null ? "-" : p.EducationOld, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = p.rootOld == null ? "" : p.rootOld, OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), NewOc = p.root == null ? "" : p.root, @@ -421,13 +421,13 @@ namespace BMA.EHR.Application.Repositories.Commands // pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree, Education = p.EducationOld == null ? "-" : p.EducationOld, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = p.rootOld == null ? "" : p.rootOld, OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), NewOc = p.root == null ? "" : p.root, @@ -475,20 +475,20 @@ namespace BMA.EHR.Application.Repositories.Commands { Education = p.EducationOld == null ? "-" : p.EducationOld, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = p.rootOld == null ? "" : p.rootOld, OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), NewOc = p.rootOld == null ? "" : p.rootOld, NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(), AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(), @@ -525,20 +525,20 @@ namespace BMA.EHR.Application.Repositories.Commands { Education = p.EducationOld == null ? "-" : p.EducationOld, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = p.rootOld == null ? "" : p.rootOld, OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), NewOc = p.rootOld == null ? "" : p.rootOld, NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(), AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(), @@ -570,7 +570,7 @@ namespace BMA.EHR.Application.Repositories.Commands IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, AuthorizedPosition = r.Command.AuthorizedPosition, - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PlacementCommandIssuer = r.Command.PlacementCommandIssuer ?? "", PlacementCommandNo = r.Command.PlacementCommandNo == null ? "" : r.Command.PlacementCommandNo.ToThaiNumber(), @@ -606,7 +606,7 @@ namespace BMA.EHR.Application.Repositories.Commands IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, AuthorizedPosition = r.Command.AuthorizedPosition, - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PlacementCommandIssuer = r.Command.PlacementCommandIssuer ?? "", PlacementCommandNo = r.Command.PlacementCommandNo == null ? "" : r.Command.PlacementCommandNo.ToThaiNumber(), @@ -647,13 +647,13 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType13Response { Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, PositionName = p.PositionOld == null ? "" : p.PositionOld, PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld, PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld, - PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld, + PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(), Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), //Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(), ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(), @@ -695,7 +695,7 @@ namespace BMA.EHR.Application.Repositories.Commands { Education = p.EducationOld == null ? "-" : p.EducationOld, Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", OldOc = p.OrganizationPositionOld ?? "", OldPositionName = p.OrganizationPositionOld ?? "", @@ -744,7 +744,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType15Response { Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, // PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name, @@ -836,7 +836,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType17Response { Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PositionName = p.PositionOld ?? "", Organization = p.OrganizationPositionOld ?? "", @@ -888,7 +888,7 @@ namespace BMA.EHR.Application.Repositories.Commands IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, AuthorizedPosition = r.Command.AuthorizedPosition, - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", // PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name, Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld, @@ -943,7 +943,7 @@ namespace BMA.EHR.Application.Repositories.Commands IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, AuthorizedPosition = r.Command.AuthorizedPosition, - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name, Organization = p.OrganizationPositionOld ?? "", @@ -997,7 +997,7 @@ namespace BMA.EHR.Application.Repositories.Commands IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, AuthorizedPosition = r.Command.AuthorizedPosition, - CitizenId = r.CitizenId, + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name, Organization = p.OrganizationPositionOld ?? "", @@ -1060,7 +1060,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType21Response { Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId.ToThaiNumber(), + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Organization = r.Organization == null ? "" : r.Organization.ToThaiNumber(), PositionName = r.PositionName == null ? "" : r.PositionName.ToThaiNumber(), @@ -1192,7 +1192,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType21Response { Seq = r.Sequence.ToString().ToThaiNumber(), - CitizenId = r.CitizenId.ToThaiNumber(), + CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Organization = p.OrganizationPositionOld ?? "", PositionName = p.PositionOld ?? "", @@ -1311,7 +1311,7 @@ namespace BMA.EHR.Application.Repositories.Commands { fullName = $"{org.result.prefix}{org.result.firstName} {org.result.lastName}", positionname = org.result.position, - positionno = org.result.posNo, + positionno = org.result.posNo == null ? null : org.result.posNo.ToThaiNumber(), organizationname = org.result.organization, salary = org.result.salary == null ? null : org.result.salary.Value.ToNumericNoDecimalText().ToString(), }; diff --git a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs index fbb36e33..3daa078d 100644 --- a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs @@ -599,14 +599,33 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -720,14 +739,34 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -839,14 +878,33 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } - + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType07AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-แนบท้ายคำสั่งย้าย.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -908,7 +966,6 @@ namespace BMA.EHR.Report.Service.Controllers CommandNo = raw_data.CommandNo.ToThaiNumber(), CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), IssuerOrganizationName = raw_data.IssuerOrganizationName, - ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(), ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(), ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(), ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(), @@ -960,14 +1017,31 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } - + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId); - return data; + return new { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -1084,14 +1158,32 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } - + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType09AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -1378,14 +1470,32 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } - + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType13AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -1500,14 +1610,33 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } - + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType14AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -1619,14 +1748,34 @@ namespace BMA.EHR.Report.Service.Controllers { try { - var command = await _repository.GetByIdAsync(commandId); - if (command == null) + //var command = await _repository.GetByIdAsync(commandId); + //if (command == null) + //{ + // throw new Exception(GlobalMessages.CommandNotFound); + //} + var raw_data = await _repository.GetByIdAsync(commandId); + if (raw_data == null) { throw new Exception(GlobalMessages.CommandNotFound); } + var command = new + { + CommandNo = raw_data.CommandNo.ToThaiNumber(), + CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(), + IssuerOrganizationName = raw_data.IssuerOrganizationName, + CommandExcecuteDate = raw_data.CommandExcecuteDate != null ? raw_data.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber() : "-", + }; var data = await _commandReportRepository.GetCommandType15AttachmentAsync(commandId); - return data; + return new + { + CommandNo = command.CommandNo, + CommandYear = command.CommandYear, + IssuerOrganizationName = command.IssuerOrganizationName, + CommandExcecuteDate = command.CommandExcecuteDate, + data = data, + }; + //var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"29-คำสั่งให้ช่วยราชการ-2.trdp"); //ReportPackager reportPackager = new ReportPackager(); @@ -3079,7 +3228,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-05", + template = "C-PM-05-attachment", reportName = "docx-report", data = contentData }; @@ -3175,7 +3324,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-06", + template = "C-PM-06-attachment", reportName = "docx-report", data = contentData }; @@ -3271,7 +3420,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-07", + template = "C-PM-07-attachment", reportName = "docx-report", data = contentData }; @@ -3367,7 +3516,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-08", + template = "C-PM-08-attachment", reportName = "docx-report", data = contentData }; @@ -3463,7 +3612,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - //template = "DP6_006", + template = "C-PM-09-attachment", reportName = "docx-report", data = contentData }; @@ -3715,7 +3864,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-13", + template = "C-PM-13-attachment", reportName = "docx-report", data = contentData }; @@ -3811,7 +3960,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-14", + template = "C-PM-14-attachment", reportName = "docx-report", data = contentData }; @@ -3907,7 +4056,7 @@ namespace BMA.EHR.Report.Service.Controllers //return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}"); var data = new { - template = "C-PM-15", + template = "C-PM-15-attachment", reportName = "docx-report", data = contentData };