case 4240
This commit is contained in:
@@ -1130,6 +1130,8 @@ namespace AyaNova.Biz
|
||||
//CREATE
|
||||
//
|
||||
internal async Task<QuoteState> StateCreateAsync(QuoteState newObject)
|
||||
{
|
||||
using (var transaction = await ct.Database.BeginTransactionAsync())//case 4240 wrapped in transaction because header is updated as well as states collection so both need to be in sync
|
||||
{
|
||||
await StatePreliminaryValidateCanAddAsync(newObject);
|
||||
if (HasErrors)
|
||||
@@ -1168,10 +1170,12 @@ namespace AyaNova.Biz
|
||||
newObject.NewQuoteConcurrency = quote.Concurrency;
|
||||
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.QuoteStatus, AyaEvent.Created), ct);
|
||||
await transaction.CommitAsync();
|
||||
await StateHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
return newObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GET
|
||||
|
||||
@@ -1711,6 +1711,8 @@ namespace AyaNova.Biz
|
||||
//CREATE
|
||||
//
|
||||
internal async Task<WorkOrderState> StateCreateAsync(WorkOrderState newObject)
|
||||
{
|
||||
using (var transaction = await ct.Database.BeginTransactionAsync())//case 4240 wrapped in transaction because workorder header is updated as well as states collection so both need to be in sync
|
||||
{
|
||||
//first validate if this is even a possibility before getting into the further validation
|
||||
//for roles can select, can remove etc
|
||||
@@ -1744,6 +1746,8 @@ namespace AyaNova.Biz
|
||||
}
|
||||
//Seems legit, we'll allow it
|
||||
|
||||
|
||||
|
||||
await ct.WorkOrderState.AddAsync(newObject);
|
||||
//Set duration to completed in workorder header
|
||||
//Clear it if set and not completed state
|
||||
@@ -1756,12 +1760,13 @@ namespace AyaNova.Biz
|
||||
wo.LastStatusId = newObject.WorkOrderStatusId;
|
||||
await ct.SaveChangesAsync();
|
||||
newObject.NewWOConcurrency = wo.Concurrency;
|
||||
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderStatus, AyaEvent.Created), ct);
|
||||
await transaction.CommitAsync();
|
||||
await StateHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
return newObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GET
|
||||
|
||||
Reference in New Issue
Block a user