From fd25873348e818cf9bd527c73e59b72de89d78f7 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Wed, 28 May 2025 11:28:14 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97?= =?UTF-8?q?=E0=B8=B6=E0=B8=81=E0=B9=84=E0=B8=9B=E0=B8=97=E0=B8=B0=E0=B9=80?= =?UTF-8?q?=E0=B8=9A=E0=B8=B5=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4=20=E0=B8=95=E0=B8=B2?= =?UTF-8?q?=E0=B8=A1=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A0=E0=B8=97?= =?UTF-8?q?=20officer=20=E0=B8=AB=E0=B8=A3=E0=B8=B7=E0=B8=AD=20employee=20?= =?UTF-8?q?=E0=B9=82=E0=B8=94=E0=B8=A2=E0=B9=84=E0=B8=9B=E0=B9=80=E0=B8=A3?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=81=20api=20=E0=B8=82=E0=B8=AD=E0=B8=87?= =?UTF-8?q?=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A=E0=B9=82=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InsigniaRequestController.cs | 81 +++++++++++++++---- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs index 98c0f652..beea1128 100644 --- a/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs +++ b/BMA.EHR.Insignia/Controllers/InsigniaRequestController.cs @@ -2293,24 +2293,71 @@ namespace BMA.EHR.Insignia.Service.Controllers if (profile.Status != "DONE") { profile.Status = "DONE"; - var profileInsignia = new PostProfileInsigniaDto + + // check profile.ProfileType ก่อนส่งไประบบทะเบียนประวัติ + if (profile.ProfileType == "OFFICER") { - profileId = profile.ProfileId.Value, - year = insigniaNote.Year, - no = profile.No, - volumeNo = profile.VolumeNo, - section = profile.Section, - page = profile.Page, - receiveDate = profile.DateReceive.Value, - dateAnnounce = profile.Date.Value, - insigniaId = profile.RequestInsignia.Id, - issue = "", - note = "", - refCommandDate = null, - refCommandNo = "", - volume = "", - }; - await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken); + var profileInsigniaBody = new PostProfileInsigniaDto + { + profileId = profile!.ProfileId!.Value, + year = insigniaNote.Year, + no = profile!.No ?? "", + volumeNo = profile!.VolumeNo ?? "", + section = profile!.Section ?? "", + page = profile!.Page ?? "", + receiveDate = profile.DateReceive!.Value, + dateAnnounce = profile.Date!.Value, + insigniaId = profile.RequestInsignia!.Id, + issue = "", + note = "", + refCommandDate = null, + refCommandNo = "", + volume = "", + + }; + await _userProfileRepository.PostProfileInsigniaAsync(profileInsigniaBody, AccessToken); + } + else + { + var profileInsigniaBody = new PostProfileEmpInsigniaDto + { + profileEmployeeId = profile!.ProfileId!.Value, + year = insigniaNote.Year, + no = profile!.No ?? "", + volumeNo = profile!.VolumeNo ?? "", + section = profile!.Section ?? "", + page = profile!.Page ?? "", + receiveDate = profile.DateReceive!.Value, + dateAnnounce = profile.Date!.Value, + insigniaId = profile.RequestInsignia!.Id, + issue = "", + note = "", + refCommandDate = null, + refCommandNo = "", + volume = "", + + }; + await _userProfileRepository.PostProfileEmpInsigniaAsync(profileInsigniaBody, AccessToken); + } + + //var profileInsignia = new PostProfileInsigniaDto + //{ + // profileId = profile.ProfileId.Value, + // year = insigniaNote.Year, + // no = profile.No, + // volumeNo = profile.VolumeNo, + // section = profile.Section, + // page = profile.Page, + // receiveDate = profile.DateReceive.Value, + // dateAnnounce = profile.Date.Value, + // insigniaId = profile.RequestInsignia.Id, + // issue = "", + // note = "", + // refCommandDate = null, + // refCommandNo = "", + // volume = "", + //}; + //await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken); } } await _context.SaveChangesAsync();