noti probation

This commit is contained in:
Kittapath 2023-09-08 15:23:41 +07:00
parent ffac27ef76
commit 3a334387bd
20 changed files with 33093 additions and 91 deletions

View file

@ -54,29 +54,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
}
}
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, bool IsSendNotification = true, bool IsSendInbox = false, bool IsSendMail = false)
public async Task PushNotificationAsync(Guid ReceiverUserId, string Subject, string Body, string Payload = "", bool IsSendInbox = false, bool IsSendMail = false)
{
try
{
var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
if (profile != null)
{
if (IsSendNotification == true)
_dbContext.Set<Notification>().Add(new Notification
{
_dbContext.Set<Notification>().Add(new Notification
{
Body = Body,
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = "",
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
Body = Body,
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = Payload,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
if (IsSendInbox == true)
{
_dbContext.Set<Inbox>().Add(new Inbox
@ -84,7 +81,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
Subject = Subject,
Body = Body,
ReceiverUserId = ReceiverUserId,
Payload = "",
Payload = Payload,
CreatedUserId = UserId ?? "System Administrator",
CreatedFullName = FullName ?? "",
CreatedAt = DateTime.Now,