From f953e245158090c257b9b34a2aa4091d62abb77f Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Thu, 13 Feb 2025 11:43:26 +0700 Subject: [PATCH] fix add person witth issue #1067 --- .../Controllers/InsigniaRequestController.cs | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 97a891ed..18e9641b 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -6,6 +6,7 @@ using BMA.EHR.Application.Responses.Insignias; using BMA.EHR.Application.Responses.Organizations; using BMA.EHR.Domain.Common; using BMA.EHR.Domain.Extensions; +using BMA.EHR.Domain.Models.HR; using BMA.EHR.Domain.Models.Insignias; using BMA.EHR.Domain.Shared; using BMA.EHR.Infrastructure.Persistence; @@ -1658,9 +1659,9 @@ namespace BMA.EHR.Insignia.Service.Controllers if (profileInsignia == null) { - /* var insigniaNoteProfile = new InsigniaNoteProfile + var insigniaNoteProfile = new InsigniaNoteProfile { - Salary = profile.ProfileSalary == null || profile.ProfileSalary.Count() == 0 ? null : profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount, + Salary = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount, IsApprove = true, Status = "PENDING", ProfileId = profile.Id, @@ -1677,7 +1678,7 @@ namespace BMA.EHR.Insignia.Service.Controllers Address = req.Address, RequestInsignia = insignia, OrganizationOrganizationReceive = req.OrganizationOrganizationReceive, - req.OrganizationOrganizationSend, + OrganizationOrganizationSend = req.OrganizationOrganizationSend, InsigniaNote = insigniaNote, CreatedFullName = FullName ?? "System Administrator", CreatedUserId = UserId ?? "", @@ -1685,10 +1686,49 @@ namespace BMA.EHR.Insignia.Service.Controllers LastUpdateFullName = FullName ?? "System Administrator", LastUpdateUserId = UserId ?? "", LastUpdatedAt = DateTime.Now, - };*/ + + + Amount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount, + CitizenId = profile.CitizenId, + DateAppoint = profile.DateAppoint, + Prefix = profile.Prefix, + FirstName = profile.FirstName, + LastName = profile.LastName, + Gender = profile.Gender, + PosLevelName = profile.PosLevel, + PosNo = profile.PosNo, + PosTypeName = profile.PosType, + Position = profile.Position, + ProfileType = profile.ProfileType, + PositionSalaryAmount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.PositionSalaryAmount, + + + Root = profile.Root, + RootId = profile.RootId, + RootDnaId = profile.RootDnaId, + Child1 = profile.Child1, + Child1Id = profile.Child1Id, + Child1DnaId = profile.Child1DnaId, + Child2 = profile.Child2, + Child2Id = profile.Child2Id, + Child2DnaId = profile.Child2DnaId, + Child3 = profile.Child3, + Child3Id = profile.Child3Id, + Child3DnaId = profile.Child3DnaId, + Child4 = profile.Child4, + Child4Id = profile.Child4Id, + Child4DnaId = profile.Child4DnaId, + + + }; + + + insigniaNote.InsigniaNoteProfiles.Add(insigniaNoteProfile); + if (req.DateReceive != null && req.Date != null && profile.Id != null) { - /*insigniaNoteProfile.Status = "DONE";*/ + insigniaNoteProfile.Status = "DONE"; + var profileInsigniaBody = new PostProfileInsigniaDto { profileId = profile.Id,