เพิ่มคำสั่งยกเลิกลา

This commit is contained in:
Kittapath 2024-07-18 20:37:17 +07:00
parent bcf0c0bfdb
commit 033fc915d0
12 changed files with 19309 additions and 88 deletions

View file

@ -632,7 +632,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
updated.Status = "CANCEL";
if (updated.Status == "DONE")
{
updated.Status = "DONECANCEL";
}
else
{
updated.Status = "CANCEL";
}
updated.CancelReason = req.Reason;
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
@ -749,14 +757,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"",
true
);
if (updated.profileId != null) {
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
"",
true
); }
);
}
await _context.SaveChangesAsync();
return Success();
@ -839,17 +849,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"",
true
);
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
"",
true
);
}
await _context.SaveChangesAsync();
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
"",
true
);
}
await _context.SaveChangesAsync();
return Success();
}
@ -886,17 +896,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"",
true
);
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
"",
true
);
}
await _context.SaveChangesAsync();
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
"",
true
);
}
await _context.SaveChangesAsync();
return Success();
}
@ -930,17 +940,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"",
true
);
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
"",
true
);
}
await _context.SaveChangesAsync();
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
"",
true
);
}
await _context.SaveChangesAsync();
return Success();
}
@ -977,16 +987,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"",
true
);
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
"",
true
);
}
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
"",
true
);
}
await _context.SaveChangesAsync();
return Success();