From bcb7c7781c763179e81f6d25b1fc199bfa1838cb Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 26 Mar 2025 17:12:46 +0700 Subject: [PATCH 1/7] #111 , #1271 --- .../PlacementAppointmentController.cs | 48 ++++++------------- .../PlacementAppointmentEmployeeController.cs | 2 +- .../Controllers/PlacementController.cs | 8 ++++ .../Controllers/PlacementOfficerController.cs | 9 +--- .../Controllers/PlacementReceiveController.cs | 12 +++-- .../PlacementRepatriationController.cs | 10 ++-- .../PlacementTransferController.cs | 17 +++---- .../Controllers/RetirementOtherController.cs | 10 ++-- .../Controllers/RetirementOutController.cs | 4 +- .../Controllers/RetirementResignController.cs | 5 +- 10 files changed, 51 insertions(+), 74 deletions(-) diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index 55406e64..546a5aac 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -461,7 +461,7 @@ namespace BMA.EHR.Placement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementAppointment.OrganizationPositionOld = org.result.position + "\n" + placementAppointment.OrganizationOld; + placementAppointment.OrganizationPositionOld = org.result.position + "\n" + (placementAppointment.PositionExecutiveOld == null ? "" : placementAppointment.PositionExecutiveOld + "\n") + placementAppointment.OrganizationOld; placementAppointment.AmountOld = org.result.salary; } await _context.PlacementAppointments.AddAsync(placementAppointment); @@ -812,18 +812,14 @@ namespace BMA.EHR.Placement.Service.Controllers No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Education = p.EducationOld == null ? "-" : p.EducationOld, - OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOc = p.OrganizationPositionOld, OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld, OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld, OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), LeaveDate = "-", NewOc = (p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -1026,18 +1022,14 @@ namespace BMA.EHR.Placement.Service.Controllers No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Education = p.EducationOld == null ? "-" : p.EducationOld, - OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOc = p.OrganizationPositionOld, OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld, OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld, OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), LeaveDate = "-", - NewOc = (p.position == null ? "" : $"{p.position}\n") + + NewOc =(p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -1242,16 +1234,12 @@ namespace BMA.EHR.Placement.Service.Controllers { No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", - OldOrganization = (p.positionOld == null ? "" : $"{p.positionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOrganization = p.OrganizationPositionOld, OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld.ToThaiNumber(), OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), NewOc = (p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -1446,13 +1434,8 @@ namespace BMA.EHR.Placement.Service.Controllers { No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", - OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), - OldPositionNumber = p.posMasterNoOld == null ? "-" : + OldOc = p.OrganizationPositionOld, + OldPositionNumber = p.posMasterNoOld == null ? "-" : p.child4Old != null ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : p.child3Old != null ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : p.child2Old != null ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : @@ -1460,6 +1443,7 @@ namespace BMA.EHR.Placement.Service.Controllers p.rootOld != null ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-", OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), NewOc = (p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -1661,12 +1645,7 @@ namespace BMA.EHR.Placement.Service.Controllers No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Education = p.EducationOld == null ? "-" : p.EducationOld, - OldOc = (p.positionOld == null ? "" : $"{p.positionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOc = p.OrganizationPositionOld, OldPositionType = p.posTypeNameOld == null ? "-" : p.posTypeNameOld, OldPositionLevel = p.posLevelNameOld == null ? "-" : p.posLevelNameOld, OldPositionNumber = p.posMasterNoOld == null ? "-" : @@ -1677,7 +1656,8 @@ namespace BMA.EHR.Placement.Service.Controllers p.rootOld != null ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-", OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), PositionDate = p.PositionDate == null ? "-" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), - NewOc = (p.position == null ? "" : $"{p.position}\n") + + NewOc = (p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs index 227448d9..d3fc40a7 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs @@ -488,7 +488,7 @@ namespace BMA.EHR.Placement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementAppointment.OrganizationPositionOld = org.result.position + "\n" + placementAppointment.OrganizationOld; + placementAppointment.OrganizationPositionOld = org.result.position + "\n" + (placementAppointment.PositionExecutiveOld == null ? "" : placementAppointment.PositionExecutiveOld + "\n") + placementAppointment.OrganizationOld; } await _context.PlacementAppointments.AddAsync(placementAppointment); await _context.SaveChangesAsync(); diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index f47673e8..761fa022 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -1629,6 +1629,7 @@ namespace BMA.EHR.Placement.Service.Controllers ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(), PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()} {p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}", Oc = (p.positionName == null ? "" : $"{p.positionName}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -1959,6 +1960,7 @@ namespace BMA.EHR.Placement.Service.Controllers ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(), PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()} {p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}", Oc = (p.positionName == null ? "" : $"{p.positionName}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -2282,6 +2284,7 @@ namespace BMA.EHR.Placement.Service.Controllers Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" : p.PlacementEducations.FirstOrDefault().Degree, OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + @@ -2298,6 +2301,7 @@ namespace BMA.EHR.Placement.Service.Controllers OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), OldPosition = p.positionNameOld == null ? "-" : p.positionNameOld, NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -2512,6 +2516,7 @@ namespace BMA.EHR.Placement.Service.Controllers Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" : p.PlacementEducations.FirstOrDefault().Degree, OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + @@ -2528,6 +2533,7 @@ namespace BMA.EHR.Placement.Service.Controllers p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-", OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + @@ -2731,6 +2737,7 @@ namespace BMA.EHR.Placement.Service.Controllers Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" : p.PlacementEducations.FirstOrDefault().Degree, OldOc = (p.positionNameOld == null ? "" : $"{p.positionNameOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + @@ -2747,6 +2754,7 @@ namespace BMA.EHR.Placement.Service.Controllers OldSalary = p.Amount == null ? "-" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(), LeaveDate = "-", NewOc = (p.positionName == null ? "" : $"{p.positionName}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs index bd34d64a..9e14cb5a 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementOfficerController.cs @@ -411,7 +411,7 @@ namespace BMA.EHR.Placement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementOfficer.OrganizationPositionOld = org.result.position + "\n" + placementOfficer.OrganizationOld; + placementOfficer.OrganizationPositionOld = org.result.position + "\n" + (placementOfficer.PositionExecutiveOld == null ? "" : placementOfficer.PositionExecutiveOld + "\n") + placementOfficer.OrganizationOld; } await _context.PlacementOfficers.AddAsync(placementOfficer); await _context.SaveChangesAsync(); @@ -614,12 +614,7 @@ namespace BMA.EHR.Placement.Service.Controllers { No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", - PositionName = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + PositionName = p.OrganizationPositionOld, Organization = p.Organization == null ? "" : p.Organization, StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(), EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(), diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs index 99bf35eb..16384f30 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementReceiveController.cs @@ -501,12 +501,12 @@ namespace BMA.EHR.Placement.Service.Controllers placementReceive.PositionLevelOld = org.result.posLevelName; placementReceive.PositionTypeOld = org.result.posTypeName; placementReceive.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo; - placementReceive.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") + - (org.result.child3 == null ? "" : org.result.child3 + " ") + - (org.result.child2 == null ? "" : org.result.child2 + " ") + - (org.result.child1 == null ? "" : org.result.child1 + " ") + + placementReceive.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") + + (org.result.child3 == null ? "" : org.result.child3 + "\n") + + (org.result.child2 == null ? "" : org.result.child2 + "\n") + + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementReceive.OrganizationPositionOld = org.result.position + "\n" + placementReceive.OrganizationOld; + placementReceive.OrganizationPositionOld = org.result.position + "\n" + (placementReceive.PositionExecutiveOld == null ? "" : placementReceive.PositionExecutiveOld + "\n") + placementReceive.OrganizationOld; } } await _context.PlacementReceives.AddAsync(placementReceive); @@ -940,6 +940,7 @@ namespace BMA.EHR.Placement.Service.Controllers Education = p.EducationOld == null ? "-" : p.EducationOld, OldOrg = p.OrganizationPositionOld ?? "-", OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + @@ -949,6 +950,7 @@ namespace BMA.EHR.Placement.Service.Controllers OldPositionLevel = p.PositionLevelOld ?? "-", OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), NewOc = (p.position == null ? "" : $"{p.position}\n") + + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + (p.child2 == null ? "" : $"{p.child2}\n") + diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs index ab55e124..da1b3256 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementRepatriationController.cs @@ -283,12 +283,12 @@ namespace BMA.EHR.Placement.Service.Controllers placementRepatriation.PositionLevelOld = org.result.posLevelName; placementRepatriation.PositionTypeOld = org.result.posTypeName; placementRepatriation.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo; - placementRepatriation.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") + - (org.result.child3 == null ? "" : org.result.child3 + " ") + - (org.result.child2 == null ? "" : org.result.child2 + " ") + - (org.result.child1 == null ? "" : org.result.child1 + " ") + + placementRepatriation.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") + + (org.result.child3 == null ? "" : org.result.child3 + "\n") + + (org.result.child2 == null ? "" : org.result.child2 + "\n") + + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + placementRepatriation.OrganizationOld; + placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + (placementRepatriation.PositionExecutiveOld == null ? "" : placementRepatriation.PositionExecutiveOld + "\n") + placementRepatriation.OrganizationOld; } await _context.PlacementRepatriations.AddAsync(placementRepatriation); await _context.SaveChangesAsync(); diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs index eb8c5315..c1d1e7d4 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementTransferController.cs @@ -541,12 +541,12 @@ namespace BMA.EHR.Placement.Service.Controllers placementTransfer.PositionLevelOld = org.result.posLevelName; placementTransfer.PositionTypeOld = org.result.posTypeName; placementTransfer.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo; - placementTransfer.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + " ") + - (org.result.child3 == null ? "" : org.result.child3 + " ") + - (org.result.child2 == null ? "" : org.result.child2 + " ") + - (org.result.child1 == null ? "" : org.result.child1 + " ") + + placementTransfer.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "\n") + + (org.result.child3 == null ? "" : org.result.child3 + "\n") + + (org.result.child2 == null ? "" : org.result.child2 + "\n") + + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - placementTransfer.OrganizationPositionOld = org.result.position + "\n" + placementTransfer.OrganizationOld; + placementTransfer.OrganizationPositionOld = org.result.position + "\n" + (placementTransfer.PositionExecutiveOld == null ? "" : placementTransfer.PositionExecutiveOld + "\n") + placementTransfer.OrganizationOld; } await _context.PlacementTransfers.AddAsync(placementTransfer); await _context.SaveChangesAsync(); @@ -805,12 +805,7 @@ namespace BMA.EHR.Placement.Service.Controllers { No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", - OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOc = p.OrganizationPositionOld, PositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld, PositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld, PositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs index 61608786..4c4f4d7c 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOtherController.cs @@ -330,7 +330,7 @@ namespace BMA.EHR.Retirement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - retirementOther.OrganizationPositionOld = org.result.position + "\n" + retirementOther.OrganizationOld; + retirementOther.OrganizationPositionOld = org.result.position + "\n" + (retirementOther.PositionExecutiveOld == null ? "" : retirementOther.PositionExecutiveOld + "\n") + retirementOther.OrganizationOld; retirementOther.EducationOld = org.result.education; retirementOther.AmountOld = org.result.salary; } @@ -825,12 +825,7 @@ namespace BMA.EHR.Retirement.Service.Controllers No = r.Sequence.ToString().ToThaiNumber(), FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", Education = p.EducationOld == null ? "-" : p.EducationOld, - OldOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + - (p.child4Old == null ? "" : $"{p.child4Old}\n") + - (p.child3Old == null ? "" : $"{p.child3Old}\n") + - (p.child2Old == null ? "" : $"{p.child2Old}\n") + - (p.child1Old == null ? "" : $"{p.child1Old}\n") + - (p.rootOld == null ? "" : $"{p.rootOld}"), + OldOc = p.OrganizationPositionOld, OldPositionType = p.PositionTypeOld == null ? "-" : p.PositionTypeOld, OldPositionLevel = p.PositionLevelOld == null ? "-" : p.PositionLevelOld, OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), @@ -838,6 +833,7 @@ namespace BMA.EHR.Retirement.Service.Controllers LeaveDate = p.LeaveDate == null ? "-" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(), MilitaryDate = p.MilitaryDate == null ? "-" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(), NewOc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs index 356ee3eb..21c6290f 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementOutController.cs @@ -307,7 +307,7 @@ namespace BMA.EHR.Retirement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - retirementOut.OrganizationPositionOld = org.result.position + "\n" + retirementOut.OrganizationOld; + retirementOut.OrganizationPositionOld = org.result.position + "\n" + (retirementOut.PositionExecutiveOld == null ? "" : retirementOut.PositionExecutiveOld + "\n") + retirementOut.OrganizationOld; retirementOut.AmountOld = org.result.salary; } } @@ -362,7 +362,7 @@ namespace BMA.EHR.Retirement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - retirementOut.OrganizationPositionOld = org.result.position + "\n" + retirementOut.OrganizationOld; + retirementOut.OrganizationPositionOld = org.result.position + "\n" + (retirementOut.PositionExecutiveOld == null ? "" : retirementOut.PositionExecutiveOld + "\n") + retirementOut.OrganizationOld; retirementOut.AmountOld = org.result.salary; } } diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs index eec2d627..28c379a7 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementResignController.cs @@ -948,7 +948,7 @@ namespace BMA.EHR.Retirement.Service.Controllers (org.result.child2 == null ? "" : org.result.child2 + "\n") + (org.result.child1 == null ? "" : org.result.child1 + "\n") + (org.result.root == null ? "" : org.result.root); - retirementResign.OrganizationPositionOld = org.result.position + "\n" + retirementResign.OrganizationOld; + retirementResign.OrganizationPositionOld = org.result.position + "\n" + (retirementResign.PositionExecutiveOld == null ? "" : retirementResign.PositionExecutiveOld + "\n") + retirementResign.OrganizationOld; } await _context.RetirementResigns.AddAsync(retirementResign); await _context.SaveChangesAsync(); @@ -2357,7 +2357,8 @@ namespace BMA.EHR.Retirement.Service.Controllers FullName = $"{r.Prefix}{r.FirstName} {r.LastName}", PositionName = p.PositionOld ?? "-", Organization = p.OrganizationPositionOld ?? "-", - Oc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + + Oc = (p.PositionOld == null ? "" : $"{p.PositionOld}\n") + + (p.PositionExecutiveOld == null ? "" : $"{p.PositionExecutiveOld}\n") + (p.child4Old == null ? "" : $"{p.child4Old}\n") + (p.child3Old == null ? "" : $"{p.child3Old}\n") + (p.child2Old == null ? "" : $"{p.child2Old}\n") + From 44cd46effc2d6cf306cc5a95c681c55088d8f89d Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 26 Mar 2025 18:42:42 +0700 Subject: [PATCH 2/7] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B8=81=E0=B8=A7=E0=B8=B2=E0=B8=94=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=95=E0=B8=AD?= =?UTF-8?q?=E0=B8=99=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B8=AB=E0=B8=99=E0=B8=B1?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=B7=E0=B8=AD=E0=B9=80=E0=B8=A7=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=96=E0=B8=B6=E0=B8=87=E0=B9=81=E0=B8=81?= =?UTF-8?q?=E0=B9=88=E0=B8=81=E0=B8=A3=E0=B8=A3=E0=B8=A1=20(issue=20#1281?= =?UTF-8?q?=20&=20#1287)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RetirementDeceasedController.cs | 81 ++++++++++++++----- .../RetirementDeceasedAddNotiHigherRequest.cs | 22 +++++ 2 files changed, 85 insertions(+), 18 deletions(-) create mode 100644 BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs index 7f170ec0..7d7cc8f2 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs @@ -394,25 +394,70 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementDeceased.Document = _doc; } - retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + //retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + //{ + // CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId, + // Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix, + // FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName, + // LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName, + // IsSendMail = true, + // IsSendInbox = true, + // IsSendNotification = true, + // // OrganizationName = retirementDeceased.OrganizationName, + // PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, + // profileId = req.ProfileId, + // CreatedFullName = FullName ?? "System Administrator", + // CreatedUserId = UserId ?? "", + // CreatedAt = DateTime.Now, + // LastUpdateFullName = FullName ?? "System Administrator", + // LastUpdateUserId = UserId ?? "", + // LastUpdatedAt = DateTime.Now, + //}); + + var pathUrl = $"{_configuration["API"]}/org/command/find-higher"; + using (var client = new HttpClient()) { - CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId, - Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix, - FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName, - LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName, - IsSendMail = true, - IsSendInbox = true, - IsSendNotification = true, - // OrganizationName = retirementDeceased.OrganizationName, - PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, - profileId = req.ProfileId, - CreatedFullName = FullName ?? "System Administrator", - CreatedUserId = UserId ?? "", - CreatedAt = DateTime.Now, - LastUpdateFullName = FullName ?? "System Administrator", - LastUpdateUserId = UserId ?? "", - LastUpdatedAt = DateTime.Now, - }); + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _res = await client.PostAsJsonAsync(pathUrl, new + { + persons = new List + { + new { profileId = req.ProfileId } + } + }); + var _result = await _res.Content.ReadAsStringAsync(); + if (_res.IsSuccessStatusCode) + { + var highers = JsonConvert.DeserializeObject(_result); + if (highers != null && highers.status == 200) + { + foreach (var higher in highers.result) + { + retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + { + profileId = higher.profileId, + CitizenId = higher.citizenId, + Prefix = higher.prefix, + FirstName = higher.firstName, + LastName = higher.lastName, + OrganizationName = higher.organizationName, + PositionName = higher.positionName, + IsSendMail = true, + IsSendInbox = true, + IsSendNotification = true, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + CreatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + }); + } + } + } + } + await _context.SaveChangesAsync(); return Success(); diff --git a/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs new file mode 100644 index 00000000..81562f89 --- /dev/null +++ b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs @@ -0,0 +1,22 @@ +using BMA.EHR.Domain.Models.MetaData; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Retirement.Service.Requests +{ + public class RetirementDeceasedAddNotiHigherRequest + { + public int status { get; set; } + public string message { get; set; } = string.Empty; + public List result { get; set; } = new List(); + } + public class HigherResponse + { + public string citizenId { get; set; } = string.Empty; + public string prefix { get; set; } = string.Empty; + public string firstName { get; set; } = string.Empty; + public string lastName { get; set; } = string.Empty; + public string organizationName { get; set; } = string.Empty; + public string positionName { get; set; } = string.Empty; + public string profileId { get; set; } = string.Empty; + } +} From 3ba0607a80cedbd78b8810e3982426ff22d30bb1 Mon Sep 17 00:00:00 2001 From: moss <> Date: Thu, 27 Mar 2025 04:42:52 +0700 Subject: [PATCH 3/7] report retire sort --- .github/workflows/release_Retirement.yaml | 190 +++++++++--------- .../Reports/RetireReportRepository.cs | 110 ++++++++-- .../Responses/ProfileRetireJsonRequest.cs | 1 + .../Controllers/RetireReportController.cs | 2 +- .../Controllers/RetirementController.cs | 2 +- 5 files changed, 189 insertions(+), 116 deletions(-) diff --git a/.github/workflows/release_Retirement.yaml b/.github/workflows/release_Retirement.yaml index 4d644cb3..4e936de9 100644 --- a/.github/workflows/release_Retirement.yaml +++ b/.github/workflows/release_Retirement.yaml @@ -6,102 +6,102 @@ on: - "retirement-[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: env: - REGISTRY: docker.frappet.com - IMAGE_NAME: ehr/bma-ehr-retirement-service - DEPLOY_HOST: frappet.com - DEPLOY_PORT: 10102 - # COMPOSE_PATH: /home/frappet/docker/bma-ehr - COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement - TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 + REGISTRY: docker.frappet.com + IMAGE_NAME: ehr/bma-ehr-retirement-service + DEPLOY_HOST: frappet.com + DEPLOY_PORT: 10102 + # COMPOSE_PATH: /home/frappet/docker/bma-ehr + COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-retirement + TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 jobs: - # act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 - release-dev: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set output tags - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - name: Gen Version - id: gen_ver - run: | - if [[ $GITHUB_REF == 'refs/tags/'* ]]; then - IMAGE_VER=${{ steps.vars.outputs.tag }} - else - IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} - fi - if [[ $IMAGE_VER == '' ]]; then - IMAGE_VER='test-vBeta' - fi - echo '::set-output name=image_ver::'$IMAGE_VER - - name: Check Version - run: | - echo $GITHUB_REF - echo ${{ steps.gen_ver.outputs.image_ver }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login in to registry - uses: docker/login-action@v2 - with: - registry: ${{env.REGISTRY}} - username: ${{secrets.DOCKER_USER}} - password: ${{secrets.DOCKER_PASS}} - - name: Build and load local docker image - uses: docker/build-push-action@v3 - with: - context: . - platforms: linux/amd64 - file: BMA.EHR.Retirement.Service/Dockerfile - push: true - tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest + # act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 + release-dev: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: Gen Version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + else + IMAGE_VER=${{ github.event.inputs.IMAGE_VER }} + fi + if [[ $IMAGE_VER == '' ]]; then + IMAGE_VER='test-vBeta' + fi + echo '::set-output name=image_ver::'$IMAGE_VER + - name: Check Version + run: | + echo $GITHUB_REF + echo ${{ steps.gen_ver.outputs.image_ver }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{env.REGISTRY}} + username: ${{secrets.DOCKER_USER}} + password: ${{secrets.DOCKER_PASS}} + - name: Build and load local docker image + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + file: BMA.EHR.Retirement.Service/Dockerfile + push: true + tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest - - name: Reload docker compose - uses: appleboy/ssh-action@v0.1.8 - with: - host: ${{env.DEPLOY_HOST}} - username: frappet - password: ${{ secrets.SSH_PASSWORD }} - port: ${{env.DEPLOY_PORT}} - script: | - cd "${{env.COMPOSE_PATH}}" - docker compose pull - docker compose up -d - echo "${{ steps.gen_ver.outputs.image_ver }}"> success - - name: Notify Discord Success - if: success() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "✅ Deployment Success!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", - "color": 3066993, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/success-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + - name: Reload docker compose + uses: appleboy/ssh-action@v0.1.8 + with: + host: ${{env.DEPLOY_HOST}} + username: frappet + password: ${{ secrets.SSH_PASSWORD }} + port: ${{env.DEPLOY_PORT}} + script: | + cd "${{env.COMPOSE_PATH}}" + docker compose pull + docker compose up -d + echo "${{ steps.gen_ver.outputs.image_ver }}"> success + # - name: Notify Discord Success + # if: success() + # run: | + # curl -H "Content-Type: application/json" \ + # -X POST \ + # -d '{ + # "embeds": [{ + # "title": "✅ Deployment Success!", + # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", + # "color": 3066993, + # "footer": { + # "text": "Release Notification", + # "icon_url": "https://example.com/success-icon.png" + # }, + # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + # }] + # }' \ + # ${{ secrets.DISCORD_WEBHOOK }} - - name: Notify Discord Failure - if: failure() - run: | - curl -H "Content-Type: application/json" \ - -X POST \ - -d '{ - "embeds": [{ - "title": "❌ Deployment Failed!", - "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", - "color": 15158332, - "footer": { - "text": "Release Notification", - "icon_url": "https://example.com/failure-icon.png" - }, - "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - }] - }' \ - ${{ secrets.DISCORD_WEBHOOK }} + # - name: Notify Discord Failure + # if: failure() + # run: | + # curl -H "Content-Type: application/json" \ + # -X POST \ + # -d '{ + # "embeds": [{ + # "title": "❌ Deployment Failed!", + # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", + # "color": 15158332, + # "footer": { + # "text": "Release Notification", + # "icon_url": "https://example.com/failure-icon.png" + # }, + # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + # }] + # }' \ + # ${{ secrets.DISCORD_WEBHOOK }} diff --git a/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs index ff5fa3e3..bbe6aea4 100644 --- a/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs @@ -1,4 +1,5 @@ -using System.Reflection.Metadata; +using System.Net.Http.Headers; +using System.Reflection.Metadata; using BMA.EHR.Application.Common.Interfaces; using BMA.EHR.Application.Responses; using BMA.EHR.Domain.Extensions; @@ -9,6 +10,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Newtonsoft.Json; namespace BMA.EHR.Application.Repositories.Reports @@ -21,20 +23,23 @@ namespace BMA.EHR.Application.Repositories.Reports private readonly IWebHostEnvironment _hostingEnvironment; private readonly MinIOService _documentService; private readonly OrganizationCommonRepository _organizationCommonRepository; + private readonly IConfiguration _configuration; #endregion #region " Constructor and Destructor " public RetireReportRepository(IApplicationDBContext dbContext, - MinIOService documentService, - OrganizationCommonRepository organizationCommonRepository, - IWebHostEnvironment hostEnvironment) + MinIOService documentService, + OrganizationCommonRepository organizationCommonRepository, + IWebHostEnvironment hostEnvironment, + IConfiguration configuration) { _dbContext = dbContext; _hostingEnvironment = hostEnvironment; _organizationCommonRepository = organizationCommonRepository; _documentService = documentService; + _configuration = configuration; } #endregion @@ -64,12 +69,33 @@ namespace BMA.EHR.Application.Repositories.Reports //} #region รายงานประกาศเกษียณ - public async Task GetProfileRetirementdAsync(Guid retireId) + public async Task GetProfileRetirementdAsync(Guid retireId, string token) { var retire = await _dbContext.Set() .Include(x => x.RetirementProfiles) .FirstOrDefaultAsync(x => x.Id == retireId); // var retires = new List(); + var apiUrl = $"{_configuration["API"]}/org/root/search/sort"; + dynamic rootOrder = new List(); + dynamic posTypeNameOrder = new List(); + dynamic posLevelNameOrder = new List(); + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); + client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); + var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl); + var _res = await client.SendAsync(_req); + var _result = await _res.Content.ReadAsStringAsync(); + + var org = JsonConvert.DeserializeObject(_result); + + if (org != null && org.result != null) + { + rootOrder = org.result.root; + posTypeNameOrder = org.result.posTypeNameOrder; + posLevelNameOrder = org.result.posLevelNameOrder; + } + } if (retire == null) { var retireHistorys = await _dbContext.Set().AsQueryable() @@ -121,16 +147,39 @@ namespace BMA.EHR.Application.Repositories.Reports profiles = profiles.OrderBy(x => x.order).ToList(); } var mapProfiles = new List(); + string previousRoot = null; + string previousPosTypeName = null; + string previousPosLevelName = null; if (profiles.Count > 0) { - mapProfiles = profiles.Select((profile, index) => new ProfileRetireJsonRequest + mapProfiles = profiles + .OrderBy(x => rootOrder.ToObject>().IndexOf(x.root)) + .ThenBy(x => posTypeNameOrder.ToObject>().IndexOf(x.posTypeName ?? "")) + .ThenBy(x => posLevelNameOrder.ToObject>().IndexOf(x.posLevelName ?? "")) + .Select((profile, index) => { - order = (index + 1).ToString().ToThaiNumber(), - fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", - root = profile.root, - position = profile.position != "" && profile.position != null ? profile.position : "-", - posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-", - reason = profile.reason != "" && profile.reason != null ? profile.reason : "-", + bool isDuplicateRoot = profile.root == previousRoot; + previousRoot = profile.root; + bool isDuplicatePosType = profile.posTypeName == previousPosTypeName; + previousPosTypeName = profile.posTypeName; + bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName; + previousPosLevelName = profile.posLevelName; + return new ProfileRetireJsonRequest + { + order = (index + 1).ToString().ToThaiNumber(), + fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", + root = (isDuplicateRoot ? "" : profile.root + "\n") + + (isDuplicatePosType ? "" : profile.posTypeName + "\n") + + (isDuplicatePosLevel ? "" : profile.posLevelName), + child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") + + (profile.child4 == null ? "" : profile.child4 + "\n") + + (profile.child3 == null ? "" : profile.child3 + "\n") + + (profile.child2 == null ? "" : profile.child2 + "\n") + + (profile.child1 == null ? "" : profile.child1), + position = profile.position != "" && profile.position != null ? profile.position : "-", + posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-", + reason = profile.reason != "" && profile.reason != null ? profile.reason : "-", + }; }).ToList(); } string SignDate = retireHistorys.SignDate != null ? DateTime.Parse(retireHistorys.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-"; @@ -208,16 +257,39 @@ namespace BMA.EHR.Application.Repositories.Reports // retires.Add(data); // } var mapProfiles = new List(); + string previousRoot = null; + string previousPosTypeName = null; + string previousPosLevelName = null; if (profile_retire.Count > 0) { - mapProfiles = profile_retire.Select((profile, index) => new ProfileRetireJsonRequest + mapProfiles = profile_retire + .OrderBy(x => rootOrder.ToObject>().IndexOf(x.root)) + .ThenBy(x => posTypeNameOrder.ToObject>().IndexOf(x.posTypeName ?? "")) + .ThenBy(x => posLevelNameOrder.ToObject>().IndexOf(x.posLevelName ?? "")) + .Select((profile, index) => { - order = (index + 1).ToString().ToThaiNumber(), - fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", - root = profile.root, - position = profile.position != "" && profile.position != null ? profile.position : "-", - posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-", - reason = profile.reason != "" && profile.reason != null ? profile.reason : "-", + bool isDuplicateRoot = profile.root == previousRoot; + previousRoot = profile.root; + bool isDuplicatePosType = profile.posTypeName == previousPosTypeName; + previousPosTypeName = profile.posTypeName; + bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName; + previousPosLevelName = profile.posLevelName; + return new ProfileRetireJsonRequest + { + order = (index + 1).ToString().ToThaiNumber(), + fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", + root = (isDuplicateRoot ? "" : profile.root + "\n") + + (isDuplicatePosType ? "" : profile.posTypeName + "\n") + + (isDuplicatePosLevel ? "" : profile.posLevelName), + child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") + + (profile.child4 == null ? "" : profile.child4 + "\n") + + (profile.child3 == null ? "" : profile.child3 + "\n") + + (profile.child2 == null ? "" : profile.child2 + "\n") + + (profile.child1 == null ? "" : profile.child1), + position = profile.position != "" && profile.position != null ? profile.position : "-", + posNo = profile.posNo != "" && profile.posNo != null ? profile.posNo?.ToThaiNumber() : "-", + reason = profile.reason != "" && profile.reason != null ? profile.reason : "-", + }; }).ToList(); } string SignDate = retire.SignDate != null ? DateTime.Parse(retire.SignDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber() : "-"; diff --git a/BMA.EHR.Application/Responses/ProfileRetireJsonRequest.cs b/BMA.EHR.Application/Responses/ProfileRetireJsonRequest.cs index bcdf04ec..f690d2c3 100644 --- a/BMA.EHR.Application/Responses/ProfileRetireJsonRequest.cs +++ b/BMA.EHR.Application/Responses/ProfileRetireJsonRequest.cs @@ -8,6 +8,7 @@ public string? posNo { get; set; } public string? root { get; set; } public string? reason { get; set; } + public string? child { get; set; } } } diff --git a/BMA.EHR.Report.Service/Controllers/RetireReportController.cs b/BMA.EHR.Report.Service/Controllers/RetireReportController.cs index dd329dde..c5c2fa1a 100644 --- a/BMA.EHR.Report.Service/Controllers/RetireReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/RetireReportController.cs @@ -44,7 +44,7 @@ namespace BMA.EHR.Report.Service.Controllers [HttpGet("{exportType}/{Id}")] public async Task> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf") { - var retire = await _service.GetProfileRetirementdAsync(Id); + var retire = await _service.GetProfileRetirementdAsync(Id,token); if (retire != null) { var reportfile = string.Empty; diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index aa9f1c0a..4fecb0ba 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -2127,7 +2127,7 @@ namespace BMA.EHR.Retirement.Service.Controllers [HttpGet("31/{exportType}/{Id}")] public async Task> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf") { - var retire = await _service.GetProfileRetirementdAsync(Id); + var retire = await _service.GetProfileRetirementdAsync(Id,token); if (retire != null) { var reportfile = string.Empty; From 9be78c8bdc1c9c63da9b0d86fb87ed8989a97dd8 Mon Sep 17 00:00:00 2001 From: moss <> Date: Thu, 27 Mar 2025 10:33:56 +0700 Subject: [PATCH 4/7] on noti --- .github/workflows/release_Retirement.yaml | 72 +++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release_Retirement.yaml b/.github/workflows/release_Retirement.yaml index 4e936de9..6cdceae0 100644 --- a/.github/workflows/release_Retirement.yaml +++ b/.github/workflows/release_Retirement.yaml @@ -68,40 +68,40 @@ jobs: docker compose pull docker compose up -d echo "${{ steps.gen_ver.outputs.image_ver }}"> success - # - name: Notify Discord Success - # if: success() - # run: | - # curl -H "Content-Type: application/json" \ - # -X POST \ - # -d '{ - # "embeds": [{ - # "title": "✅ Deployment Success!", - # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", - # "color": 3066993, - # "footer": { - # "text": "Release Notification", - # "icon_url": "https://example.com/success-icon.png" - # }, - # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - # }] - # }' \ - # ${{ secrets.DISCORD_WEBHOOK }} + - name: Notify Discord Success + if: success() + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "embeds": [{ + "title": "✅ Deployment Success!", + "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", + "color": 3066993, + "footer": { + "text": "Release Notification", + "icon_url": "https://example.com/success-icon.png" + }, + "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK }} - # - name: Notify Discord Failure - # if: failure() - # run: | - # curl -H "Content-Type: application/json" \ - # -X POST \ - # -d '{ - # "embeds": [{ - # "title": "❌ Deployment Failed!", - # "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", - # "color": 15158332, - # "footer": { - # "text": "Release Notification", - # "icon_url": "https://example.com/failure-icon.png" - # }, - # "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" - # }] - # }' \ - # ${{ secrets.DISCORD_WEBHOOK }} + - name: Notify Discord Failure + if: failure() + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d '{ + "embeds": [{ + "title": "❌ Deployment Failed!", + "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", + "color": 15158332, + "footer": { + "text": "Release Notification", + "icon_url": "https://example.com/failure-icon.png" + }, + "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK }} From dd8e87b994035bccdada92b8a5177b895dd0f6bd Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 27 Mar 2025 11:02:58 +0700 Subject: [PATCH 5/7] =?UTF-8?q?=E0=B8=96=E0=B8=B6=E0=B8=87=E0=B9=81?= =?UTF-8?q?=E0=B8=81=E0=B9=89=E0=B8=81=E0=B8=A3=E0=B8=A3=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BMA.EHR.Discipline.Service/Program.cs | 2 +- .../RetirementDeceasedController.cs | 105 +++++++++++------- BMA.EHR.Retirement.Service/Program.cs | 2 +- .../RetirementDeceasedAddNotiHigherRequest.cs | 2 - 4 files changed, 66 insertions(+), 45 deletions(-) diff --git a/BMA.EHR.Discipline.Service/Program.cs b/BMA.EHR.Discipline.Service/Program.cs index 4ead4ce6..8bd351b4 100644 --- a/BMA.EHR.Discipline.Service/Program.cs +++ b/BMA.EHR.Discipline.Service/Program.cs @@ -154,7 +154,7 @@ var app = builder.Build(); app.UseStaticFiles(); app.MapControllers(); app.UseMiddleware(); - app.UseMiddleware(); + //app.UseMiddleware(); app.UseHangfireDashboard("/hangfire", new DashboardOptions() { diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs index 7d7cc8f2..3e2eee08 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs @@ -394,25 +394,25 @@ namespace BMA.EHR.Retirement.Service.Controllers retirementDeceased.Document = _doc; } - //retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti - //{ - // CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId, - // Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix, - // FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName, - // LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName, - // IsSendMail = true, - // IsSendInbox = true, - // IsSendNotification = true, - // // OrganizationName = retirementDeceased.OrganizationName, - // PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, - // profileId = req.ProfileId, - // CreatedFullName = FullName ?? "System Administrator", - // CreatedUserId = UserId ?? "", - // CreatedAt = DateTime.Now, - // LastUpdateFullName = FullName ?? "System Administrator", - // LastUpdateUserId = UserId ?? "", - // LastUpdatedAt = DateTime.Now, - //}); + retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + { + CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId, + Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix, + FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName, + LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName, + IsSendMail = true, + IsSendInbox = true, + IsSendNotification = true, + OrganizationName = retirementDeceased.OrganizationName, + PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, + profileId = req.ProfileId, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + CreatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + }); var pathUrl = $"{_configuration["API"]}/org/command/find-higher"; using (var client = new HttpClient()) @@ -427,35 +427,58 @@ namespace BMA.EHR.Retirement.Service.Controllers } }); var _result = await _res.Content.ReadAsStringAsync(); - if (_res.IsSuccessStatusCode) + var highers = JsonConvert.DeserializeObject(_result); + if (highers != null && highers.result != null) { - var highers = JsonConvert.DeserializeObject(_result); - if (highers != null && highers.status == 200) + foreach (var higher in highers.result) { - foreach (var higher in highers.result) + if (higher.profileId != null) { - retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + var payload_attach = new List(); + payload_attach.Add(new PayloadAttachment { - profileId = higher.profileId, - CitizenId = higher.citizenId, - Prefix = higher.prefix, - FirstName = higher.firstName, - LastName = higher.lastName, - OrganizationName = higher.organizationName, - PositionName = higher.positionName, - IsSendMail = true, - IsSendInbox = true, - IsSendNotification = true, - CreatedFullName = FullName ?? "System Administrator", - CreatedUserId = UserId ?? "", - CreatedAt = DateTime.Now, - LastUpdateFullName = FullName ?? "System Administrator", - LastUpdateUserId = UserId ?? "", - LastUpdatedAt = DateTime.Now, + name = "หนังสือเวียนถึงแก่กรรม", + url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}" }); + + var payload = new CommandPayload() + { + attachments = payload_attach + }; + + var payload_str = JsonConvert.SerializeObject(payload); + await _repositoryNoti.PushNotificationAsync( + Guid.Parse(higher.profileId), + $"หนังสือเวียนถึงแก่กรรมของ {higher.prefix}{higher.firstName} {higher.lastName}", + $"แจ้งข่าวการถึงแก่กรรมของ {retirementDeceased.prefix}{retirementDeceased.firstName} {retirementDeceased.lastName}", + //payload_str, + "", + "", + true, + true + ); } + retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti + { + profileId = higher.profileId, + CitizenId = higher.citizenId, + Prefix = higher.prefix, + FirstName = higher.firstName, + LastName = higher.lastName, + OrganizationName = higher.organizationName, + PositionName = higher.positionName, + IsSendMail = true, + IsSendInbox = true, + IsSendNotification = true, + CreatedFullName = FullName ?? "System Administrator", + CreatedUserId = UserId ?? "", + CreatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + LastUpdatedAt = DateTime.Now, + }); } - } + } } await _context.SaveChangesAsync(); diff --git a/BMA.EHR.Retirement.Service/Program.cs b/BMA.EHR.Retirement.Service/Program.cs index f8cf5bf8..138f1553 100644 --- a/BMA.EHR.Retirement.Service/Program.cs +++ b/BMA.EHR.Retirement.Service/Program.cs @@ -161,7 +161,7 @@ var app = builder.Build(); app.UseStaticFiles(); app.MapControllers(); app.UseMiddleware(); - app.UseMiddleware(); + //app.UseMiddleware(); app.UseHangfireDashboard("/hangfire", new DashboardOptions() { diff --git a/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs index 81562f89..88e167db 100644 --- a/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs +++ b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiHigherRequest.cs @@ -5,8 +5,6 @@ namespace BMA.EHR.Retirement.Service.Requests { public class RetirementDeceasedAddNotiHigherRequest { - public int status { get; set; } - public string message { get; set; } = string.Empty; public List result { get; set; } = new List(); } public class HigherResponse From 1424b03aacbe765d78c2b02a2faf4bd7d80dd870 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 27 Mar 2025 11:37:41 +0700 Subject: [PATCH 6/7] =?UTF-8?q?=E0=B8=96=E0=B8=B6=E0=B8=87=E0=B9=81?= =?UTF-8?q?=E0=B8=81=E0=B9=88=E0=B8=81=E0=B8=A3=E0=B8=A3=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RetirementDeceasedController.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs index 3e2eee08..3772e711 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs @@ -403,7 +403,7 @@ namespace BMA.EHR.Retirement.Service.Controllers IsSendMail = true, IsSendInbox = true, IsSendNotification = true, - OrganizationName = retirementDeceased.OrganizationName, + OrganizationName = retirementDeceased.root == null ? "" : retirementDeceased.root, PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position, profileId = req.ProfileId, CreatedFullName = FullName ?? "System Administrator", @@ -434,19 +434,19 @@ namespace BMA.EHR.Retirement.Service.Controllers { if (higher.profileId != null) { - var payload_attach = new List(); - payload_attach.Add(new PayloadAttachment - { - name = "หนังสือเวียนถึงแก่กรรม", - url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}" - }); + //var payload_attach = new List(); + //payload_attach.Add(new PayloadAttachment + //{ + // name = "หนังสือเวียนถึงแก่กรรม", + // url = $"{_configuration["APIV2"]}/report/deceased/copy/36/{retirementDeceased.Id}" + //}); - var payload = new CommandPayload() - { - attachments = payload_attach - }; + //var payload = new CommandPayload() + //{ + // attachments = payload_attach + //}; - var payload_str = JsonConvert.SerializeObject(payload); + //var payload_str = JsonConvert.SerializeObject(payload); await _repositoryNoti.PushNotificationAsync( Guid.Parse(higher.profileId), $"หนังสือเวียนถึงแก่กรรมของ {higher.prefix}{higher.firstName} {higher.lastName}", From 8460a96db0fecb4d3e9290ebe7833c5d394de8eb Mon Sep 17 00:00:00 2001 From: moss <> Date: Thu, 27 Mar 2025 12:00:32 +0700 Subject: [PATCH 7/7] change APPOINTED to APPOINT --- .../Commands/CommandRepository.cs | 4 +-- .../PlacementAppointmentController.cs | 6 ++-- .../Controllers/PlacementController.cs | 28 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index 45f375eb..52e1a517 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -248,7 +248,7 @@ namespace BMA.EHR.Application.Repositories.Commands .Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN") .Where(x => x.Draft! == true) .Where(x => x.Placement!.PlacementType!.Name == "สอบแข่งขัน") - .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .OrderBy(x => x.ExamNumber) .ToListAsync(); @@ -307,7 +307,7 @@ namespace BMA.EHR.Application.Repositories.Commands .Where(x => x.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN") .Where(x => x.Draft! == true) .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน") - .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .OrderBy(x => x.ExamNumber) .ToListAsync(); diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index 1c21490a..f2537334 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -758,7 +758,7 @@ namespace BMA.EHR.Placement.Service.Controllers placementProfiles.ForEach(profile => { profile.Status = "REPORT"; - profile.typeCommand = "APPOINTED"; + profile.typeCommand = "APPOINT"; }); await _context.SaveChangesAsync(); return Success(); @@ -1029,7 +1029,7 @@ namespace BMA.EHR.Placement.Service.Controllers OldPositionNumber = p.PositionNumberOld == null ? "-" : p.PositionNumberOld.ToThaiNumber(), OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), LeaveDate = "-", - NewOc =(p.position == null ? "" : $"{p.position}\n") + + NewOc = (p.position == null ? "" : $"{p.position}\n") + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + @@ -1657,7 +1657,7 @@ namespace BMA.EHR.Placement.Service.Controllers p.rootOld != null ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "-", OldSalary = p.AmountOld == null ? "-" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(), PositionDate = p.PositionDate == null ? "-" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(), - NewOc = (p.position == null ? "" : $"{p.position}\n") + + NewOc = (p.position == null ? "" : $"{p.position}\n") + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs index 183a9fb3..39a72123 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementController.cs @@ -1560,12 +1560,12 @@ namespace BMA.EHR.Placement.Service.Controllers // .ThenInclude(x => x.PlacementType) .Where(x => req.refIds.Contains(x.Id.ToString())) // .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน") - // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .ToListAsync(); placementProfiles.ForEach(profile => { profile.PlacementStatus = "REPORT"; - profile.typeCommand = "APPOINTED"; + profile.typeCommand = "APPOINT"; }); await _context.SaveChangesAsync(); return Success(); @@ -1615,7 +1615,7 @@ namespace BMA.EHR.Placement.Service.Controllers // .ThenInclude(x => x.PlacementType) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) // .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน") - // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .ToList() join r in req.refIds on p.Id.ToString() equals r.refId @@ -1629,7 +1629,7 @@ namespace BMA.EHR.Placement.Service.Controllers PositionName = p.positionName == null ? "-" : p.positionName, ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(), PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()} {p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}", - Oc = (p.positionName == null ? "" : $"{p.positionName}\n") + + Oc = (p.positionName == null ? "" : $"{p.positionName}\n") + (p.PositionExecutive == null ? "" : $"{p.PositionExecutive}\n") + (p.child4 == null ? "" : $"{p.child4}\n") + (p.child3 == null ? "" : $"{p.child3}\n") + @@ -1891,12 +1891,12 @@ namespace BMA.EHR.Placement.Service.Controllers // .ThenInclude(x => x.PlacementType) .Where(x => req.refIds.Contains(x.Id.ToString())) // .Where(x => x.Placement!.PlacementType!.Name != "สอบคัดเลือก") - // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .ToListAsync(); placementProfiles.ForEach(profile => { profile.PlacementStatus = "REPORT"; - profile.typeCommand = "APPOINTED"; + profile.typeCommand = "APPOINT"; }); await _context.SaveChangesAsync(); return Success(); @@ -1946,7 +1946,7 @@ namespace BMA.EHR.Placement.Service.Controllers // .ThenInclude(x => x.PlacementType) .Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString())) // .Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน") - // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED") + // .Where(x => x.typeCommand.Trim().ToUpper() == "APPOINT") .ToList() join r in req.refIds on p.Id.ToString() equals r.refId @@ -3015,11 +3015,11 @@ namespace BMA.EHR.Placement.Service.Controllers x.Status.Trim().ToUpper() == "DONE") .Count(); - var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; - var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; + var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; + var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; - var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; @@ -3142,11 +3142,11 @@ namespace BMA.EHR.Placement.Service.Controllers x.Status.Trim().ToUpper() == "DONE") .Count(); - var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOIN")?.Count ?? 0; var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; - var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; @@ -3295,7 +3295,7 @@ namespace BMA.EHR.Placement.Service.Controllers (node == 4 ? x.child4DnaId.Contains(item.child4DnaId) : true)) .Count(); - //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; var pa_appoint = pae_count; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0; @@ -3344,7 +3344,7 @@ namespace BMA.EHR.Placement.Service.Controllers (node == 4 ? x.child4DnaId.Contains(item.child4DnaId) : true)) .Count(); - //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINTED")?.Count ?? 0; + //var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0; var pa_appoint = pae_count; var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0; var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;