This commit is contained in:
@@ -184,6 +184,89 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//ACCEPT
|
||||
//
|
||||
internal async Task<CustomerServiceRequest> AcceptAsync(long csrId, long? workorderId) //MIGRATE_OUTSTANDING waiting for workorder to be completed or at least have a customerid which it currently doesn't
|
||||
{
|
||||
CustomerServiceRequest dbObject = await ct.CustomerServiceRequest.SingleOrDefaultAsync(m => m.Id == csrId);
|
||||
if (dbObject == null)
|
||||
{
|
||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new System.NotImplementedException("//MIGRATE_OUTSTANDING CustomerServiceRequestBiz::AcceptAsync - awaiting workorder completion ");
|
||||
|
||||
// WorkOrder w=null;
|
||||
// if(workorderId==null){
|
||||
// w=WorkOrderBiz.;
|
||||
// }
|
||||
|
||||
// CustomerServiceRequest SnapshotOfOriginalDBObj = new CustomerServiceRequest();
|
||||
// CopyObject.Copy(dbObject, SnapshotOfOriginalDBObj);
|
||||
// CopyObject.Copy(putObject, dbObject, "Id");
|
||||
// dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
// dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
// ct.Entry(dbObject).OriginalValues["Concurrency"] = putObject.Concurrency;
|
||||
// await ValidateAsync(dbObject, SnapshotOfOriginalDBObj);
|
||||
// if (HasErrors) return null;
|
||||
// try
|
||||
// {
|
||||
// await ct.SaveChangesAsync();
|
||||
// }
|
||||
// catch (DbUpdateConcurrencyException)
|
||||
// {
|
||||
// if (!await ExistsAsync(putObject.Id))
|
||||
// AddError(ApiErrorCode.NOT_FOUND);
|
||||
// else
|
||||
// AddError(ApiErrorCode.CONCURRENCY_CONFLICT);
|
||||
// return null;
|
||||
// }
|
||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||
// await SearchIndexAsync(dbObject, false);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
// await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||
//return dbObject;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//REJECT
|
||||
//
|
||||
internal async Task<CustomerServiceRequest> RejectAsync(long csrId)
|
||||
{
|
||||
CustomerServiceRequest dbObject = await ct.CustomerServiceRequest.SingleOrDefaultAsync(m => m.Id == csrId);
|
||||
if (dbObject == null)
|
||||
{
|
||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||
return null;
|
||||
}
|
||||
CustomerServiceRequest SnapshotOfOriginalDBObj = new CustomerServiceRequest();
|
||||
CopyObject.Copy(dbObject, SnapshotOfOriginalDBObj);
|
||||
dbObject.Status = CustomerServiceRequestStatus.Declined;
|
||||
await ValidateAsync(dbObject, SnapshotOfOriginalDBObj);
|
||||
if (HasErrors) return null;
|
||||
try
|
||||
{
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!await ExistsAsync(dbObject.Id))
|
||||
AddError(ApiErrorCode.NOT_FOUND);
|
||||
else
|
||||
AddError(ApiErrorCode.CONCURRENCY_CONFLICT);
|
||||
return null;
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified), ct);
|
||||
await SearchIndexAsync(dbObject, false);
|
||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
await HandlePotentialNotificationEvent(AyaEvent.Modified, dbObject, SnapshotOfOriginalDBObj);
|
||||
return dbObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//SEARCH
|
||||
//
|
||||
|
||||
@@ -247,6 +247,33 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //GENERATE
|
||||
// //
|
||||
// internal async Task<WorkOrder> GenerateWorkOrderAsync(long customerId)//MIGRATE_OUTSTANDING will need more overloads as required and fleshing out later
|
||||
// {
|
||||
// WorkOrder newObject = new WorkOrder();
|
||||
// newObject.
|
||||
// await WorkOrderValidateAsync(newObject, null);
|
||||
// if (HasErrors)
|
||||
// return null;
|
||||
// else
|
||||
// {
|
||||
// newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
// newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
// await ct.WorkOrder.AddAsync(newObject);
|
||||
// await ct.SaveChangesAsync();
|
||||
// await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, BizType, AyaEvent.Created), ct);
|
||||
// await WorkOrderSearchIndexAsync(newObject, true);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
// await HandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
// return newObject;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//RESTART SERIAL
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user