fix คำนวณเครื่องราชย์

This commit is contained in:
Suphonchai Phoonsawat 2024-06-25 11:22:46 +07:00
parent 41474b407d
commit 0ed2d4c389
4 changed files with 56 additions and 4 deletions

View file

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Reflection.Emit;
using System.Security.Cryptography;
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
}
}

View file

@ -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;
}
}

View file

@ -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();
}
}