From e7ba80227958b97dbe1ab2e005e86734c354af74 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 29 Jan 2025 13:25:38 +0700 Subject: [PATCH] no message --- .../Repositories/RetirementRepository.cs | 15 +++++++++++++-- .../Controllers/RetirementController.cs | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/BMA.EHR.Application/Repositories/RetirementRepository.cs b/BMA.EHR.Application/Repositories/RetirementRepository.cs index 19daf382..20d96b3b 100644 --- a/BMA.EHR.Application/Repositories/RetirementRepository.cs +++ b/BMA.EHR.Application/Repositories/RetirementRepository.cs @@ -4,6 +4,10 @@ using BMA.EHR.Domain.Models.Retirement; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using System.Net.Http.Headers; +using System.Security.Claims; +using System.Text; namespace BMA.EHR.Application.Repositories { @@ -24,6 +28,13 @@ namespace BMA.EHR.Application.Repositories _configuration = configuration; } + #region " Properties " + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"]; + + #endregion + //ปลดออก public async Task NotifyDischarge() { @@ -111,8 +122,8 @@ namespace BMA.EHR.Application.Repositories .ToList(); //ข้าราชการ - var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement"; - //var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement"; + //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement"; + var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index 54025830..5d5b5306 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -14,6 +14,7 @@ using Newtonsoft.Json.Linq; using Swashbuckle.AspNetCore.Annotations; using System.Net.Http.Headers; using System.Security.Claims; +using System.Text; namespace BMA.EHR.Retirement.Service.Controllers { @@ -2008,7 +2009,8 @@ namespace BMA.EHR.Retirement.Service.Controllers // .FirstOrDefaultAsync(); // var body = retirePeriodOfficer.RetirementProfiles - // .Select(x => new { + // .Select(x => new + // { // profileId = x.profileId, // //lastUpdateUserId = UserId, // //lastUpdateFullName = FullName,