noti พ้นราชการ บรรจุ
This commit is contained in:
parent
e5af4a3513
commit
d34f04ffee
25 changed files with 16558 additions and 130 deletions
|
|
@ -54,6 +54,70 @@ 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
|
||||
if (profile == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
if (IsSendNotification == true)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
_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();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue