This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -48,7 +48,7 @@
|
||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
|
||||
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
vc.Clear();
|
||||
return ReportData;
|
||||
}
|
||||
}
|
||||
private VizCache vc = new VizCache();
|
||||
|
||||
//populate viz fields from provided object
|
||||
@@ -512,7 +512,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//CSR ACCEPTED
|
||||
if (!WasAccepted && o.Status == CustomerServiceRequestStatus.Accepted)//TAGS NOT RELEVANT
|
||||
if (!WasAccepted && o.Status == CustomerServiceRequestStatus.Accepted)//TAGS NOT RELEVANT because customer can't select them
|
||||
{
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRAccepted).ToListAsync();
|
||||
string SourceName = string.Empty;
|
||||
@@ -539,7 +539,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//CSR REJECTED
|
||||
if (!WasDeclined && o.Status == CustomerServiceRequestStatus.Declined)//TAGS NOT RELEVANT
|
||||
if (!WasDeclined && o.Status == CustomerServiceRequestStatus.Declined)//TAGS NOT RELEVANT customer can't select them for this
|
||||
{
|
||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.CSRRejected).ToListAsync();
|
||||
string SourceName = string.Empty;
|
||||
@@ -565,6 +565,74 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!WasAccepted && o.Status == CustomerServiceRequestStatus.Accepted)
|
||||
{
|
||||
//PROXY CUSTOMER NOTIFICATION SUBSCRIPTION HANDLING
|
||||
//CSR ACCEPTED
|
||||
//can this customer even be delivered to?
|
||||
var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.Active, x.Tags, x.EmailAddress }).FirstOrDefaultAsync();
|
||||
if (custInfo != null && custInfo.Active && !string.IsNullOrWhiteSpace(custInfo.EmailAddress))
|
||||
{
|
||||
var subs = await ct.CustomerNotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.CSRAccepted).OrderBy(z => z.Id).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//Object tags must match and Customer tags must match
|
||||
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(o.Tags, sub.Tags) && NotifyEventHelper.ObjectHasAllSubscriptionTags(custInfo.Tags, sub.CustomerTags))
|
||||
{
|
||||
CustomerNotifyEvent n = new CustomerNotifyEvent()
|
||||
{
|
||||
EventType = NotifyEventType.CSRAccepted,
|
||||
CustomerId = o.CustomerId,
|
||||
AyaType = AyaType.CustomerServiceRequest,
|
||||
ObjectId = o.Id,
|
||||
CustomerNotifySubscriptionId = sub.Id,
|
||||
Name = o.Name
|
||||
};
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!WasDeclined && o.Status == CustomerServiceRequestStatus.Declined)
|
||||
{
|
||||
//PROXY CUSTOMER NOTIFICATION SUBSCRIPTION HANDLING
|
||||
//CSR DECLINED
|
||||
//can this customer even be delivered to?
|
||||
var custInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == o.CustomerId).Select(x => new { x.Active, x.Tags, x.EmailAddress }).FirstOrDefaultAsync();
|
||||
if (custInfo != null && custInfo.Active && !string.IsNullOrWhiteSpace(custInfo.EmailAddress))
|
||||
{
|
||||
var subs = await ct.CustomerNotifySubscription.AsNoTracking().Where(z => z.EventType == NotifyEventType.CSRRejected).OrderBy(z => z.Id).ToListAsync();
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//Object tags must match and Customer tags must match
|
||||
if (NotifyEventHelper.ObjectHasAllSubscriptionTags(o.Tags, sub.Tags) && NotifyEventHelper.ObjectHasAllSubscriptionTags(custInfo.Tags, sub.CustomerTags))
|
||||
{
|
||||
|
||||
CustomerNotifyEvent n = new CustomerNotifyEvent()
|
||||
{
|
||||
EventType = NotifyEventType.CSRRejected,
|
||||
CustomerId = o.CustomerId,
|
||||
AyaType = AyaType.CustomerServiceRequest,
|
||||
ObjectId = o.Id,
|
||||
CustomerNotifySubscriptionId = sub.Id,
|
||||
Name = o.Name
|
||||
};
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//end of process notifications
|
||||
|
||||
|
||||
|
||||
@@ -1287,9 +1287,6 @@ namespace AyaNova.Biz
|
||||
//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();
|
||||
|
||||
|
||||
|
||||
foreach (var sub in subs)
|
||||
{
|
||||
//Object tags must match and Customer tags must match
|
||||
@@ -1303,9 +1300,7 @@ namespace AyaNova.Biz
|
||||
AyaType = AyaType.Quote,
|
||||
ObjectId = oProposed.QuoteId,
|
||||
CustomerNotifySubscriptionId = sub.Id,
|
||||
Name = QuoteInfo.Serial.ToString(),
|
||||
Subject="TEST SUBJECT",
|
||||
Message="TEST MESSAGE"//TODO: template processing here
|
||||
Name = QuoteInfo.Serial.ToString()
|
||||
};
|
||||
await ct.CustomerNotifyEvent.AddAsync(n);
|
||||
log.LogDebug($"Adding CustomerNotifyEvent: [{n.ToString()}]");
|
||||
|
||||
@@ -206,7 +206,15 @@ namespace AyaNova.Biz
|
||||
|
||||
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
|
||||
//generate report if applicable
|
||||
if (subscription.LinkReportId != null)
|
||||
bool isReportableEvent = false;
|
||||
switch (ne.EventType)
|
||||
{
|
||||
case NotifyEventType.QuoteStatusChange:
|
||||
case NotifyEventType.WorkorderCompleted:
|
||||
isReportableEvent = true;
|
||||
break;
|
||||
}
|
||||
if (isReportableEvent && subscription.LinkReportId != null)
|
||||
{
|
||||
long subTranslationId = (long)subscription.TranslationId;
|
||||
|
||||
@@ -269,7 +277,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
else
|
||||
await m.SendEmailAsync(deliveryAddress, ne.Subject, ne.Message, ServerGlobalOpsSettingsCache.Notify);
|
||||
await m.SendEmailAsync(deliveryAddress, Subject, Body, ServerGlobalOpsSettingsCache.Notify);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user