ปรับ เครื่องราชย์ + ลา ลงเวลา ไปใช้ทะเบียนประวัติใหม่
This commit is contained in:
parent
1134267acf
commit
ab129896ae
20 changed files with 21443 additions and 3616 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -4,11 +4,11 @@ using BMA.EHR.Application.Responses.Profiles;
|
|||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -61,6 +61,70 @@ namespace BMA.EHR.Application.Repositories
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<GetProfileByRootIdDto>> GetOfficerProfileByRootIdAsync(Guid rootId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/dotnet/root/officer/{rootId}";
|
||||
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByRootIdResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
//var data = await _dbContext.Set<Profile>().AsQueryable()
|
||||
// .Include(p => p.Prefix)
|
||||
// .Include(p => p.Position)
|
||||
// .Include(p => p.PositionLevel)
|
||||
// .Include(p => p.Salaries)
|
||||
// .FirstOrDefaultAsync(p => p.KeycloakId == keycloakId);
|
||||
|
||||
//return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetProfileByRootIdDto>> GetEmployeeProfileByRootIdAsync(Guid rootId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/dotnet/root/employee/{rootId}";
|
||||
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByRootIdResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
//var data = await _dbContext.Set<Profile>().AsQueryable()
|
||||
// .Include(p => p.Prefix)
|
||||
// .Include(p => p.Position)
|
||||
// .Include(p => p.PositionLevel)
|
||||
// .Include(p => p.Salaries)
|
||||
// .FirstOrDefaultAsync(p => p.KeycloakId == keycloakId);
|
||||
|
||||
//return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GetProfileByKeycloakIdDto?> GetProfileByKeycloakIdAsync(Guid keycloakId, string? accessToken)
|
||||
{
|
||||
try
|
||||
|
|
@ -380,6 +444,72 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public GetProfileByIdDto GetOfficerProfileById(Guid id, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/profile/{id}";
|
||||
|
||||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||
if (apiResult.Result != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByIdResultDto>(apiResult.Result);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public GetProfileByIdDto GetEmployeeProfileById(Guid id, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/profile-employee/{id}";
|
||||
|
||||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||
if (apiResult.Result != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByIdResultDto>(apiResult.Result);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public GetProfileByIdDto GetOfficerProfileByCitizenId(string citizenId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/dotnet/citizenId/{citizenId}";
|
||||
|
||||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "");
|
||||
if (apiResult.Result != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByIdResultDto>(apiResult.Result);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue