Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2024-07-02 05:16:34 +07:00
commit e51f4472c2
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.Security.Claims;
using System.Security.Cryptography;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
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);
if (profile != null)
{
await _repositoryNoti.PushNotificationAsync(
item.profileId,
if (item.profileId != null)
{
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}",
payload_str,
profile.IsSendInbox,
profile.IsSendMail
);
}
item.IsSendMail = profile.IsSendMail;
item.IsSendInbox = profile.IsSendInbox;
item.IsSendNotification = profile.IsSendNotification;
}
else
{
await _repositoryNoti.PushNotificationAsync(
item.profileId,
if (item.profileId != null)
{
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}",
payload_str,
item.IsSendInbox,
item.IsSendMail
);
}
}
}
await _context.SaveChangesAsync();

View file

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