แก้noti

This commit is contained in:
Kittapath 2024-08-05 14:33:30 +07:00
parent c802ab718f
commit 8c540b6568
3 changed files with 84 additions and 54 deletions

View file

@ -68,7 +68,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
if (org == null || org.result == null)
return new List<InboxResponse>();
profileId = org.result.rootId == null ? "" : org.result.profileId;
profileId = org.result.profileId == null ? "" : org.result.profileId;
}
if (profileId == null || profileId == "")
return new List<InboxResponse>();
@ -143,7 +143,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
if (org == null || org.result == null)
return 0;
profileId = org.result.rootId == null ? "" : org.result.profileId;
profileId = org.result.profileId == null ? "" : org.result.profileId;
}
if (profileId == null || profileId == "")
return 0;
@ -190,11 +190,26 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
// var profile = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.Id == ReceiverUserId);
//if (profile != null)
//{
_dbContext.Set<Notification>().Add(new Notification
_dbContext.Set<Notification>().Add(new Notification
{
Body = Body,
ReceiverUserId = ReceiverUserId,
Type = "",
Payload = Payload,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
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,
Type = "",
Payload = Payload,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
@ -203,27 +218,12 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
if (IsSendInbox == true)
{
_dbContext.Set<Inbox>().Add(new Inbox
{
Subject = Subject,
Body = Body,
ReceiverUserId = ReceiverUserId,
Payload = Payload,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
if (IsSendMail == true)
{
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
}
await _dbContext.SaveChangesAsync();
}
if (IsSendMail == true)
{
_emailSenderService.SendMail(Subject, Body, "kittapath@frappet.com");
}
await _dbContext.SaveChangesAsync();
//}
}
catch