This commit is contained in:
@@ -1072,37 +1072,35 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
}//CREATED overdue completion
|
}//CREATED overdue completion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region CustomerServiceImminent
|
#region CustomerServiceImminent
|
||||||
if (ayaEvent == AyaEvent.Created && oProposed.CompleteByDate != null)
|
if (ayaEvent == AyaEvent.Created && oProposed.CompleteByDate != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.CustomerServiceImminent).ToListAsync();
|
var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.CustomerServiceImminent).ToListAsync();
|
||||||
foreach (var sub in subs)
|
foreach (var sub in subs)
|
||||||
{
|
{
|
||||||
//not for inactive users
|
//not for inactive users
|
||||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||||
|
|
||||||
//Tag match? (will be true if no sub tags so always safe to call this)
|
//No tag match for this one
|
||||||
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(proposedObj.Tags, sub.Tags))
|
|
||||||
{
|
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
|
}//CustomerServiceImminent
|
||||||
@@ -1125,23 +1123,21 @@ namespace AyaNova.Biz
|
|||||||
//not for inactive users
|
//not for inactive users
|
||||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||||
|
|
||||||
//Tag match? (will be true if no sub tags so always safe to call this)
|
//No tag match for this one
|
||||||
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(proposedObj.Tags, sub.Tags))
|
NotifyEvent n = new NotifyEvent()
|
||||||
{
|
{
|
||||||
NotifyEvent n = new NotifyEvent()
|
EventType = NotifyEventType.CustomerServiceImminent,
|
||||||
{
|
UserId = sub.UserId,
|
||||||
EventType = NotifyEventType.CustomerServiceImminent,
|
AyaType = proposedObj.AyaType,
|
||||||
UserId = sub.UserId,
|
ObjectId = proposedObj.Id,
|
||||||
AyaType = proposedObj.AyaType,
|
NotifySubscriptionId = sub.Id,
|
||||||
ObjectId = proposedObj.Id,
|
Name = oProposed.Serial.ToString(),
|
||||||
NotifySubscriptionId = sub.Id,
|
EventDate = (DateTime)oProposed.CompleteByDate
|
||||||
Name = oProposed.Serial.ToString(),
|
};
|
||||||
EventDate = (DateTime)oProposed.CompleteByDate
|
await ct.NotifyEvent.AddAsync(n);
|
||||||
};
|
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
||||||
await ct.NotifyEvent.AddAsync(n);
|
await ct.SaveChangesAsync();
|
||||||
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
|
||||||
await ct.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user