From 909042445c7c52e0093d837bc31a1171299fa7bf Mon Sep 17 00:00:00 2001 From: kittapath <> Date: Fri, 2 Jan 2026 21:47:26 +0700 Subject: [PATCH] find org v2 --- BMA.EHR.Application/Repositories/UserProfileRepository.cs | 5 +++-- BMA.EHR.Leave/Controllers/LeaveReportController.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BMA.EHR.Application/Repositories/UserProfileRepository.cs b/BMA.EHR.Application/Repositories/UserProfileRepository.cs index 150aeded..7ffdc024 100644 --- a/BMA.EHR.Application/Repositories/UserProfileRepository.cs +++ b/BMA.EHR.Application/Repositories/UserProfileRepository.cs @@ -574,6 +574,7 @@ namespace BMA.EHR.Application.Repositories // endDate = endDate date = endDate }; + Console.WriteLine(body); var profiles = new List(); @@ -585,7 +586,7 @@ namespace BMA.EHR.Application.Repositories return raw.Result; } - return null; + return new List(); } catch { @@ -983,7 +984,7 @@ namespace BMA.EHR.Application.Repositories { try { - var apiPath = $"{_configuration["API"]}/org/find/all"; + var apiPath = $"{_configuration["API"]}/org/find/allv2"; var apiKey = _configuration["API_KEY"]; var body = new { diff --git a/BMA.EHR.Leave/Controllers/LeaveReportController.cs b/BMA.EHR.Leave/Controllers/LeaveReportController.cs index 3f9b9cf1..b5f620c0 100644 --- a/BMA.EHR.Leave/Controllers/LeaveReportController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveReportController.cs @@ -2241,7 +2241,7 @@ namespace BMA.EHR.Leave.Service.Controllers var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate()}"; var org = _userProfileRepository.GetOc(Guid.Parse(req.nodeId), req.node, AccessToken); - var organizationName = $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}"; + var organizationName = org == null ? "" : $"{(!string.IsNullOrEmpty(org.Child4) ? org.Child4 + "/" : "")}{(!string.IsNullOrEmpty(org.Child3) ? org.Child3 + "/" : "")}{(!string.IsNullOrEmpty(org.Child2) ? org.Child2 + "/" : "")}{(!string.IsNullOrEmpty(org.Child1) ? org.Child1 + "/" : "")}{org.Root ?? ""}"; var dateTimeStamp = $"ประจำ ณ วัน{req.StartDate.Date.GetThaiDayOfWeek()} ที่ {req.StartDate.Date.ToThaiShortDate()}{enddate}"; var templatePath = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", "TimeStampRecords.xlsx");