Merge branch 'develop'
* develop: fix: skip notification if no commander is assigned; update connection strings in appsettings edit permission normal fix สิทธิ์เมนูจำนวนสิทธิ์การลาที่ใช้ไป #2094 Fix รายงานใบสมัครสอบส่วนเนื้อหาคำรับรองเพี้ยน #2099 migration files migrate to CM Server no message fix role แก้ไขข้อความให้ตรงกับฝั่ง ui (ทาง กทม. แจ้งให้แก้ไขข้อความค่ะ) แก้ไขข้อความให้ตรงกับฝั่ง ui (ทาง กทม. แจ้งให้แก้ไขข้อความค่ะ) no message fix bug เพิ่ม-แก้ไขข้อมูลประวัติการศึกษาไม่อัปเดต #2022, #2025 fix #2016, #2017 fix ใบสมัครสอบ fix ยืมคืนเครื่องราชย?มาใช้่ RootDnaId แทน rootId fix ใบสมัครสอบคัดเลือก #2016, #2017, #2018 fix issue #2007 fix issues 1972 migrate
This commit is contained in:
commit
a047787fb4
43 changed files with 44885 additions and 316 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Insignia.Service.Configuration;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Insignia.Service.Configuration;
|
||||
using SocketIOClient;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
|
@ -9,16 +10,17 @@ public class InsigniaRequestProcessService : BackgroundService
|
|||
{
|
||||
private readonly IBackgroundTaskQueue _queue;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
|
||||
public InsigniaRequestProcessService(
|
||||
IBackgroundTaskQueue queue,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
_queue = queue;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
||||
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -93,6 +95,14 @@ public class InsigniaRequestProcessService : BackgroundService
|
|||
var endTime = DateTime.Now;
|
||||
var duration = endTime - startTime;
|
||||
|
||||
// Resolve repository from a scope because DbContext is scoped/transient.
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
var userProfileRepository = (UserProfileRepository)scope.ServiceProvider.GetService(typeof(UserProfileRepository));
|
||||
if (userProfileRepository != null)
|
||||
{
|
||||
await userProfileRepository.PostInsigniaMessageToSocket("Task completed", UserId ?? "", AccessToken);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue