This commit is contained in:
2020-07-17 19:00:16 +00:00
parent a666eb8813
commit c0839f9d08
3 changed files with 42 additions and 6 deletions

View File

@@ -127,18 +127,52 @@ namespace AyaNova.Biz
switch (ayaEvent)
{
case AyaEvent.Created:
//------------------------------
//Specific created related subscriptions for AyaType
switch (newObject.AyaType)
{
//AyaTypes with their own special notification related events
case AyaType.WorkOrder:
{
//WorkorderStatusChange
//ScheduledOnWorkorder
//ScheduledOnWorkorderImminent
//tentative WorkorderCloseByPassed
//OutsideServiceOverdue
//OutsideServiceReceived
//PartRequestReceived
//CustomerServiceImminent
//PartRequested
//WorkorderTotalExceedsThreshold
//WorkorderStatusAge
}
break;
case AyaType.Quote:
//QuoteStatusChange
//QuoteStatusAge
break;
}
//-----------------------------------------------
//ObjectAge
{
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectAge && z.AyaType == newObject.AyaType).ToListAsync();
foreach (var sub in subs)
{
if (TagsMatch(newObject.Tags, sub.Tags))
{
NotifyEvent n = new NotifyEvent() {
EventType = NotifyEventType.ObjectAge, UserId = sub.UserId, AyaType = newObject.AyaType, ObjectId = newObject.Id,
SubscriptionId = sub.Id, EventDate=DateTime.UtcNow
};
await ct.NotifyEvent.AddAsync(n);
log.LogTrace($"Adding NotifyEvent: [{n.ToString()}]");
SaveContext = true;
}
}
}
//------------------------------------------
//General ObjectCreated subscriptions
{
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();