This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user