This commit is contained in:
2022-03-09 15:13:37 +00:00
parent 8645463641
commit 66c059beeb
8 changed files with 45 additions and 322 deletions

View File

@@ -155,35 +155,37 @@ There are no settings adjustable for in-app General notifications, they are buil
The following table shows the types of notification events currently available for subscription.
| EVENT | DESCRIPTION |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Object deleted | Deletion of core business object of selected type and tags |
| Object created | Creation of core business object of selected type and tags |
| Object modified | Any changes and saving of core business object of selected type and tags |
| Work order status change | Any _change_ of Workorder Status including from no status (new) to a _specific_ selected status ID value |
| Contract expiring | Contract expiration |
| CSR accepted | Customer service request accepted. (intended for Customer users) |
| CSR rejected | Customer service request rejected. (intended for Customer users) |
| Quote status change | Any _change_ of Quote Status including from no status (new) to a _specific_ selected status ID value |
| Object age | Any object, Age (conditional on AgeValue) after creation event of any object of selected specific type and optionally selected tags |
| Reminder imminent | A Reminder is about to reach it's specified start date/time |
| Review imminent | A Review is about to reach it's specified review date/time |
| Scheduled on work order | User is scheduled on (added to) a Work order |
| Scheduled on work order imminent | Scheduled date and time reached for workorder which User is scheduled |
| Work order completed status overdue | Workorder not set to a "Completed" type Status before the selected duration from created date |
| Work order completed | Service work order is set to any status that is flagged as a "Completed" type of status. (Customer / HeadOffice or staff User notification) |
| Outside service overdue | Unit sent for 3rd party service is overdue |
| Outside service received | Unit sent for 3rd party service has been received back |
| Part request received | Part requested via a Workorder has been received |
| Notify health check | Automatic daily "ping" notification to confirm notification and Generator system is active at server |
| Backup status | Result of last automated backup |
| Customer service reminder | Scheduled service date / time is about to be reached. (Customer or HeadOffice type users only) |
| Work order total exceeds threshold | The balance of a Work order has exceeded a threshold and is set to completed status (the "Andy") |
| Workorder status age | A Workorder has been sitting at the selected status for longer than the selected time frame |
| Unit warranty expiry | A Unit's warranty expiration date is reached |
| Unit meter reading multiple exceeded | A meter reading entry has a difference from the last reading by the selected amount (negative OR positive to cover count _down_ meters or rollover / reset meters, can tag filter by Unit tag) |
| General notification | Any general notification including direct text notifications between users (built in but provided for email alternative delivery) |
| Server operations problem | Any timely and serious issue related to internal AyaNova Server operations requiring attention |
| Quote status age | A Quote has been sitting at the selected status for longer than the selected time frame |
| Copy of customer notification | Copy of any notification sent to Customer for AyaNova User. Filterable by Customer Tag |
| Work order created for customer | Customer notification sent when a service type work order is created for them (or if HeadOffice Contact user, one of their Customers) |
| EVENT | DESCRIPTION |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Backup status | Result of last automated backup |
| Contract expiring | Contract expiration |
| CSR accepted | Customer service request accepted. (intended for Customer users) |
| CSR rejected | Customer service request rejected. (intended for Customer users) |
| Customer service reminder | Scheduled service date / time is about to be reached. (Customer or HeadOffice type users only) |
| General notification | Any general notification including direct text notifications between users (built in but provided for email alternative delivery) |
| Notify health check | Automatic daily "ping" notification to confirm notification and Generator system is active at server |
| Object age | Any object, Age (conditional on AgeValue) after creation event of any object of selected specific type and optionally selected tags |
| Object created | Creation of core business object of selected type and tags |
| Object deleted | Deletion of core business object of selected type and tags |
| Object modified | Any changes and saving of core business object of selected type and tags |
| Outside service overdue | Unit sent for 3rd party service is overdue |
| Outside service received | Unit sent for 3rd party service has been received back |
| Part request received | Part requested via a Workorder has been received |
| Preventive Maintenance insufficient inventory | Upcoming P.M. order will not have enough inventory to generate without making a part request |
| Preventive Maintenance stop generating date reached | P.M.'s "Stop generating" date has been reached |
| Preventive Maintenance workorder generation failed | Error generating a work order from a P.M. order |
| Quote status age | A Quote has been sitting at the selected status for longer than the selected time frame |
| Quote status change | Any _change_ of Quote Status including from no status (new) to a _specific_ selected status ID value |
| Reminder imminent | A Reminder is about to reach it's specified start date/time |
| Review imminent | A Review is about to reach it's specified review date/time |
| Scheduled on work order | User is scheduled on (added to) a Work order |
| Scheduled on work order imminent | Scheduled date and time reached for workorder which User is scheduled |
| Server operations problem | Any timely and serious issue related to internal AyaNova Server operations requiring attention |
| Unit meter reading multiple exceeded | A meter reading entry has a difference from the last reading by the selected amount (negative OR positive to cover count _down_ meters or rollover / reset meters, can tag filter by Unit tag) |
| Unit warranty expiry | A Unit's warranty expiration date is reached |
| Work order completed | Service work order is set to any status that is flagged as a "Completed" type of status. (Customer / HeadOffice or staff User notification) |
| Work order completed status overdue | Workorder not set to a "Completed" type Status before the selected duration from created date |
| Work order created for customer | Customer notification sent when a service type work order is created for them (or if HeadOffice Contact user, one of their Customers) |
| Work order status change | Any _change_ of Workorder Status including from no status (new) to a _specific_ selected status ID value |
| Work order total exceeds threshold | The balance of a Work order has exceeded a threshold and is set to completed status (the "Andy") |
| Workorder status age | A Workorder has been sitting at the selected status for longer than the selected time frame |

View File

@@ -462,7 +462,7 @@ namespace AyaNova.Api.Controllers
TranslationKeysToFetch.Add("NotifyEventUnitMeterReadingMultipleExceeded");
TranslationKeysToFetch.Add("NotifyEventServerOperationsProblem");
TranslationKeysToFetch.Add("NotifyEventGeneralNotification");
TranslationKeysToFetch.Add("NotifyEventCopyOfCustomerNotification");
//TranslationKeysToFetch.Add("NotifyEventCopyOfCustomerNotification");
TranslationKeysToFetch.Add("NotifyEventWorkorderCreatedForCustomer");
TranslationKeysToFetch.Add("NotifyEventPMGenerationFailed");
TranslationKeysToFetch.Add("NotifyEventPMInsufficientInventory");
@@ -501,7 +501,7 @@ namespace AyaNova.Api.Controllers
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventServerOperationsProblem"], Id = (long)NotifyEventType.ServerOperationsProblem });
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventGeneralNotification"], Id = (long)NotifyEventType.GeneralNotification });
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventCopyOfCustomerNotification"], Id = (long)NotifyEventType.CopyOfCustomerNotification });
// ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventCopyOfCustomerNotification"], Id = (long)NotifyEventType.CopyOfCustomerNotification });
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderCreatedForCustomer"], Id = (long)NotifyEventType.WorkorderCreatedForCustomer });
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventPMGenerationFailed"], Id = (long)NotifyEventType.PMGenerationFailed });

View File

@@ -404,283 +404,3 @@ namespace AyaNova.Biz
}//eoc
}//eons
//###DEPRECATED: MOVED EVENT PROCESSING INTO BIZ OBJECTS BUT
// //SPLIT INTO STANDARD EVENT PROCESSING METHODS BELOW
// //AND ANYTHING TYPE SPECIFIC IS IN BIZ OBJECT ITSELF
// //KEEPING THIS AS IT HAS SOME IMPLEMENTATION NOTES IN IT
// //This is told about an event and then determines if there are any subscriptions related to that event and proceses them accordingly
// //todo: this should take some kind of general event type like the AyaEvent types (i.e. which CRUD operation is in effect if relevant)
// //and also a biz object before and after or just before if not a change and also a AyaType
// //then *this* code will go through and look for subscriptions related to that event
// //this way the biz object code can be "dumb" about notifications in general and just let this code handle it as needed
// //will iterate the subscriptions and see if any apply here
// internal static async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel newObject, ICoreBizObjectModel originalObject = null)
// {
// if(ServerBootConfig.SEEDING || ServerBootConfig.MIGRATING) return;
// log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{newObject.AyaType}, AyaEvent:{ayaEvent}]");
// //set to true if any changes are made to the context (NotifyEvent added)
// bool SaveContext = false;
// try
// {
// using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext)
// {
// //short circuit if there are no subscriptions which would be typical of a v8 migrate scenario or fresh import or just not using notification
// if (!await ct.NotifySubscription.AnyAsync())
// return;
// //switch through AyaEvent then individual Ayatypes as required for event types
// switch (ayaEvent)
// {
// case AyaEvent.Created:
// #region Created processing
// //------------------------------
// // AyaType Specific created related subscriptions
// // Note: these are for specific things only in this block
// // generally being created notifications are further down below
// switch (newObject.AyaType)
// {
// //AyaTypes with their own special notification related events
// case AyaType.WorkOrder:
// {
// //WorkorderStatusChange
// {
// throw new System.NotImplementedException("Awaiting workorder object completion");
// var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.WorkorderStatusChange).ToListAsync();
// foreach (var sub in subs)
// {
// if (TagsMatch(newObject.Tags, sub.Tags))
// {
// NotifyEvent n = new NotifyEvent()
// {
// EventType = NotifyEventType.ObjectAge,
// UserId = sub.UserId,
// ObjectId = newObject.Id,
// NotifySubscriptionId = sub.Id,
// //TODO: IdValue=((WorkOrder)newObject).WorkorderStatusId
// Name = newObject.Name
// };
// await ct.NotifyEvent.AddAsync(n);
// log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
// //Note: in same event but for MODIFY below if need to delete old notifyevent here
// // var deleteEventList = await ct.NotifyEvent.Where(z => z.ObjectId == ev.ObjectId && z.AyaType == ev.AyaType).ToListAsync();
// // ct.NotifyEvent.RemoveRange(deleteEventList);
// SaveContext = true;
// }
// }
// }
// //ScheduledOnWorkorder https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //ScheduledOnWorkorderImminent https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //WorkorderCompletedStatusOverdue
// //WorkorderCompleted [USER, CUSTOMER], if customer then also CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //OutsideServiceOverdue
// //OutsideServiceReceived https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //PartRequestReceived https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //CustomerServiceImminent ALSO CopyOfCustomerNotification
// //WorkorderCreatedForCustomer (conditional ID sb customer id) ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //PartRequested https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //WorkorderTotalExceedsThreshold
// //WorkorderStatusAge
// }
// break;
// case AyaType.Quote:
// //QuoteStatusChange [USER, CUSTOMER] / ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //QuoteStatusAge
// break;
// case AyaType.Contract:
// //ContractExpiring [CUSTOMER/USER] / ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// break;
// case AyaType.Reminder:
// //ReminderImminent
// break;
// case AyaType.Unit:
// //UnitWarrantyExpiry
// break;
// case AyaType.UnitMeterReading:
// //UnitMeterReadingMultipleExceeded
// break;
// }
// //------------------------------------------
// //ObjectCreated
// //
// // [USER for any type, CUSTOMER for workorder only] / if customer then CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// // {
// // }
// #endregion created processing
// break;
// case AyaEvent.Modified:
// #region Modified processing
// //######## NOTE: be sure to remove any that are being replaced potentially
// //------------------------------
// // AyaType Specific modified related subscriptions
// //
// switch (newObject.AyaType)
// {
// //AyaTypes with their own special notification related events
// case AyaType.WorkOrder:
// {
// //WorkorderStatusChange [USER, CUSTOMER BOTH] / CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //
// {
// throw new System.NotImplementedException("Awaiting workorder object completion");
// // if (((WorkOrder)newObject).WorkorderStatusId != ((WorkOrder)dbObject).WorkorderStatusId)
// // {
// // var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.WorkorderStatusChange).ToListAsync();
// // foreach (var sub in subs)
// // {
// // if (TagsMatch(newObject.Tags, sub.Tags))
// // {
// // NotifyEvent n = new NotifyEvent()
// // {
// // EventType = NotifyEventType.ObjectAge,
// // UserId = sub.UserId,
// // ObjectId = newObject.Id,
// // NotifySubscriptionId = sub.Id,
// // //TODO: IdValue=((WorkOrder)newObject).WorkorderStatusId
// // EventDate = DateTime.UtcNow,
// //Name=newObject.Name
// //,
// // Name=newObject.Name
// // };
// // await ct.NotifyEvent.AddAsync(n);
// // log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
// // //Note: in same event but for MODIFY below if need to delete old notifyevent here
// // // var deleteEventList = await ct.NotifyEvent.Where(z => z.ObjectId == ev.ObjectId && z.AyaType == ev.AyaType).ToListAsync();
// // // ct.NotifyEvent.RemoveRange(deleteEventList);
// // SaveContext = true;
// // }
// // }
// // }
// }
// //ScheduledOnWorkorder (DELETE OLD, USER / DATE COULD CHANGE)
// //https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //ScheduledOnWorkorderImminent (DELTE OLD)
// //https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //WorkorderCompletedStatusOverdue (DELETE OLD)
// //WorkorderCompleted [USER, CUSTOMER] ALSO CopyOfCustomerNotification applies here https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //OutsideServiceOverdue (ALSO DELETE OLD)
// //OutsideServiceReceived
// //PartRequestReceived
// //CustomerServiceImminent (ALSO DELETE OLD) / ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //PartRequested
// //https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/892
// //WorkorderTotalExceedsThreshold
// //WorkorderStatusAge (ALSO DELETE OLD)
// //https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/1137
// //WorkorderCompletedFollowUp (uses AGE after Completed status) [USER]
// }
// break;
// case AyaType.Quote:
// //QuoteStatusChange [USER, CUSTOMER] ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //QuoteStatusAge (DELETE OLD)
// break;
// case AyaType.Contract:
// //ContractExpiring (DELETE OLD)
// break;
// case AyaType.Reminder:
// //ReminderImminent (DELETE OLD)
// break;
// case AyaType.Unit:
// //UnitWarrantyExpiry (DELETE OLD)
// break;
// case AyaType.UnitMeterReading:
// //UnitMeterReadingMultipleExceeded
// //case 1254
// // This is as a threshold multiple value, i.e. if it's passing a multiple of 50,000 then notify, or notify every 10,000 or something.
// // In saving code it just checks to see if it has crossed the multiple threshold, i.e. calculate the old multiple, calculate the new multiple if over then send notification immediate.
// break;
// case AyaType.CustomerServiceRequest:
// //CSRAccepted (DELETE OLD might have changed from one to the other) [CUSTOMER] ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// //CSRRejected (DELETE OLD might have changed from one to the other) [CUSTOMER] ALSO CopyOfCustomerNotification https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/3398
// break;
// case AyaType.ServiceBank:
// //ServiceBankDepleted https://rockfish.ayanova.com/default.htm#!/rfcaseEdit/472
// break;
// }
// //------------------------------------------
// //ObjectModified
// //
// // {
// // var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectModified && z.AyaType == newObject.AyaType).ToListAsync();
// // foreach (var sub in subs)
// // {
// // if (TagsMatch(newObject.Tags, sub.Tags))
// // {
// // NotifyEvent n = new NotifyEvent()
// // {
// // EventType = NotifyEventType.ObjectModified,
// // UserId = sub.UserId,
// // AyaType = newObject.AyaType,
// // ObjectId = newObject.Id,
// // NotifySubscriptionId = sub.Id,
// // Name = newObject.Name
// // };
// // await ct.NotifyEvent.AddAsync(n);
// // log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
// // SaveContext = true;
// // }
// // }
// // }
// #endregion modified processing
// break;
// case AyaEvent.Deleted:
// #region Deleted processing
// //------------------------------
// // Delete any NotifyEvent records for this exact object
// await ProcessStandardObjectDeletedEvents(newObject, ct);
// #endregion deleted processing
// break;
// default:
// #if (DEBUG)
// throw (new System.NotSupportedException($"NotifyEventProcessor:HandlePotentialNotificationEvent - AyaEvent {ayaEvent} was specified which is unexpected and not supported"));
// #else
// break;
// #endif
// }
// if (SaveContext)
// await ct.SaveChangesAsync();
// }
// }
// catch (Exception ex)
// {
// log.LogError(ex, $"Error processing event");
// }
// finally
// {
// log.LogDebug($"Notify event processing completed");
// }
// }//eom

View File

@@ -18,7 +18,13 @@ namespace AyaNova.Biz
ContractExpiring = 5,//* Contract object, aged notification with optional advance notice for expiration date of contract. Customer version and User version deliveries possible.
CSRAccepted = 6,//*CustomerServiceRequest object, saved with ACCEPTED status, delivered to Customer only
CSRRejected = 7,//*CustomerServiceRequest object, saved with REJECTED status, delivered to Customer only
CopyOfCustomerNotification = 8,//*User notification of what was sent to a Customer as a notification. In other words can subscribe to any customer notifications and be sent a copy of them. Tag filter is based on Customer's tags for this one so user can choose which customer group to subscribe to this or all.
//decided against this for initial release but kept the translation keys and event type here and commented out in enumlistcontroller
//CopyOfCustomerNotification = 8,//XXXXX*User notification of what was sent to a Customer as a notification. In other words can subscribe to any customer notifications and be sent a copy of them. Tag filter is based on Customer's tags for this one so user can choose which customer group to subscribe to this or all.
// "NotifyEventCopyOfCustomerNotification": "Kopie der Kundenbenachrichtigung",
// "NotifyEventCopyOfCustomerNotification": "Copy of Customer notification",
// "NotifyEventCopyOfCustomerNotification": "Copia de la notificación al cliente",
// "NotifyEventCopyOfCustomerNotification": "Copie de la notification client",
//
QuoteStatusChange = 9,//* Quote object, any *change* of status including from no status (new) to a specific conditional status ID value
ObjectAge = 10,//* Any object, Age (conditional on AgeValue) after creation event of any object of conditional specific AyaType and optionally conditional tags
PMInsufficientInventory = 11,//Upcoming PM will not have enough inventory to generate without making a part request
@@ -43,11 +49,10 @@ namespace AyaNova.Biz
WorkorderCompleted = 30, //*Service work order is set to any status that is flagged as a "Completed" type of status. Customer & User (Note this is for users that don't want or can't pick status change to completed type)
WorkorderCreatedForCustomer = 31, //*Service work order is created for Customer, only applies to that customer user notify sub for that customer, customer id is in conditional ID value for subscription
PMGenerationFailed = 32, //indicates there was a failure during PM generation with error
SendUserCredentials = 33, // Internal System use only: When user generates new credentials and sends them this is the notification type for that see UserBiz GenerateCredsAndEmailUser
//SendUserCredentials = 33, //XXXXXXX Internal System use only: When user generates new credentials and sends them this is the notification type for that see UserBiz GenerateCredsAndEmailUser
ReviewImminent = 34,//*Review object, Advance notice setting tag conditional
//POTENTIAL OTHER NOTIFICATIONS:
//WorkOrderItemLoan unit is overdue from estimate
//NEW ITEMS REQUIRE translation KEYS

View File

@@ -611,7 +611,6 @@
"NotifyDeliveryMethodSMTP": "An E-Mail-Adresse liefern",
"NotifyEventBackupStatus": "Status der Sicherung",
"NotifyEventContractExpiring": "Vertrag läuft aus",
"NotifyEventCopyOfCustomerNotification": "Kopie der Kundenbenachrichtigung",
"NotifyEventCSRAccepted": "Kundendienstanfrage angenommen",
"NotifyEventCSRRejected": "Kundendienstanfrage abgelehnt",
"NotifyEventCustomerServiceImminent": "Servicetermin",

View File

@@ -611,7 +611,6 @@
"NotifyDeliveryMethodSMTP": "Deliver to email address",
"NotifyEventBackupStatus": "Backup status",
"NotifyEventContractExpiring": "Contract expiring",
"NotifyEventCopyOfCustomerNotification": "Copy of Customer notification",
"NotifyEventCSRAccepted": "Customer service request accepted",
"NotifyEventCSRRejected": "Customer service request rejected",
"NotifyEventCustomerServiceImminent": "Service reminder",

View File

@@ -611,7 +611,6 @@
"NotifyDeliveryMethodSMTP": "Entregar a la dirección de correo electrónico",
"NotifyEventBackupStatus": "Estado de copia de seguridad",
"NotifyEventContractExpiring": "Vencimiento del contrato",
"NotifyEventCopyOfCustomerNotification": "Copia de la notificación al cliente",
"NotifyEventCSRAccepted": "Solicitud de servicio al cliente aceptada",
"NotifyEventCSRRejected": "Solicitud de servicio al cliente rechazada",
"NotifyEventCustomerServiceImminent": "Cita de servicio",

View File

@@ -611,7 +611,6 @@
"NotifyDeliveryMethodSMTP": "Livrer à l'adresse e-mail",
"NotifyEventBackupStatus": "Statut de sauvegarde",
"NotifyEventContractExpiring": "Contrat expirant",
"NotifyEventCopyOfCustomerNotification": "Copie de la notification client",
"NotifyEventCSRAccepted": "Demande de service client acceptée",
"NotifyEventCSRRejected": "Demande de service client rejetée",
"NotifyEventCustomerServiceImminent": "Rendez-vous de service",