From 5a170bc7abdccda4d2a77aaa76daac11bed2320e Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 10 Jun 2021 14:03:49 +0000 Subject: [PATCH] --- server/AyaNova/biz/WorkOrderBiz.cs | 68 ++++++++++++++---------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 5181a6e7..1782d485 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -1072,37 +1072,35 @@ namespace AyaNova.Biz }//CREATED overdue completion - #endregion + #endregion + - #region CustomerServiceImminent if (ayaEvent == AyaEvent.Created && oProposed.CompleteByDate != null) { - + var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.CustomerServiceImminent).ToListAsync(); foreach (var sub in subs) { //not for inactive users if (!await UserBiz.UserIsActive(sub.UserId)) continue; - //Tag match? (will be true if no sub tags so always safe to call this) - if (NotifyEventHelper.ObjectHasAllSubscriptionTags(proposedObj.Tags, sub.Tags)) - { + //No tag match for this one + + NotifyEvent n = new NotifyEvent() + { + EventType = NotifyEventType.CustomerServiceImminent, + UserId = sub.UserId, + AyaType = proposedObj.AyaType, + ObjectId = proposedObj.Id, + NotifySubscriptionId = sub.Id, + Name = oProposed.Serial.ToString(), + EventDate = (DateTime)oProposed.CompleteByDate + }; + await ct.NotifyEvent.AddAsync(n); + log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]"); + await ct.SaveChangesAsync(); - NotifyEvent n = new NotifyEvent() - { - EventType = NotifyEventType.CustomerServiceImminent, - UserId = sub.UserId, - AyaType = proposedObj.AyaType, - ObjectId = proposedObj.Id, - NotifySubscriptionId = sub.Id, - Name = oProposed.Serial.ToString(), - EventDate = (DateTime)oProposed.CompleteByDate - }; - await ct.NotifyEvent.AddAsync(n); - log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]"); - await ct.SaveChangesAsync(); - } } }//CustomerServiceImminent @@ -1125,23 +1123,21 @@ namespace AyaNova.Biz //not for inactive users if (!await UserBiz.UserIsActive(sub.UserId)) continue; - //Tag match? (will be true if no sub tags so always safe to call this) - if (NotifyEventHelper.ObjectHasAllSubscriptionTags(proposedObj.Tags, sub.Tags)) + //No tag match for this one + NotifyEvent n = new NotifyEvent() { - NotifyEvent n = new NotifyEvent() - { - EventType = NotifyEventType.CustomerServiceImminent, - UserId = sub.UserId, - AyaType = proposedObj.AyaType, - ObjectId = proposedObj.Id, - NotifySubscriptionId = sub.Id, - Name = oProposed.Serial.ToString(), - EventDate = (DateTime)oProposed.CompleteByDate - }; - await ct.NotifyEvent.AddAsync(n); - log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]"); - await ct.SaveChangesAsync(); - } + EventType = NotifyEventType.CustomerServiceImminent, + UserId = sub.UserId, + AyaType = proposedObj.AyaType, + ObjectId = proposedObj.Id, + NotifySubscriptionId = sub.Id, + Name = oProposed.Serial.ToString(), + EventDate = (DateTime)oProposed.CompleteByDate + }; + await ct.NotifyEvent.AddAsync(n); + log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]"); + await ct.SaveChangesAsync(); + } } }