fix คำนวณเครื่องราชย์
This commit is contained in:
parent
41474b407d
commit
0ed2d4c389
4 changed files with 56 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Reflection.Emit;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace BMA.EHR.Application.Repositories
|
namespace BMA.EHR.Application.Repositories
|
||||||
|
|
@ -510,6 +511,28 @@ namespace BMA.EHR.Application.Repositories
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<GetActiveRootDto>> GetActiveRootAsync(string? accessToken)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiPath = $"{_configuration["API"]}/org/active/root";
|
||||||
|
|
||||||
|
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||||
|
if (apiResult != null)
|
||||||
|
{
|
||||||
|
var raw = JsonConvert.DeserializeObject<GetActiveRootResultDto>(apiResult);
|
||||||
|
if (raw != null)
|
||||||
|
return raw.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Organizations
|
||||||
|
{
|
||||||
|
public class GetActiveRootDto
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
public Guid CreatedUserId { get; set; }
|
||||||
|
public DateTime LastUpdatedAt { get; set; }
|
||||||
|
public Guid LastUpdateUserId { get; set; }
|
||||||
|
public string CreatedFullName { get; set; } = string.Empty;
|
||||||
|
public string LastUpdateFullName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string OrgRootName { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace BMA.EHR.Application.Responses.Organizations
|
||||||
|
{
|
||||||
|
public class GetActiveRootResultDto
|
||||||
|
{
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
|
||||||
|
public List<GetActiveRootDto> Result { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -604,10 +604,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
[HttpGet("{insigniaPeriodId:length(36)}")]
|
[HttpGet("{insigniaPeriodId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateInsignaiRequestBkk(Guid insigniaPeriodId)
|
public async Task<ActionResult<ResponseObject>> UpdateInsignaiRequestBkk(Guid insigniaPeriodId)
|
||||||
{
|
{
|
||||||
var organizationType = await _context.OrganizationTypes.Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
//var organizationType = await _context.OrganizationTypes.Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
|
||||||
if (organizationType == null)
|
//if (organizationType == null)
|
||||||
return Error(GlobalMessages.OrganizationNotFound);
|
// return Error(GlobalMessages.OrganizationNotFound);
|
||||||
var organizations = await _context.Organizations.Where(x => x.OrganizationType == organizationType).ToListAsync();
|
//var organizations = await _context.Organizations.Where(x => x.OrganizationType == organizationType).ToListAsync();
|
||||||
|
|
||||||
|
var organizations = await _userProfileRepository.GetActiveRootAsync(AccessToken);
|
||||||
|
|
||||||
foreach (var organization in organizations)
|
foreach (var organization in organizations)
|
||||||
{
|
{
|
||||||
if (organization == null)
|
if (organization == null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue