This commit is contained in:
@@ -87,13 +87,13 @@ There are no settings adjustable for in app General notifications, however Users
|
|||||||
| ScheduledOnWorkorder | User is scheduled on (added to) a Work order |
|
| ScheduledOnWorkorder | User is scheduled on (added to) a Work order |
|
||||||
| ScheduledOnWorkorderImminent | Scheduled date and time reached for workorder which User is scheduled |
|
| ScheduledOnWorkorderImminent | Scheduled date and time reached for workorder which User is scheduled |
|
||||||
| WorkorderCompletedStatusOverdue | Workorder not set to a "Completed" type Status before the selected duration from created date |
|
| WorkorderCompletedStatusOverdue | Workorder not set to a "Completed" type Status before the selected duration from created date |
|
||||||
| WorkorderCompleted | Service work order is set to any status that is flagged as a "Completed" type of status. (Customer and User notification) |
|
| WorkorderCompleted | Service work order is set to any status that is flagged as a "Completed" type of status. (Customer / HeadOffice or staff User notification) |
|
||||||
| OutsideServiceOverdue | An item sent for 3rd party service is overdue from projected repair time frame |
|
| OutsideServiceOverdue | An item sent for 3rd party service is overdue from projected repair time frame |
|
||||||
| OutsideServiceReceived | An item sent for 3rd party service has been received back |
|
| OutsideServiceReceived | An item sent for 3rd party service has been received back |
|
||||||
| PartRequestReceived | An out of stock part requested via a Workorder has been received |
|
| PartRequestReceived | An out of stock part requested via a Workorder has been received |
|
||||||
| NotifyHealthCheck | Automatic daily "ping" notification to confirm notification and Generator system is active at server |
|
| NotifyHealthCheck | Automatic daily "ping" notification to confirm notification and Generator system is active at server |
|
||||||
| BackupStatus | Result of last Backup operation at server |
|
| BackupStatus | Result of last Backup operation at server |
|
||||||
| CustomerServiceImminent | Scheduled service date / time is about to be reached. Intended for Customer type User |
|
| CustomerServiceReminder | Scheduled service date / time is about to be reached. (Customer or HeadOffice type users only) |
|
||||||
| WorkorderTotalExceedsThreshold | The balance of a Work order has exceeded a threshold (the "Andy") |
|
| WorkorderTotalExceedsThreshold | The balance of a Work order has exceeded a threshold (the "Andy") |
|
||||||
| WorkorderStatusAge | A Workorder has been sitting at the selected status for longer than the selected time frame |
|
| WorkorderStatusAge | A Workorder has been sitting at the selected status for longer than the selected time frame |
|
||||||
| UnitWarrantyExpiry | A Unit's warranty expiration date is reached |
|
| UnitWarrantyExpiry | A Unit's warranty expiration date is reached |
|
||||||
@@ -102,6 +102,6 @@ There are no settings adjustable for in app General notifications, however Users
|
|||||||
| ServerOperationsProblem | Any timely and serious issue related to internal AyaNova Server operations requiring attention |
|
| ServerOperationsProblem | Any timely and serious issue related to internal AyaNova Server operations requiring attention |
|
||||||
| QuoteStatusAge | A Quote has been sitting at the selected status for longer than the selected time frame |
|
| QuoteStatusAge | A Quote has been sitting at the selected status for longer than the selected time frame |
|
||||||
| CopyOfCustomerNotification | Copy of any notification sent to Customer for AyaNova User. Filterable by Customer Tag |
|
| CopyOfCustomerNotification | Copy of any notification sent to Customer for AyaNova User. Filterable by Customer Tag |
|
||||||
| WorkorderCreatedForCustomer | Customer notification sent when a service type work order is created for them |
|
| WorkorderCreatedForCustomer | Customer notification sent when a service type work order is created for them (or if HeadOffice Contact user, one of their Customers) |
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1083,7 +1083,7 @@ namespace AyaNova.Biz
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region CustomerServiceImminent
|
#region CustomerServiceImminent "Service Reminder"
|
||||||
if (ayaEvent == AyaEvent.Created && oProposed.ServiceDate != null && oProposed.ServiceDate > DateTime.UtcNow)
|
if (ayaEvent == AyaEvent.Created && oProposed.ServiceDate != null && oProposed.ServiceDate > DateTime.UtcNow)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1093,8 +1093,36 @@ namespace AyaNova.Biz
|
|||||||
//not for inactive users
|
//not for inactive users
|
||||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||||
|
|
||||||
//No tag match for this one
|
//Customer User?
|
||||||
|
var UserInfo = await ct.User.AsNoTracking().Where(x => x.Id == sub.UserId).Select(x => new { x.CustomerId, x.UserType, x.HeadOfficeId }).FirstOrDefaultAsync();
|
||||||
|
if (UserInfo.UserType == UserType.Customer || UserInfo.UserType == UserType.HeadOffice)
|
||||||
|
{
|
||||||
|
//CUSTOMER USER
|
||||||
|
|
||||||
|
//Quick short circuit: if workorder doesn't have a customer id then it's not going to match no matter what
|
||||||
|
if (oProposed.CustomerId == 0) continue;
|
||||||
|
|
||||||
|
var customerUserRights = await UserBiz.CustomerUserEffectiveRightsAsync(sub.UserId);
|
||||||
|
|
||||||
|
//Are they allowed right now to use this type of notification?
|
||||||
|
if (!customerUserRights.NotifyWOCreated) continue;
|
||||||
|
|
||||||
|
//is this their related work order?
|
||||||
|
if (UserInfo.CustomerId != oProposed.CustomerId)
|
||||||
|
{
|
||||||
|
//not the same customer but might be a head office user and this is one of their customers so check for that
|
||||||
|
if (UserInfo.HeadOfficeId == null) continue;//can't match any head office so no need to go further
|
||||||
|
|
||||||
|
//see if workorder customer's head office is the same id as the user's headofficeid (note that a customer user with the same head office as a *different* customer workorder doesn't qualify)
|
||||||
|
var CustomerInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == oProposed.CustomerId).Select(x => new { x.HeadOfficeId, x.BillHeadOffice }).FirstOrDefaultAsync();
|
||||||
|
if (!CustomerInfo.BillHeadOffice) continue;//can't possibly match so no need to go further
|
||||||
|
if (UserInfo.HeadOfficeId != CustomerInfo.HeadOfficeId) continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;//only customers can subscribe to this particular notification
|
||||||
|
|
||||||
|
//No tag match for this one
|
||||||
NotifyEvent n = new NotifyEvent()
|
NotifyEvent n = new NotifyEvent()
|
||||||
{
|
{
|
||||||
EventType = NotifyEventType.CustomerServiceImminent,
|
EventType = NotifyEventType.CustomerServiceImminent,
|
||||||
@@ -1111,10 +1139,10 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}//CustomerServiceImminent
|
}//CustomerServiceImminent "Service Reminder"
|
||||||
|
|
||||||
if (ayaEvent == AyaEvent.Modified)
|
if (ayaEvent == AyaEvent.Modified)
|
||||||
{// CustomerServiceImminent
|
{// CustomerServiceImminent "Service Reminder"
|
||||||
|
|
||||||
//differences requiring re-processing of notification
|
//differences requiring re-processing of notification
|
||||||
if (oProposed.ServiceDate != oCurrent.ServiceDate)
|
if (oProposed.ServiceDate != oCurrent.ServiceDate)
|
||||||
@@ -1131,6 +1159,35 @@ namespace AyaNova.Biz
|
|||||||
//not for inactive users
|
//not for inactive users
|
||||||
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
if (!await UserBiz.UserIsActive(sub.UserId)) continue;
|
||||||
|
|
||||||
|
//Customer User?
|
||||||
|
var UserInfo = await ct.User.AsNoTracking().Where(x => x.Id == sub.UserId).Select(x => new { x.CustomerId, x.UserType, x.HeadOfficeId }).FirstOrDefaultAsync();
|
||||||
|
if (UserInfo.UserType == UserType.Customer || UserInfo.UserType == UserType.HeadOffice)
|
||||||
|
{
|
||||||
|
//CUSTOMER USER
|
||||||
|
|
||||||
|
//Quick short circuit: if workorder doesn't have a customer id then it's not going to match no matter what
|
||||||
|
if (oProposed.CustomerId == 0) continue;
|
||||||
|
|
||||||
|
var customerUserRights = await UserBiz.CustomerUserEffectiveRightsAsync(sub.UserId);
|
||||||
|
|
||||||
|
//Are they allowed right now to use this type of notification?
|
||||||
|
if (!customerUserRights.NotifyWOCreated) continue;
|
||||||
|
|
||||||
|
//is this their related work order?
|
||||||
|
if (UserInfo.CustomerId != oProposed.CustomerId)
|
||||||
|
{
|
||||||
|
//not the same customer but might be a head office user and this is one of their customers so check for that
|
||||||
|
if (UserInfo.HeadOfficeId == null) continue;//can't match any head office so no need to go further
|
||||||
|
|
||||||
|
//see if workorder customer's head office is the same id as the user's headofficeid (note that a customer user with the same head office as a *different* customer workorder doesn't qualify)
|
||||||
|
var CustomerInfo = await ct.Customer.AsNoTracking().Where(x => x.Id == oProposed.CustomerId).Select(x => new { x.HeadOfficeId, x.BillHeadOffice }).FirstOrDefaultAsync();
|
||||||
|
if (!CustomerInfo.BillHeadOffice) continue;//can't possibly match so no need to go further
|
||||||
|
if (UserInfo.HeadOfficeId != CustomerInfo.HeadOfficeId) continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;//only customers can subscribe to this particular notification
|
||||||
|
|
||||||
//No tag match for this one
|
//No tag match for this one
|
||||||
NotifyEvent n = new NotifyEvent()
|
NotifyEvent n = new NotifyEvent()
|
||||||
{
|
{
|
||||||
@@ -1150,7 +1207,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}//CustomerServiceImminent
|
}//CustomerServiceImminent "Service Reminder"
|
||||||
|
|
||||||
//# WorkorderCreatedForCustomer - Customer / headoffice notification
|
//# WorkorderCreatedForCustomer - Customer / headoffice notification
|
||||||
if (oProposed.CustomerId != 0 && (ayaEvent == AyaEvent.Created
|
if (oProposed.CustomerId != 0 && (ayaEvent == AyaEvent.Created
|
||||||
|
|||||||
Reference in New Issue
Block a user