From 4cda0b52c8448bb518e552657b0b0c26f74e03a5 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Fri, 28 Mar 2025 11:13:23 +0700 Subject: [PATCH 1/5] =?UTF-8?q?=E0=B8=AA=E0=B8=A5=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87?= =?UTF-8?q?=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=A7=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BMA.EHR.Leave/Controllers/LeaveRequestController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index df15b58e..f461a996 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -1855,7 +1855,7 @@ namespace BMA.EHR.Leave.Service.Controllers // fix issue : ระบบการลา>>สังกัด ฝ่าย (เอา / ออก เปลี่ยนเป็นว่าง) #1131 - var orgName = rawData.Root ?? ""; + var orgName = ""; if (rawData.Child1 != null && rawData.Child1 != "") orgName += $" {rawData.Child1}"; if (rawData.Child2 != null && rawData.Child2 != "") @@ -1864,6 +1864,8 @@ namespace BMA.EHR.Leave.Service.Controllers orgName += $" {rawData.Child3}"; if (rawData.Child4 != null && rawData.Child4 != "") orgName += $" {rawData.Child4}"; + if (rawData.Root != null && rawData.Root != "") + orgName += $" {rawData.Root}"; var result = new GetLeaveRequestForAdminByIdDto { From 82a2dc42e6444f9351af67c0979812696dd6129e Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Mon, 31 Mar 2025 10:59:06 +0700 Subject: [PATCH 2/5] fix #1310 --- .../Profiles/GetProfileByKeycloakIdDto.cs | 12 ++++++++++ .../Controllers/LeaveRequestController.cs | 24 +++++++++++++++++-- .../GetUserLeaveProfileResultDto.cs | 12 ++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs index 669d75ef..72213b96 100644 --- a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs +++ b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs @@ -67,6 +67,18 @@ namespace BMA.EHR.Application.Responses.Profiles public Guid? CommanderKeycloak { get; set; } + public string? TelephoneNumber { get; set; } + + public string? CurrentAddress { get; set; } + + public string? CurrentSubDistrict { get; set; } + + public string? CurrentDistrict { get; set; } + + public string? CurrentProvince { get; set; } + + public string? CurrentZipCode { get; set; } + } public class PosLevel diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index f461a996..72952db8 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Org.BouncyCastle.Asn1.Pkcs; using Swashbuckle.AspNetCore.Annotations; using System.Net.Http.Headers; using System.Security.Claims; @@ -716,6 +717,18 @@ namespace BMA.EHR.Leave.Service.Controllers var remainPrev = 0.0; + var orgName = ""; + if (profile.Child1 != null && profile.Child1 != "") + orgName += $" {profile.Child1}"; + if (profile.Child2 != null && profile.Child2 != "") + orgName += $" {profile.Child2}"; + if (profile.Child3 != null && profile.Child3 != "") + orgName += $" {profile.Child3}"; + if (profile.Child4 != null && profile.Child4 != "") + orgName += $" {profile.Child4}"; + if (profile.Root != null && profile.Root != "") + orgName += $" {profile.Root}"; + @@ -779,7 +792,7 @@ namespace BMA.EHR.Leave.Service.Controllers Dear = profile.Commander ?? "", PositionName = profile.Position == null ? "" : profile.Position, PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel, - OrganizationName = profile.Root ?? "", //profile.Oc ?? "", + OrganizationName = orgName, //profile.Oc ?? "", LeaveLimit = leaveLimit, LeaveTotal = sumLeave, @@ -789,7 +802,14 @@ namespace BMA.EHR.Leave.Service.Controllers DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date, Salary = lastSalary == null ? 0 : lastSalary.Amount == null ? 0 : (int)lastSalary.Amount.Value, SalaryText = lastSalary == null ? "" : lastSalary.Amount == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false), - LeaveLast = leaveLast == null ? null : leaveLast + LeaveLast = leaveLast == null ? null : leaveLast, + + TelephoneNumber = profile.TelephoneNumber ?? "-", + CurrentAddress = profile.CurrentAddress ?? "-", + CurrentSubDistrict = profile.CurrentSubDistrict ?? "-", + CurrentDistrict = profile.CurrentDistrict ?? "-", + CurrentProvince = profile.CurrentProvince ?? "-", + CurrentZipCode = profile.CurrentZipCode ?? "-", }; return Success(result); diff --git a/BMA.EHR.Leave/DTOs/LeaveRequest/GetUserLeaveProfileResultDto.cs b/BMA.EHR.Leave/DTOs/LeaveRequest/GetUserLeaveProfileResultDto.cs index 1aa32a02..ea512127 100644 --- a/BMA.EHR.Leave/DTOs/LeaveRequest/GetUserLeaveProfileResultDto.cs +++ b/BMA.EHR.Leave/DTOs/LeaveRequest/GetUserLeaveProfileResultDto.cs @@ -33,5 +33,17 @@ public string SalaryText { get; set; } public DateTime? LeaveLast { get; set; } + + public string? TelephoneNumber { get; set; } + + public string? CurrentAddress { get; set; } + + public string? CurrentSubDistrict { get; set; } + + public string? CurrentDistrict { get; set; } + + public string? CurrentProvince { get; set; } + + public string? CurrentZipCode { get; set; } } } From 734b29c77cac130df867fef3861a48f3cabcce63 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Mon, 31 Mar 2025 11:18:03 +0700 Subject: [PATCH 3/5] fix #1327 --- .../Controllers/LeaveRequestController.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs index 72952db8..e73e5f45 100644 --- a/BMA.EHR.Leave/Controllers/LeaveRequestController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveRequestController.cs @@ -624,17 +624,17 @@ namespace BMA.EHR.Leave.Service.Controllers } // add dear and oc_data - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} oldData.LeaveTypeCode = leaveType.Code; - oldData.Dear = approver; + oldData.Dear = profile.Commander ?? ""; oldData.PositionName = profile.Position == null ? "" : profile.Position; oldData.PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel; oldData.OrganizationName = profile.Oc ?? ""; From 9e9b3316e98496222f050b45aac38db6787305ad Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Mon, 31 Mar 2025 11:58:47 +0700 Subject: [PATCH 4/5] report --- .../Controllers/LeaveReportController.cs | 64 +++++++++++++------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveReportController.cs b/BMA.EHR.Leave/Controllers/LeaveReportController.cs index f67ece92..0995f218 100644 --- a/BMA.EHR.Leave/Controllers/LeaveReportController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveReportController.cs @@ -137,14 +137,26 @@ namespace BMA.EHR.Leave.Service.Controllers await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(data.KeycloakUserId, data.Type.Id); - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} + + var orgName = ""; + if (profile.Child1 != null && profile.Child1 != "") + orgName += $" {profile.Child1}"; + if (profile.Child2 != null && profile.Child2 != "") + orgName += $" {profile.Child2}"; + if (profile.Child3 != null && profile.Child3 != "") + orgName += $" {profile.Child3}"; + if (profile.Child4 != null && profile.Child4 != "") + orgName += $" {profile.Child4}"; + if (profile.Root != null && profile.Root != "") + orgName += $" {profile.Root}"; var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year); @@ -157,11 +169,11 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, - organizationName = profile!.Oc ?? "", + positionLeaveName = profile!.PosLevel == null ? "-" : profile!.PosLevel, + organizationName = orgName, leaveDetail = data.LeaveDetail, leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(), leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(), @@ -188,14 +200,26 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} + + var orgName = ""; + if (profile.Child1 != null && profile.Child1 != "") + orgName += $" {profile.Child1}"; + if (profile.Child2 != null && profile.Child2 != "") + orgName += $" {profile.Child2}"; + if (profile.Child3 != null && profile.Child3 != "") + orgName += $" {profile.Child3}"; + if (profile.Child4 != null && profile.Child4 != "") + orgName += $" {profile.Child4}"; + if (profile.Root != null && profile.Root != "") + orgName += $" {profile.Root}"; return new { @@ -206,7 +230,7 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, positionLeaveName = profile!.Position == null ? "-" : profile!.Position, From 9136cb8d8a6e77c5f58a51d9946e1f88bc14fca6 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Mon, 31 Mar 2025 12:17:10 +0700 Subject: [PATCH 5/5] =?UTF-8?q?add=20PositionLeaveName=20=E0=B9=83?= =?UTF-8?q?=E0=B8=99=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Profiles/GetProfileByKeycloakIdDto.cs | 2 + .../Controllers/LeaveReportController.cs | 194 ++++++++---------- 2 files changed, 88 insertions(+), 108 deletions(-) diff --git a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs index 72213b96..b9ac4725 100644 --- a/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs +++ b/BMA.EHR.Application/Responses/Profiles/GetProfileByKeycloakIdDto.cs @@ -79,6 +79,8 @@ namespace BMA.EHR.Application.Responses.Profiles public string? CurrentZipCode { get; set; } + public string? PositionLeaveName { get; set; } + } public class PosLevel diff --git a/BMA.EHR.Leave/Controllers/LeaveReportController.cs b/BMA.EHR.Leave/Controllers/LeaveReportController.cs index 0995f218..cf530522 100644 --- a/BMA.EHR.Leave/Controllers/LeaveReportController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveReportController.cs @@ -146,18 +146,6 @@ namespace BMA.EHR.Leave.Service.Controllers // approver = list.First().Name; //} - var orgName = ""; - if (profile.Child1 != null && profile.Child1 != "") - orgName += $" {profile.Child1}"; - if (profile.Child2 != null && profile.Child2 != "") - orgName += $" {profile.Child2}"; - if (profile.Child3 != null && profile.Child3 != "") - orgName += $" {profile.Child3}"; - if (profile.Child4 != null && profile.Child4 != "") - orgName += $" {profile.Child4}"; - if (profile.Root != null && profile.Root != "") - orgName += $" {profile.Root}"; - var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year); return new @@ -172,8 +160,8 @@ namespace BMA.EHR.Leave.Service.Controllers dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.PosLevel == null ? "-" : profile!.PosLevel, - organizationName = orgName, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, + organizationName = profile.Oc, leaveDetail = data.LeaveDetail, leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(), leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(), @@ -209,17 +197,7 @@ namespace BMA.EHR.Leave.Service.Controllers // approver = list.First().Name; //} - var orgName = ""; - if (profile.Child1 != null && profile.Child1 != "") - orgName += $" {profile.Child1}"; - if (profile.Child2 != null && profile.Child2 != "") - orgName += $" {profile.Child2}"; - if (profile.Child3 != null && profile.Child3 != "") - orgName += $" {profile.Child3}"; - if (profile.Child4 != null && profile.Child4 != "") - orgName += $" {profile.Child4}"; - if (profile.Root != null && profile.Root != "") - orgName += $" {profile.Root}"; + return new { @@ -233,7 +211,7 @@ namespace BMA.EHR.Leave.Service.Controllers dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", wifeDayName = data.WifeDayName ?? "", wifeDayDateBorn = data.WifeDayDateBorn ?? "", @@ -256,14 +234,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} var sumLeave = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(data.KeycloakUserId, data.Type.Id, data.LeaveStartDate.Year); @@ -276,10 +254,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", restDayOldTotal = data.RestDayOldTotal, @@ -307,14 +285,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} if (data.HajjDayStatus == true) { @@ -327,10 +305,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", @@ -355,10 +333,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", leavebirthDate = data.LeaveBirthDate == null ? "" : data.LeaveBirthDate.Value.Date.ToThaiShortDate(), @@ -390,14 +368,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} return new { @@ -408,10 +386,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", absentDaySummon = data.AbsentDaySummon, @@ -438,14 +416,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} return new { @@ -456,10 +434,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", leavebirthDate = data.LeaveBirthDate == null ? "" : data.LeaveBirthDate.Value.Date.ToThaiShortDate(), @@ -493,14 +471,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} return new { @@ -511,11 +489,11 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, fullnameEng = "", positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(), @@ -535,14 +513,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} return new { @@ -553,10 +531,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", leaveSalary = data.LeaveSalary, @@ -590,14 +568,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} return new { @@ -608,10 +586,10 @@ namespace BMA.EHR.Leave.Service.Controllers leaveWrote = data.LeaveWrote ?? "", dateSendLeave = data.CreatedAt.Date.ToThaiShortDate(), leaveTypeName = data.Type.Name, - dear = approver, + dear = data.Dear, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", @@ -740,14 +718,14 @@ namespace BMA.EHR.Leave.Service.Controllers var fullName = $"{profile!.Prefix}{profile!.FirstName} {profile!.LastName}"; - var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); - var approver = string.Empty; - if (rootOc != null) - { - var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); - if (list.Count > 0) - approver = list.First().Name; - } + //var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken); + //var approver = string.Empty; + //if (rootOc != null) + //{ + // var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty); + // if (list.Count > 0) + // approver = list.First().Name; + //} var result = new { @@ -760,11 +738,11 @@ namespace BMA.EHR.Leave.Service.Controllers leaveTypeName = data.Type.Name, fullname = fullName, positionName = profile!.Position == null ? "-" : profile!.Position, - positionLeaveName = profile!.Position == null ? "-" : profile!.Position, + positionLeaveName = profile!.PositionLeaveName == null ? "-" : profile!.PositionLeaveName, organizationName = profile!.Oc ?? "", leaveDateStart = data.LeaveStartDate.Date.ToThaiShortDate(), leaveDateEnd = data.LeaveEndDate.Date.ToThaiShortDate(), - dear = approver, + dear = data.Dear, leaveTotal = data.LeaveTotal } };