This commit is contained in:
2020-07-17 00:12:19 +00:00
parent bfb64dffc6
commit 7019464a04

View File

@@ -117,7 +117,7 @@ namespace AyaNova.Biz
log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{ayaType}, AyaEvent:{ayaEvent}]");
try
{
// var HasTags = inTags != null && inTags.Count > 0;
using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
{
@@ -125,8 +125,33 @@ namespace AyaNova.Biz
switch (ayaEvent)
{
case AyaEvent.Created:
switch (ayaType)
{
//AyaTypes with their own special notification related events
case AyaType.WorkOrder:
break;
case AyaType.Quote:
break;
}
//ObjectCreated subscriptions
{
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == ayaType).ToListAsync();
foreach (var sub in subs)
{
NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType=ayaType,ObjectId=newObject.id, SubscriptionId = sub.Id };
await ct.NotifyEvent.AddAsync(n);
}
if (subs.Count > 0)
await ct.SaveChangesAsync();
}
break;
case AyaEvent.Modified:
break;
case AyaEvent.Deleted:
break;
default: