Changed the signalR keyword for work item

This commit is contained in:
ashutosh.nehete 2025-07-09 10:35:35 +05:30
parent 856510baff
commit de5485b8f6

View File

@ -793,7 +793,7 @@ namespace MarcoBMS.Services.Controllers
var responseList = new List<WorkItemVM>(); var responseList = new List<WorkItemVM>();
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
string message = ""; string message = "";
List<Guid> projectIds = new List<Guid>(); List<Guid> workAreaIds = new List<Guid>();
var workItemIds = workItemDtos.Where(wi => wi.Id != null && wi.Id != Guid.Empty).Select(wi => wi.Id).ToList(); var workItemIds = workItemDtos.Where(wi => wi.Id != null && wi.Id != Guid.Empty).Select(wi => wi.Id).ToList();
var workItems = await _context.WorkItems.AsNoTracking().Where(wi => workItemIds.Contains(wi.Id)).ToListAsync(); var workItems = await _context.WorkItems.AsNoTracking().Where(wi => workItemIds.Contains(wi.Id)).ToListAsync();
@ -846,7 +846,7 @@ namespace MarcoBMS.Services.Controllers
WorkItemId = workItem.Id, WorkItemId = workItem.Id,
WorkItem = workItem WorkItem = workItem
}); });
projectIds.Add(building.ProjectId); workAreaIds.Add(workItem.WorkAreaId);
} }
string responseMessage = ""; string responseMessage = "";
@ -873,7 +873,7 @@ namespace MarcoBMS.Services.Controllers
var notification = new { LoggedInUserId = LoggedInEmployee.Id, Keyword = "Infra", ProjectIds = projectIds, Message = message }; var notification = new { LoggedInUserId = LoggedInEmployee.Id, Keyword = "WorkItem", WorkAreaIds = workAreaIds, Message = message };
await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification); await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification);
@ -885,7 +885,7 @@ namespace MarcoBMS.Services.Controllers
{ {
Guid tenantId = _userHelper.GetTenantId(); Guid tenantId = _userHelper.GetTenantId();
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync(); var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
List<Guid> projectIds = new List<Guid>(); List<Guid> workAreaIds = new List<Guid>();
WorkItem? task = await _context.WorkItems.AsNoTracking().Include(t => t.WorkArea).FirstOrDefaultAsync(t => t.Id == id && t.TenantId == tenantId); WorkItem? task = await _context.WorkItems.AsNoTracking().Include(t => t.WorkArea).FirstOrDefaultAsync(t => t.Id == id && t.TenantId == tenantId);
if (task != null) if (task != null)
{ {
@ -902,9 +902,9 @@ namespace MarcoBMS.Services.Controllers
var floor = await _context.Floor.Include(f => f.Building).FirstOrDefaultAsync(f => f.Id == floorId); var floor = await _context.Floor.Include(f => f.Building).FirstOrDefaultAsync(f => f.Id == floorId);
projectIds.Add(floor?.Building?.ProjectId ?? Guid.Empty); workAreaIds.Add(task.WorkAreaId);
var notification = new { LoggedInUserId = LoggedInEmployee.Id, Keyword = "Infra", ProjectIds = projectIds, Message = $"Task Deleted in Building: {floor?.Building?.Name}, on Floor: {floor?.FloorName}, in Area: {task.WorkArea?.AreaName} by {LoggedInEmployee.FirstName} {LoggedInEmployee.LastName}" }; var notification = new { LoggedInUserId = LoggedInEmployee.Id, Keyword = "WorkItem", WorkAreaIds = workAreaIds, Message = $"Task Deleted in Building: {floor?.Building?.Name}, on Floor: {floor?.FloorName}, in Area: {task.WorkArea?.AreaName} by {LoggedInEmployee.FirstName} {LoggedInEmployee.LastName}" };
await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification); await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification);
} }
else else