add conjob insignia
This commit is contained in:
parent
42b1ae87fa
commit
ffac27ef76
4 changed files with 70 additions and 18 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
|
@ -19,6 +20,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly string CRLF = "\r\n";
|
||||
|
||||
#endregion
|
||||
|
|
@ -27,10 +29,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
public InsigniaReportRepository(IApplicationDBContext dbContext,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
}
|
||||
|
||||
|
|
@ -740,6 +744,23 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return data;
|
||||
}
|
||||
public async Task NotifyInsignia()
|
||||
{
|
||||
var insigniaPeriods = await _dbContext.Set<InsigniaPeriod>()
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
if (insigniaPeriod.StartDate.AddDays(-insigniaPeriod.Amount).Date == DateTime.Now.Date)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ade4-480e-8d84-0853946a0ea5"),
|
||||
$"แจ้งเตือนรอบการเสนอขอ {insigniaPeriod.Name} รอบที่{insigniaPeriod.Round}",
|
||||
$"แจ้งเตือนรอบการเสนอขอ {insigniaPeriod.Name} รอบที่{insigniaPeriod.Round}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue