แก้ report เกษียณ

This commit is contained in:
Kittapath 2024-07-01 23:36:57 +07:00
parent 320fb3386e
commit 8d700d273f
2 changed files with 53 additions and 27 deletions

View file

@ -20,6 +20,7 @@ using System.Net.Http.Headers;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Security.Claims; using System.Security.Claims;
using System.Security.Cryptography; using System.Security.Cryptography;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace BMA.EHR.Retirement.Service.Controllers namespace BMA.EHR.Retirement.Service.Controllers
{ {
@ -669,28 +670,34 @@ namespace BMA.EHR.Retirement.Service.Controllers
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.profileId); var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.profileId);
if (profile != null) if (profile != null)
{ {
await _repositoryNoti.PushNotificationAsync( if (item.profileId != null)
item.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(item.profileId),
$"หนังสือเวียนถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}", $"หนังสือเวียนถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
$"แจ้งข่าวการถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}", $"แจ้งข่าวการถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
payload_str, payload_str,
profile.IsSendInbox, profile.IsSendInbox,
profile.IsSendMail profile.IsSendMail
); );
}
item.IsSendMail = profile.IsSendMail; item.IsSendMail = profile.IsSendMail;
item.IsSendInbox = profile.IsSendInbox; item.IsSendInbox = profile.IsSendInbox;
item.IsSendNotification = profile.IsSendNotification; item.IsSendNotification = profile.IsSendNotification;
} }
else else
{ {
await _repositoryNoti.PushNotificationAsync( if (item.profileId != null)
item.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(item.profileId),
$"หนังสือเวียนถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}", $"หนังสือเวียนถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
$"แจ้งข่าวการถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}", $"แจ้งข่าวการถึงแก่กรรมของ {item.RetirementDeceased.prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
payload_str, payload_str,
item.IsSendInbox, item.IsSendInbox,
item.IsSendMail item.IsSendMail
); );
}
} }
} }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();

View file

@ -15,6 +15,7 @@ using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Security.Claims; using System.Security.Claims;
using System.Security.Cryptography; using System.Security.Cryptography;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace BMA.EHR.Retirement.Service.Controllers namespace BMA.EHR.Retirement.Service.Controllers
{ {
@ -748,13 +749,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null) {
updated.profileId, await _repositoryNoti.PushNotificationAsync(
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่", Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
"", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
true "",
); true
); }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
@ -792,13 +794,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null)
updated.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
"", "",
true true
); );
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
@ -834,14 +839,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null)
updated.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
"", "",
true true
); );
await _context.SaveChangesAsync(); }
await _context.SaveChangesAsync();
return Success(); return Success();
} }
@ -878,14 +886,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null)
updated.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
"", "",
true true
); );
await _context.SaveChangesAsync(); }
await _context.SaveChangesAsync();
return Success(); return Success();
} }
@ -919,14 +930,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null)
updated.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
"", "",
true true
); );
await _context.SaveChangesAsync(); }
await _context.SaveChangesAsync();
return Success(); return Success();
} }
@ -963,13 +977,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
await _repositoryNoti.PushNotificationAsync( if (updated.profileId != null)
updated.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(updated.profileId),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ", $"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
"", "",
true true
); );
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
@ -1345,14 +1362,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
uppdated.LastUpdateFullName = FullName ?? "System Administrator"; uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? ""; uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now; uppdated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync( if (uppdated.RetirementResign != null && uppdated.RetirementResign.profileId != null)
uppdated.RetirementResign.profileId, {
await _repositoryNoti.PushNotificationAsync(
Guid.Parse(uppdated.RetirementResign.profileId),
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}", $"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}", $"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
"", "",
true true
); );
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();