gen commander at retirement resign

This commit is contained in:
moss 2025-05-27 20:10:19 +07:00
parent 4b43104400
commit afef4fde9f
2 changed files with 44 additions and 2 deletions

View file

@ -1109,6 +1109,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> Cancel([FromBody] RetirementReasonRequest req, Guid id)
{
var updated = await _context.RetirementResignEmployees.AsQueryable()
.Include(x => x.Approvers)
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignEmployeeNotFound, 404);
@ -1187,6 +1188,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
};
await _context.RetirementResignEmployeeCancels.AddAsync(retirementResignEmployeeCancel);
await _context.SaveChangesAsync();
var addList = new List<RetirementResignEmployeeCancelApprover>();
foreach (var r in updated.Approvers)
{
addList.Add(new RetirementResignEmployeeCancelApprover
{
Seq = r.Seq,
RetirementResignEmployeeCancel = retirementResignEmployeeCancel,
Prefix = r.Prefix,
FirstName = r.FirstName,
LastName = r.LastName,
PositionName = r.PositionName,
ProfileId = r.ProfileId,
KeycloakId = r.KeycloakId,
Org = r.Org,
ApproveStatus = "PENDING",
ApproveType = r.ApproveType
});
}
await _context.AddRangeAsync(addList);
await _context.SaveChangesAsync();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));