api ค้นหาผู้เกี่ยวข้องคำสั่ง

This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2023-09-05 20:24:15 +07:00
parent e7c71b2e15
commit fa8dfc51e4
4 changed files with 68 additions and 3 deletions

View file

@ -1465,7 +1465,7 @@ namespace BMA.EHR.Application.Repositories.Commands
await ExecuteCommand12Async(command);
break;
case "C-PM-17":
await ExecuteCommand17Async(command);
await ExecuteCommand17Async(command);
break;
case "C-PM-18":
await ExecuteCommand18Async(command);
@ -2030,7 +2030,7 @@ namespace BMA.EHR.Application.Repositories.Commands
{
foreach (var recv in command.Receivers)
{
var data = await _dbContext.Set<Profile>()
var data = await _dbContext.Set<Profile>()
.Include(x => x.Salaries)
.ThenInclude(x => x.PositionLevel)
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
@ -3737,6 +3737,34 @@ namespace BMA.EHR.Application.Repositories.Commands
#endregion
public async Task<dynamic> GetCommandProfileAsync(Guid commandTypeId, int year, string? posno)
{
try
{
var commandType = await _dbContext.Set<CommandType>()
.FirstOrDefaultAsync(x => x.Id == commandTypeId);
if (commandType == null)
throw new Exception(GlobalMessages.CommandTypeNotFound);
var profile = await _dbContext.Set<Profile>()
.Where(x => x.CitizenId == "0000000000001")
.Select(x => new
{
Id = x.Id,
CitizenId = x.CitizenId,
FullName = $"{x.Prefix.Name}{x.FirstName} {x.LastName}",
PosNo = x.PosNo == null ? null : x.PosNo.Name,
Position = x.Position == null ? null : x.Position.Name,
})
.ToListAsync();
return profile;
}
catch
{
throw;
}
}
#endregion
}