เพิ่มลูกจ้าง api อัพเดทสถานะ mark ระบบเครื่องราช (issue ##1344)
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
Bright 2025-05-23 17:54:36 +07:00
parent a2efb8d9af
commit c832465e71
3 changed files with 60 additions and 53 deletions

View file

@ -2728,28 +2728,39 @@ namespace BMA.EHR.Insignia.Service.Controllers
if (insigniaPeriod.InsigniaRequests.Count > 0)
{
var allProfileIds = new List<string>();
//var allProfileIds = new List<string>();
//var allProfileEmpIds = new List<string>();
foreach (var InsigniaRequest in insigniaPeriod.InsigniaRequests)
{
var profiles = await _context.Set<InsigniaRequestProfile>()
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "OFFICER").Select(x => x.ProfileId.ToString()).ToListAsync();
if (profiles != null && profiles.Count > 0)
var profileEmps = await _context.Set<InsigniaRequestProfile>()
.Where(p => p.Request.Id == InsigniaRequest.Id && p.ProfileType.Trim().ToUpper() == "EMPLOYEE").Select(x => x.ProfileId.ToString()).ToListAsync();
if (profiles.Count > 0)
{
allProfileIds.AddRange(profiles);
//allProfileIds.AddRange(profiles);
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profiles.ToArray(), "OFFICER");
}
if (profileEmps.Count > 0)
{
//allProfileEmpIds.AddRange(profileEmps);
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(profileEmps.ToArray(), "EMPLOYEE");
}
}
if (allProfileIds.Count > 0)
{
await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileIds.ToArray(), "OFFICER", null);
}
}
//if (allProfileIds.Count > 0)
//{
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileIds.ToArray(), "OFFICER");
//}
//if (insigniaPeriod.InsigniaEmployees.Count > 0)
//{
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(insigniaPeriod.InsigniaEmployees.Select(x => x.RefId!.ValueOrBlank()).ToArray(), "EMPLOYEE", insigniaPeriod.Id);
//}
//if (allProfileEmpIds.Count > 0)
//{
// await _insigniaPeriodRepository.UpdateInsigniaRequestProfile(allProfileEmpIds.ToArray(), "EMPLOYEE");
//}
}
return Success();
}