This commit is contained in:
@@ -41,7 +41,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Add event if there are subscribers
|
//Add event if there are subscribers
|
||||||
//several optional conditional parameters
|
//several optional conditional parameters
|
||||||
public static async Task UpsertEvent(NotifyEvent ev, List<string> inTags = null, long? IdValue=null,TimeSpan? AgeValue=null,decimal? DecValue=null)
|
public static async Task UpsertEvent(NotifyEvent ev, List<string> inTags = null, long? IdValue = null, TimeSpan? AgeValue = null, decimal? DecValue = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
log.LogTrace($"UpsertEvent processing: [{ev.ToString()}]");
|
log.LogTrace($"UpsertEvent processing: [{ev.ToString()}]");
|
||||||
@@ -60,10 +60,10 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//find all the subs that are relevant
|
//find all the subs that are relevant
|
||||||
//this first query ensures that the equality matching conditions of AyaType and EventType and idValue are matched leaving only more complex matches to rectify below
|
//this first query ensures that the equality matching conditions of AyaType and EventType and idValue are matched leaving only more complex matches to rectify below
|
||||||
var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == ev.EventType && z.AyaType == ev.AyaType && z.IdValue==ev.IdValue).ToListAsync();
|
var subs = await ct.NotifySubscription.AsNoTracking().Where(z => z.EventType == ev.EventType && z.AyaType == ev.AyaType && z.IdValue == ev.IdValue).ToListAsync();
|
||||||
foreach (var sub in subs)
|
foreach (var sub in subs)
|
||||||
{
|
{
|
||||||
//Final condition if tags are specified
|
//Tags condition
|
||||||
if (sub.Tags.Count > 0)
|
if (sub.Tags.Count > 0)
|
||||||
{
|
{
|
||||||
if (!HasTags)
|
if (!HasTags)
|
||||||
@@ -71,12 +71,20 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//bool existsCheck = list1.All(x => list2.Any(y => x.SupplierId == y.SupplierId));
|
//bool existsCheck = list1.All(x => list2.Any(y => x.SupplierId == y.SupplierId));
|
||||||
//would tell you if all of list1's items are in list2.
|
//would tell you if all of list1's items are in list2.
|
||||||
if(!sub.Tags.All(z=> inTags.Any(x=>x==z)))
|
if (!sub.Tags.All(z => inTags.Any(x => x == z)))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Decimal value, so far only for "The Andy" so the only condition is that the event value be greater than or equal to subscription setting
|
||||||
|
if (ev.EventType == NotifyEventType.WorkorderTotalExceedsThreshold && ev.DecValue < sub.DecValue)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//AgeValue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Here we know the sub matches so create the NotifyEvent here
|
//Here we know the sub matches so create the NotifyEvent here
|
||||||
NotifyEvent ne=new NotifyEvent(){};
|
NotifyEvent ne = new NotifyEvent() { };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user