This commit is contained in:
2022-03-07 20:12:13 +00:00
parent 73f8dbc3dc
commit 0ea991b8f3
2 changed files with 16 additions and 16 deletions

View File

@@ -1277,37 +1277,37 @@ namespace AyaNova.Biz
}
}//quote status change event
{
{
//PROXY CUSTOMER NOTIFICATION SUBSCRIPTION HANDLING
//can this customer even be delivered to?
var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == QuoteInfo.CustomerId).Select(x => new { x.Active, x.Tags, x.EmailAddress }).FirstOrDefaultAsync();
if (custInfo != null && custInfo.Active && !string.IsNullOrWhiteSpace(custInfo.EmailAddress))
{
{
//Conditions: must match specific status id value and also tags below
//delivery is immediate so no need to remove old ones of this kind
//note order by id ascending so that only the oldest notification "wins" as per docs in case of overlap to same customer
var subs = await ct.CustomerNotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.QuoteStatusChange && z.IdValue == oProposed.QuoteStatusId).OrderBy(z=>z.Id).ToListAsync();
var subs = await ct.CustomerNotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.QuoteStatusChange && z.IdValue == oProposed.QuoteStatusId).OrderBy(z => z.Id).ToListAsync();
foreach (var sub in subs)
{
//Object tags must match and Customer tags must match
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(QuoteInfo.Tags, sub.Tags) && NotifyEventHelper.ObjectHasAllSubscriptionTags(custInfo.Tags, sub.CustomerTags))
{
NotifyEvent n = new NotifyEvent()
CustomerNotifyEvent n = new CustomerNotifyEvent()
{
EventType = NotifyEventType.QuoteStatusChange,
UserId = sub.UserId,
CustomerId = QuoteInfo.CustomerId,
AyaType = AyaType.Quote,
ObjectId = oProposed.QuoteId,
NotifySubscriptionId = sub.Id,
CustomerNotifySubscriptionId = sub.Id,
Name = $"{QuoteInfo.Serial.ToString()} - {qos.Name}"
};
await ct.NotifyEvent.AddAsync(n);
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
await ct.CustomerNotifyEvent.AddAsync(n);
log.LogDebug($"Adding CustomerNotifyEvent: [{n.ToString()}]");
await ct.SaveChangesAsync();
break;//we have a match no need to process any further subs for this event
}

View File

@@ -22,16 +22,16 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 1342;
internal const long EXPECTED_INDEX_COUNT = 154;
internal const long EXPECTED_CHECK_CONSTRAINTS = 533;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 199;
internal const long EXPECTED_COLUMN_COUNT = 1353;
internal const long EXPECTED_INDEX_COUNT = 155;
internal const long EXPECTED_CHECK_CONSTRAINTS = 542;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 201;
internal const long EXPECTED_VIEWS = 11;
internal const long EXPECTED_ROUTINES = 2;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////// C1341:I154:CC532:FC199:V11:R2)
///////////////////////////////////////// (C1353:I155:CC542:FC201:V11:R2)
/*