แก้ 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
{ {
@ -668,23 +669,28 @@ namespace BMA.EHR.Retirement.Service.Controllers
// var prefix = item.profileId; // var prefix = item.profileId;
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)
{
if (item.profileId != null)
{ {
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
item.profileId, 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
{
if (item.profileId != null)
{ {
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
item.profileId, 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,
@ -693,6 +699,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
); );
} }
} }
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();

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
); );
if (updated.profileId != null) {
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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();
@ -792,13 +794,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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,13 +839,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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,13 +886,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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,13 +930,16 @@ namespace BMA.EHR.Retirement.Service.Controllers
"", "",
true true
); );
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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
); );
if (updated.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
updated.profileId, 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;
if (uppdated.RetirementResign != null && uppdated.RetirementResign.profileId != null)
{
await _repositoryNoti.PushNotificationAsync( await _repositoryNoti.PushNotificationAsync(
uppdated.RetirementResign.profileId, 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();