This commit is contained in:
@@ -5,7 +5,7 @@ Notifications are kept for 90 days then automatically deleted.
|
|||||||
|
|
||||||
Notes for docs / items to cover
|
Notes for docs / items to cover
|
||||||
- TAG changes on work order header and Workorder related notifications for *descendants* on work orders.
|
- TAG changes on work order header and Workorder related notifications for *descendants* on work orders.
|
||||||
Most work order descendant notifications will use the Work order header tags for comparison with their notification setting with the exception of descendants that have their own Tags (Work order items and Work order item Units are currently the only descendants with their own tags).
|
Most work order descendant notifications will use the Work order header tags for comparison with their notification setting with the exception of descendants that have their own Tags (Work order items and Work order item Units are currently the only descendants with their own tags).
|
||||||
|
|
||||||
For all other descendants, they will process notifications and filter by tag against the work order header tags in place at the moment they are saved after creation or update *only*.
|
For all other descendants, they will process notifications and filter by tag against the work order header tags in place at the moment they are saved after creation or update *only*.
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ using AyaNova.Api.ControllerHelpers;
|
|||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
internal class CustomerNoteBiz : BizObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject
|
internal class CustomerNoteBiz : BizObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, INotifiableObject
|
||||||
{
|
{
|
||||||
internal CustomerNoteBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
internal CustomerNoteBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
||||||
{
|
{
|
||||||
@@ -257,6 +258,28 @@ namespace AyaNova.Biz
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// NOTIFICATION PROCESSING
|
||||||
|
//
|
||||||
|
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
|
||||||
|
{
|
||||||
|
if (ServerBootConfig.SEEDING) return;
|
||||||
|
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<ProjectBiz>();
|
||||||
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
|
bool isNew = currentObj == null;
|
||||||
|
var oProposed = (CustomerNote)proposedObj;
|
||||||
|
oProposed.CustomerViz = await ct.Customer.AsNoTracking().Where(x => x.Id == oProposed.CustomerId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
proposedObj.Name = oProposed.CustomerViz;
|
||||||
|
|
||||||
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
|
|
||||||
|
}//end of process notifications
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//JOB / OPERATIONS
|
//JOB / OPERATIONS
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -810,6 +810,9 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
var p = (PurchaseOrder)proposedObj;
|
||||||
|
proposedObj.Name = p.Serial.ToString();
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
@@ -818,7 +821,7 @@ namespace AyaNova.Biz
|
|||||||
//CREATED / MODIFIED
|
//CREATED / MODIFIED
|
||||||
if (ayaEvent == AyaEvent.Created || ayaEvent == AyaEvent.Modified)
|
if (ayaEvent == AyaEvent.Created || ayaEvent == AyaEvent.Modified)
|
||||||
{
|
{
|
||||||
var p = (PurchaseOrder)proposedObj;
|
|
||||||
var c = (PurchaseOrder)currentObj;
|
var c = (PurchaseOrder)currentObj;
|
||||||
|
|
||||||
//# PartRequestReceived
|
//# PartRequestReceived
|
||||||
|
|||||||
@@ -479,12 +479,14 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
Unit o = (Unit)proposedObj;
|
||||||
|
o.Name = o.Serial;
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
Unit o = (Unit)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
//## DELETED EVENTS
|
||||||
//any event added below needs to be removed, so
|
//any event added below needs to be removed, so
|
||||||
|
|||||||
@@ -981,12 +981,14 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
WorkOrder oProposed = (WorkOrder)proposedObj;
|
||||||
|
proposedObj.Name = oProposed.Serial.ToString();
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);//Note: will properly handle all delete events and event removal if deleted
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);//Note: will properly handle all delete events and event removal if deleted
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrder oProposed = (WorkOrder)proposedObj;
|
|
||||||
WorkOrder oCurrent = null;
|
WorkOrder oCurrent = null;
|
||||||
bool SameTags = true;
|
bool SameTags = true;
|
||||||
if (currentObj != null)
|
if (currentObj != null)
|
||||||
@@ -1779,12 +1781,17 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
WorkOrderItem oProposed = (WorkOrderItem)proposedObj;
|
||||||
|
|
||||||
|
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderId, ct);
|
||||||
|
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
||||||
|
oProposed.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrderItem o = (WorkOrderItem)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
//## DELETED EVENTS
|
||||||
//any event added below needs to be removed, so
|
//any event added below needs to be removed, so
|
||||||
@@ -2124,29 +2131,18 @@ namespace AyaNova.Biz
|
|||||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
WorkOrderItemExpense oProposed = (WorkOrderItemExpense)proposedObj;
|
||||||
|
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderItemId, ct);
|
||||||
|
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
||||||
|
oProposed.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
oProposed.Tags = WorkorderInfo.Tags;
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrderItemExpense o = (WorkOrderItemExpense)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
|
||||||
//any event added below needs to be removed, so
|
|
||||||
//just blanket remove any event for this object of eventtype that would be added below here
|
|
||||||
//do it regardless any time there's an update and then
|
|
||||||
//let this code below handle the refreshing addition that could have changes
|
|
||||||
// await NotifyEventHelper.ClearPriorEventsForObject(ct, proposedObj.AyaType, o.Id, NotifyEventType.ContractExpiring);
|
|
||||||
|
|
||||||
|
|
||||||
//## CREATED / MODIFIED EVENTS
|
|
||||||
if (ayaEvent == AyaEvent.Created || ayaEvent == AyaEvent.Modified)
|
|
||||||
{
|
|
||||||
|
|
||||||
//todo: fix etc, tons of shit here incoming
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end of process notifications
|
}//end of process notifications
|
||||||
#endregion work order item EXPENSE level
|
#endregion work order item EXPENSE level
|
||||||
@@ -2616,29 +2612,18 @@ namespace AyaNova.Biz
|
|||||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
WorkOrderItemLabor oProposed = (WorkOrderItemLabor)proposedObj;
|
||||||
|
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderItemId, ct);
|
||||||
|
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
||||||
|
oProposed.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
oProposed.Tags = WorkorderInfo.Tags;
|
||||||
|
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrderItemLabor o = (WorkOrderItemLabor)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
|
||||||
//any event added below needs to be removed, so
|
|
||||||
//just blanket remove any event for this object of eventtype that would be added below here
|
|
||||||
//do it regardless any time there's an update and then
|
|
||||||
//let this code below handle the refreshing addition that could have changes
|
|
||||||
// await NotifyEventHelper.ClearPriorEventsForObject(ct, proposedObj.AyaType, o.Id, NotifyEventType.ContractExpiring);
|
|
||||||
|
|
||||||
|
|
||||||
//## CREATED / MODIFIED EVENTS
|
|
||||||
if (ayaEvent == AyaEvent.Created || ayaEvent == AyaEvent.Modified)
|
|
||||||
{
|
|
||||||
|
|
||||||
//todo: fix etc, tons of shit here incoming
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end of process notifications
|
}//end of process notifications
|
||||||
|
|
||||||
@@ -2995,29 +2980,16 @@ namespace AyaNova.Biz
|
|||||||
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]");
|
||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
WorkOrderItemLoan oProposed = (WorkOrderItemLoan)proposedObj;
|
||||||
|
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderItemId, ct);
|
||||||
|
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
||||||
|
oProposed.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
oProposed.Tags = WorkorderInfo.Tags;
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrderItemLoan o = (WorkOrderItemLoan)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
|
||||||
//any event added below needs to be removed, so
|
|
||||||
//just blanket remove any event for this object of eventtype that would be added below here
|
|
||||||
//do it regardless any time there's an update and then
|
|
||||||
//let this code below handle the refreshing addition that could have changes
|
|
||||||
// await NotifyEventHelper.ClearPriorEventsForObject(ct, proposedObj.AyaType, o.Id, NotifyEventType.ContractExpiring);
|
|
||||||
|
|
||||||
|
|
||||||
//## CREATED / MODIFIED EVENTS
|
|
||||||
if (ayaEvent == AyaEvent.Created || ayaEvent == AyaEvent.Modified)
|
|
||||||
{
|
|
||||||
|
|
||||||
//todo: fix etc, tons of shit here incoming
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}//end of process notifications
|
}//end of process notifications
|
||||||
|
|
||||||
@@ -3314,18 +3286,19 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
bool isNew = currentObj == null;
|
bool isNew = currentObj == null;
|
||||||
|
|
||||||
|
WorkOrderItemOutsideService oProposed = (WorkOrderItemOutsideService)proposedObj;
|
||||||
|
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderItemId, ct);
|
||||||
|
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
||||||
|
oProposed.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|
||||||
//SPECIFIC EVENTS FOR THIS OBJECT
|
//SPECIFIC EVENTS FOR THIS OBJECT
|
||||||
WorkOrderItemOutsideService oProposed = (WorkOrderItemOutsideService)proposedObj;
|
|
||||||
|
|
||||||
//## DELETED EVENTS
|
//## DELETED EVENTS
|
||||||
//standard process above will remove any hanging around when deleted, nothing else specific here to deal with
|
//standard process above will remove any hanging around when deleted, nothing else specific here to deal with
|
||||||
|
|
||||||
var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, oProposed.WorkOrderItemId, ct);
|
|
||||||
var WorkorderInfo = await ct.WorkOrder.AsNoTracking().Where(x => x.Id == woId).Select(x => new { Serial = x.Serial, Tags = x.Tags }).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
|
|
||||||
//## CREATED
|
//## CREATED
|
||||||
@@ -4302,7 +4275,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//sub wo tags here.
|
//sub wo tags here.
|
||||||
proposedObj.Tags = WorkorderInfo.Tags;
|
proposedObj.Tags = WorkorderInfo.Tags;
|
||||||
proposedObj.Name=WorkorderInfo.Serial.ToString();
|
proposedObj.Name = WorkorderInfo.Serial.ToString();
|
||||||
|
|
||||||
//STANDARD EVENTS FOR ALL OBJECTS
|
//STANDARD EVENTS FOR ALL OBJECTS
|
||||||
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);
|
||||||
|
|||||||
Reference in New Issue
Block a user