Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2023-09-08 11:53:58 +07:00
commit 388517aed0
6 changed files with 73 additions and 55 deletions

View file

@ -59,58 +59,58 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
try
{
var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
if (profile == null)
throw new Exception(GlobalMessages.DataNotFound);
if (IsSendNotification == true)
if (profile != null)
{
_dbContext.Set<Notification>().Add(new Notification
if (IsSendNotification == true)
{
Body = Body,
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = "",
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (IsSendInbox == true)
{
_dbContext.Set<Inbox>().Add(new Inbox
_dbContext.Set<Notification>().Add(new Notification
{
Body = Body,
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = "",
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (IsSendInbox == true)
{
Subject = Subject,
Body = Body,
ReceiverUserId = ReceiverUserId,
Payload = "",
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
_dbContext.Set<Inbox>().Add(new Inbox
{
Subject = Subject,
Body = Body,
ReceiverUserId = ReceiverUserId,
Payload = "",
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (IsSendMail == true)
{
// _context.Notifications.Add(new Notification
// {
// Body = req.Body,
// ReceiverUserId = req.ReceiverUserId,
// Type = "",
// Payload = "",
// CreatedUserId = FullName ?? "",
// CreatedFullName = UserId ?? "System Administrator",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
}
await _dbContext.SaveChangesAsync();
}
if (IsSendMail == true)
{
// _context.Notifications.Add(new Notification
// {
// Body = req.Body,
// ReceiverUserId = req.ReceiverUserId,
// Type = "",
// Payload = "",
// CreatedUserId = FullName ?? "",
// CreatedFullName = UserId ?? "System Administrator",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
}
await _dbContext.SaveChangesAsync();
}
catch
{

View file

@ -732,6 +732,7 @@ namespace BMA.EHR.Application.Repositories.Reports
Age = r.Date == null ? "-" : r.Date.Value.CalculateBetweenDateV2(DateTime.Now).ToThaiNumber(),
Amount = r.Amount == null ? null : r.Amount.Value.ToNumericText().ToThaiNumber(),
Date = r.Date,
Remark = "",
})
.Distinct()
.OrderBy(x => x.Date)

View file

@ -373,7 +373,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
}
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"),
Guid.Parse("08db721d-ade4-480e-8d84-0853946a0ea5"),
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน",
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}"
);

View file

@ -352,7 +352,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
}
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"),
Guid.Parse("08db721d-ae2f-4f5d-836a-02d2413df33d"),
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก",
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำลาออก"
);
@ -507,6 +507,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync();
return Success();
@ -537,6 +542,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา"
);
await _context.SaveChangesAsync();
return Success();
@ -567,9 +577,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("00000000-0000-0000-0000-000000000000"),
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติ"
updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ"
);
await _context.SaveChangesAsync();
@ -589,6 +599,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id)
{
var updated = await _context.RetirementResigns
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
@ -601,6 +613,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
updated.Profile.Id,
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ",
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ"
);
await _context.SaveChangesAsync();
return Success();

View file

@ -19,7 +19,7 @@
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {

View file

@ -1,6 +1,6 @@
{
"realm": "bma-ehr",
"auth-server-url": "https://identity.frappet.com",
"auth-server-url": "https://id.frappet.synology.me",
"ssl-required": "external",
"resource": "bma-ehr",
"public-client": true