no message

This commit is contained in:
kittapath 2024-11-06 10:20:17 +07:00
parent b98b02ac98
commit e7728d71bd
8 changed files with 242 additions and 298 deletions

View file

@ -71,6 +71,27 @@ namespace BMA.EHR.Application.Repositories
}
}
public async Task<dynamic> GetPermissionOrgAPIAsync(string action, string system, string profileId)
{
try
{
var apiPath = $"{_configuration["API"]}/org/permission/dotnet-org/{action}/{system}/{profileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = await client.GetAsync(apiPath);
var res = await req.Content.ReadAsStringAsync();
return res;
}
}
catch
{
throw;
}
}
public async Task<dynamic> GetPermissionAPIWorkflowAsync(string refId, string sysName)
{
try

View file

@ -68,17 +68,26 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_PROMOTION_OFFICER");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_PROMOTION_OFFICER", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
.Where(x => x.type == "OFFICER")
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
@ -141,7 +150,6 @@ namespace BMA.EHR.Placement.Service.Controllers
p.Status,
p.Amount,
// p.RecruitDate,
p.ReportingDate,
p.IsActive,
@ -259,7 +267,6 @@ namespace BMA.EHR.Placement.Service.Controllers
p.AmountOld,
p.OrganizationOld,
p.positionOld,
// PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
p.typeCommand,
p.posmasterId,
})
@ -267,16 +274,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (data == null)
return Error(GlobalMessages.DataNotFound, 404);
// var placementAppointmentDocs = new List<dynamic>();
// foreach (var doc in data.PlacementAppointmentDocs)
// {
// var _doc = new
// {
// doc.FileName,
// PathName = await _documentService.ImagesPath(doc.Id)
// };
// placementAppointmentDocs.Add(_doc);
// }
var _data = new
{
data.Id,

View file

@ -68,16 +68,25 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_PROMOTION_EMP");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_PROMOTION_EMP", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
.Where(x => x.type == "EMPLOYEE")
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{

View file

@ -69,83 +69,66 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TEMPDUTY");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_TEMPDUTY", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var rootId = "";
var child1Id = "";
var child2Id = "";
var child3Id = "";
var child4Id = "";
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Reason,
p.Status,
p.DateStart,
p.DateEnd,
p.Organization,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Reason,
p.Status,
p.DateStart,
p.DateEnd,
p.Organization,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementOfficers);
}
return Success(placementOfficers);
}
/// <summary>

View file

@ -70,40 +70,25 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TRANSFER_RECEIVE");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_TRANSFER_RECEIVE", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
// var rootId = "";
// var child1Id = "";
// var child2Id = "";
// var child3Id = "";
// var child4Id = "";
// var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var _res = await client.SendAsync(_req);
// var _result = await _res.Content.ReadAsStringAsync();
// var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
// if (org == null || org.result == null)
// return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
// rootId = org.result.rootId == null ? "" : org.result.rootId;
// child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
// child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
// child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
// child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementReceives = await _context.PlacementReceives.AsQueryable()
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
// .Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
.Select(p => new
{
p.Id,

View file

@ -70,108 +70,69 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TEMPDUTY2");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_TEMPDUTY2", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var rootId = "";
var child1Id = "";
var child2Id = "";
var child3Id = "";
var child4Id = "";
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
var placementRepatriations = await _context.PlacementRepatriations.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
p.DateRepatriation,
})
.ToListAsync();
// if (keyword != "")
// {
// var data = placementRepatriations.Where(x =>
// (x.prefix != null && x.prefix.Contains(keyword)) ||
// (x.firstName != null && x.firstName.Contains(keyword)) ||
// (x.lastName != null && x.lastName.Contains(keyword)) ||
// (x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
// (x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
// (x.PositionOld != null && x.PositionOld.Contains(keyword)) ||
// (x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
// (x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
// (x.OrganizationPositionOld != null && x.OrganizationPositionOld.Contains(keyword)) ||
// (x.Organization != null && x.Organization.Contains(keyword)))
// .OrderByDescending(x => x.CreatedAt)
// .Skip((page - 1) * pageSize)
// .Take(pageSize)
// .ToList();
// placementRepatriations = data;
// }
return Success(placementRepatriations);
}
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementRepatriations = await _context.PlacementRepatriations.AsQueryable()
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
p.DateRepatriation,
})
.ToListAsync();
return Success(placementRepatriations);
}
/// <summary>

View file

@ -158,102 +158,69 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TRANSFER_REQ");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_TRANSFER_REQ", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var rootId = "";
var child1Id = "";
var child2Id = "";
var child3Id = "";
var child4Id = "";
var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
// if (keyword != "")
// {
// var data = placementTransfers.Where(x =>
// (x.prefix != null && x.prefix.Contains(keyword)) ||
// (x.firstName != null && x.firstName.Contains(keyword)) ||
// (x.lastName != null && x.lastName.Contains(keyword)) ||
// (x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
// (x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)))
// .OrderByDescending(x => x.CreatedAt)
// .Skip((page - 1) * pageSize)
// .Take(pageSize)
// .ToList();
// placementTransfers = data;
// }
return Success(placementTransfers);
}
// var data = JsonConvert.DeserializeObject<OrgPermissionRequest>(getPermission);
// string?[]? root = data?.Result?.Root ?? null;
// string?[]? child1 = data?.Result?.Child1 ?? null;
// string?[]? child2 = data?.Result?.Child2 ?? null;
// string?[]? child3 = data?.Result?.Child3 ?? null;
// string?[]? child4 = data?.Result?.Child4 ?? null;
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
// .Where(x => root == null ? true : root.Contains(x.rootOldId))
// .Where(x => child1 == null ? true : child1.Contains(x.child1OldId))
// .Where(x => child2 == null ? true : child2.Contains(x.child2OldId))
// .Where(x => child3 == null ? true : child3.Contains(x.child3OldId))
// .Where(x => child4 == null ? true : child4.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementTransfers);
}
/// <summary>

View file

@ -0,0 +1,21 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Placement.Service.Requests
{
public class OrgPermissionRequest
{
public int Status { get; set; }
public string Message { get; set; }
public OrgPermissionRequestData? Result { get; set; }
}
public class OrgPermissionRequestData
{
public string?[]? Root { get; set; }
public string?[]? Child1 { get; set; }
public string?[]? Child2 { get; set; }
public string?[]? Child3 { get; set; }
public string?[]? Child4 { get; set; }
public string? Privilege { get; set; }
}
}