This commit is contained in:
@@ -127,18 +127,52 @@ namespace AyaNova.Biz
|
|||||||
switch (ayaEvent)
|
switch (ayaEvent)
|
||||||
{
|
{
|
||||||
case AyaEvent.Created:
|
case AyaEvent.Created:
|
||||||
|
//------------------------------
|
||||||
//Specific created related subscriptions for AyaType
|
//Specific created related subscriptions for AyaType
|
||||||
switch (newObject.AyaType)
|
switch (newObject.AyaType)
|
||||||
{
|
{
|
||||||
//AyaTypes with their own special notification related events
|
//AyaTypes with their own special notification related events
|
||||||
|
|
||||||
|
|
||||||
case AyaType.WorkOrder:
|
case AyaType.WorkOrder:
|
||||||
|
{
|
||||||
|
//WorkorderStatusChange
|
||||||
|
//ScheduledOnWorkorder
|
||||||
|
//ScheduledOnWorkorderImminent
|
||||||
|
//tentative WorkorderCloseByPassed
|
||||||
|
//OutsideServiceOverdue
|
||||||
|
//OutsideServiceReceived
|
||||||
|
//PartRequestReceived
|
||||||
|
//CustomerServiceImminent
|
||||||
|
//PartRequested
|
||||||
|
//WorkorderTotalExceedsThreshold
|
||||||
|
//WorkorderStatusAge
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AyaType.Quote:
|
case AyaType.Quote:
|
||||||
|
//QuoteStatusChange
|
||||||
|
//QuoteStatusAge
|
||||||
break;
|
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
|
//General ObjectCreated subscriptions
|
||||||
{
|
{
|
||||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();
|
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ namespace AyaNova.Models
|
|||||||
public decimal DecValue { get; set; }
|
public decimal DecValue { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public TimeSpan AgeValue { get; set; }
|
public TimeSpan AgeValue { get; set; }
|
||||||
public DateTime? EventDate { get; set; }//date of the event actually occuring, e.g. WarrantyExpiry date. Duped with delivery date as source of truth in case edit to advance setting in subscription changes delivery date
|
//date of the event actually occuring, e.g. WarrantyExpiry date. Compared with subscription to determine if deliverable or not
|
||||||
public DateTime? DeliverDate { get; set; }//date user wants the event notification delivered, usually same as event date but could be set earlier if Advance setting in effect. This is the date consulted for delivery only.
|
public DateTime? EventDate { get; set; }
|
||||||
|
//NO: Delivery code consults subscription instead of this
|
||||||
|
// public DateTime? DeliverDate { get; set; }//date user wants the event notification delivered, usually same as event date but could be set earlier if Advance setting in effect. This is the date consulted for delivery only.
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Util
|
|||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
private const int DESIRED_SCHEMA_LEVEL = 12;
|
private const int DESIRED_SCHEMA_LEVEL = 12;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 382;
|
internal const long EXPECTED_COLUMN_COUNT = 381;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 139;
|
internal const long EXPECTED_INDEX_COUNT = 139;
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
@@ -690,7 +690,7 @@ $BODY$;
|
|||||||
|
|
||||||
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
|
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
|
||||||
"ayatype integer not null, objectid bigint not null, eventtype integer not null, subscriptionid bigint not null, userid bigint not null, " +
|
"ayatype integer not null, objectid bigint not null, eventtype integer not null, subscriptionid bigint not null, userid bigint not null, " +
|
||||||
"idvalue bigint not null, decvalue decimal(19,4) not null, agevalue interval not null, eventdate timestamp, deliverdate timestamp, message text)");
|
"idvalue bigint not null, decvalue decimal(19,4) not null, agevalue interval not null, eventdate timestamp, message text)");
|
||||||
|
|
||||||
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, " +
|
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, " +
|
||||||
"created timestamp not null, ayatype integer not null, objectid bigint not null, eventtype integer not null, " +
|
"created timestamp not null, ayatype integer not null, objectid bigint not null, eventtype integer not null, " +
|
||||||
|
|||||||
Reference in New Issue
Block a user