diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index b32bd0e7..5847f857 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -3290,6 +3290,7 @@ namespace AyaNova.Biz 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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); @@ -4006,29 +4007,17 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - + WorkOrderItemPart oProposed = (WorkOrderItemPart)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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); //SPECIFIC EVENTS FOR THIS OBJECT - WorkOrderItemPart o = (WorkOrderItemPart)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 @@ -4266,14 +4255,9 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - WorkOrderItemPartRequest oProposed = (WorkOrderItemPartRequest)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(); - - - //sub wo tags here. proposedObj.Tags = WorkorderInfo.Tags; proposedObj.Name = WorkorderInfo.Serial.ToString(); @@ -4282,16 +4266,6 @@ namespace AyaNova.Biz //SPECIFIC EVENTS FOR THIS OBJECT - - - - - - - - - - }//end of process notifications @@ -4523,23 +4497,16 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - + WorkOrderItemScheduledUser oProposed = (WorkOrderItemScheduledUser)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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); //SPECIFIC EVENTS FOR THIS OBJECT - WorkOrderItemScheduledUser oProposed = (WorkOrderItemScheduledUser)proposedObj; - // WorkOrderItemScheduledUser oCurrent=null; - // if(currentObj!=null) - // oCurrent = (WorkOrderItemScheduledUser)currentObj; - - //## DELETED EVENTS - //standard process 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 / UPDATED - ScheduledOnWorkorder event @@ -4903,29 +4870,17 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - + WorkOrderItemTask oProposed = (WorkOrderItemTask)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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); //SPECIFIC EVENTS FOR THIS OBJECT - WorkOrderItemTask o = (WorkOrderItemTask)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 @@ -5358,29 +5313,16 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - + WorkOrderItemTravel oProposed = (WorkOrderItemTravel)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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); //SPECIFIC EVENTS FOR THIS OBJECT - WorkOrderItemTravel o = (WorkOrderItemTravel)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 @@ -5627,29 +5569,16 @@ namespace AyaNova.Biz log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{proposedObj.AyaType}, AyaEvent:{ayaEvent}]"); bool isNew = currentObj == null; - + WorkOrderItemUnit oProposed = (WorkOrderItemUnit)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 await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct); //SPECIFIC EVENTS FOR THIS OBJECT - WorkOrderItemUnit o = (WorkOrderItemUnit)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