This commit is contained in:
@@ -2369,7 +2369,7 @@ namespace AyaNova.Biz
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await ExpenseSearchIndexAsync(newObject, true);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await ExpensePopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -2451,8 +2451,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -2732,15 +2732,13 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
// await LaborBizActionsAsync(AyaEvent.Created, newObject, null, null);
|
||||
//newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
await ct.WorkOrderItemLabor.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await LaborSearchIndexAsync(newObject, true);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await LaborHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await LaborPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -2799,7 +2797,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await LaborSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||
|
||||
await LaborHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await LaborPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -2823,8 +2821,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
// await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await LaborHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -3050,7 +3048,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3141,7 +3139,7 @@ namespace AyaNova.Biz
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await LoanSearchIndexAsync(newObject, true);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await LoanHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await LoanPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -3197,7 +3195,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await LoanSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||
|
||||
await LoanHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await LoanPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -3221,8 +3219,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await LoanHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -3454,7 +3452,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3548,12 +3546,12 @@ namespace AyaNova.Biz
|
||||
else
|
||||
{
|
||||
// newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
await ct.WorkOrderItemOutsideService.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await OutsideServiceSearchIndexAsync(newObject, true);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await OutsideServicePopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -3590,10 +3588,6 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
// dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
|
||||
await OutsideServiceValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
ct.Replace(dbObject, putObject);
|
||||
@@ -3611,7 +3605,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, putObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await OutsideServiceSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
|
||||
|
||||
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await OutsideServicePopulateVizFields(putObject);
|
||||
@@ -3636,8 +3630,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -3784,7 +3778,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4023,8 +4017,8 @@ namespace AyaNova.Biz
|
||||
else
|
||||
{
|
||||
await PartBizActionsAsync(AyaEvent.Created, newObject, null, null);
|
||||
//newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
|
||||
await ct.WorkOrderItemPart.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
await PartInventoryAdjustmentAsync(AyaEvent.Created, newObject, null, transaction);
|
||||
@@ -4036,7 +4030,7 @@ namespace AyaNova.Biz
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await PartSearchIndexAsync(newObject, true);
|
||||
await transaction.CommitAsync();
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await PartPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
}
|
||||
@@ -4076,8 +4070,8 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
|
||||
//dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
//dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
|
||||
|
||||
|
||||
await PartValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
@@ -4103,7 +4097,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, putObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await PartSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
|
||||
await PartHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await transaction.CommitAsync();
|
||||
await PartPopulateVizFields(putObject);
|
||||
@@ -4136,8 +4130,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await PartHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -4548,7 +4542,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4635,13 +4629,13 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
//newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
|
||||
await ct.WorkOrderItemPartRequest.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
//await PartRequestSearchIndexAsync(newObject, true);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await PartRequestHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await PartRequestPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -4677,8 +4671,8 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.CONCURRENCY_CONFLICT);
|
||||
return null;
|
||||
}
|
||||
// dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
//dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
|
||||
|
||||
await PartRequestValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
ct.Replace(dbObject, putObject);
|
||||
@@ -4695,8 +4689,8 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, putObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
// await PartRequestSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||
|
||||
|
||||
await PartRequestHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await PartRequestPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -4720,8 +4714,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await PartRequestHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -4825,7 +4819,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4911,13 +4905,13 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
//newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
|
||||
await ct.WorkOrderItemScheduledUser.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
//await ScheduledUserSearchIndexAsync(newObject, true);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
|
||||
await ScheduledUserHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await ScheduledUserPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -4954,8 +4948,8 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
|
||||
//dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
// dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
|
||||
|
||||
await ScheduledUserValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
ct.Replace(dbObject, putObject);
|
||||
@@ -4972,8 +4966,8 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
// await ScheduledUserSearchIndexAsync(dbObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
|
||||
|
||||
await ScheduledUserHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await ScheduledUserPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -4997,8 +4991,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await ScheduledUserHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -5112,7 +5106,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5312,13 +5306,13 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
//newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
//newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
|
||||
|
||||
await ct.WorkOrderItemTask.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||
await TaskSearchIndexAsync(newObject, true);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||
|
||||
await TaskHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
await TaskPopulateVizFields(newObject);
|
||||
return newObject;
|
||||
@@ -5352,8 +5346,8 @@ namespace AyaNova.Biz
|
||||
AddError(ApiErrorCode.CONCURRENCY_CONFLICT);
|
||||
return null;
|
||||
}
|
||||
//dbObject.Tags = TagBiz.NormalizeTags(dbObject.Tags);
|
||||
//dbObject.CustomFields = JsonUtil.CompactJson(dbObject.CustomFields);
|
||||
|
||||
|
||||
await TaskValidateAsync(putObject, dbObject);
|
||||
if (HasErrors) return null;
|
||||
ct.Replace(dbObject, putObject);
|
||||
@@ -5371,7 +5365,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await TaskSearchIndexAsync(dbObject, false);
|
||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
|
||||
await TaskHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await TaskPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -5395,8 +5389,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);//Fix??
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
//await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(dbObject.AyaType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await TaskHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -5519,7 +5513,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5663,7 +5657,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||
await TravelSearchIndexAsync(putObject, false);
|
||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||
|
||||
await TravelHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||
await TravelPopulateVizFields(putObject);
|
||||
return putObject;
|
||||
@@ -5687,8 +5681,8 @@ namespace AyaNova.Biz
|
||||
//Log event
|
||||
await EventLogProcessor.DeleteObjectLogAsync(UserId, dbObject.AyaType, dbObject.Id, "woitem:" + dbObject.WorkOrderItemId.ToString(), ct);
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, dbObject.AyaType, ct);
|
||||
// await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
//await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
|
||||
|
||||
if (parentTransaction == null)
|
||||
await transaction.CommitAsync();
|
||||
await TravelHandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
@@ -5899,7 +5893,7 @@ namespace AyaNova.Biz
|
||||
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);//note: this is passed only to add errors
|
||||
|
||||
//validate custom fields
|
||||
//CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5982,8 +5976,8 @@ namespace AyaNova.Biz
|
||||
//
|
||||
internal async Task<WorkOrderItemUnit> UnitCreateAsync(WorkOrderItemUnit newObject)
|
||||
{
|
||||
//todo: contract stuff and validation of no other existing contracted unit
|
||||
//assumptions: this create only gets called if there is an existing woheader saved in all cases
|
||||
|
||||
|
||||
|
||||
|
||||
await UnitValidateAsync(newObject, null);
|
||||
@@ -5991,7 +5985,7 @@ namespace AyaNova.Biz
|
||||
return null;
|
||||
else
|
||||
{
|
||||
//await UnitBizActionsAsync(AyaEvent.Created, newObject, null, null);
|
||||
|
||||
newObject.Tags = TagBiz.NormalizeTags(newObject.Tags);
|
||||
newObject.CustomFields = JsonUtil.CompactJson(newObject.CustomFields);
|
||||
await ct.WorkOrderItemUnit.AddAsync(newObject);
|
||||
@@ -6199,8 +6193,7 @@ namespace AyaNova.Biz
|
||||
// if (ServerBootConfig.SEEDING) return;
|
||||
|
||||
// - A work order *MUST* have only one Unit with a Contract, if there is already a unit with a contract on this workorder then a new one cannot be added and it will reject with a validation error
|
||||
// a unit record is saved only *after* there is already a header (by api users and our client software) so can easily check and set here
|
||||
|
||||
|
||||
//run validation and biz rules
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
@@ -6237,64 +6230,6 @@ namespace AyaNova.Biz
|
||||
if (proposedObj.UnitId < 1 || !await ct.Unit.AnyAsync(x => x.Id == proposedObj.UnitId))
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId");
|
||||
|
||||
// //Contracted unit? Only one per work order is allowed
|
||||
// if (isNew || proposedObj.UnitId != currentObj.UnitId)
|
||||
// {
|
||||
// bool AlreadyHasAContractedUnit = false;
|
||||
// //See if this unit has a contract, if so then see if the contract is active, if so then iterate workorder graph and check all other units for same
|
||||
// //if any found then reject this
|
||||
// var proposedUnitInfo = await ct.Unit.AsNoTracking().Where(x => x.Id == proposedObj.UnitId).Select(x => new { x.ContractExpires, x.ContractId }).FirstOrDefaultAsync();
|
||||
// if (proposedUnitInfo.ContractId != null && proposedUnitInfo.ContractExpires > DateTime.UtcNow)
|
||||
// {
|
||||
// //added woitemunit has a contract and apparently unexpired so need to check if contract is still active
|
||||
// newOrChangedActiveUnitContractId = proposedUnitInfo.ContractId;
|
||||
// if (await ct.Contract.AsNoTracking().Where(z => z.Id == proposedUnitInfo.ContractId).Select(x => x.Active).FirstOrDefaultAsync() == true)
|
||||
// {
|
||||
// //iterate work order and check for other contracted unit
|
||||
// var woId = await GetWorkOrderIdFromRelativeAsync(AyaType.WorkOrderItem, proposedObj.WorkOrderItemId, ct);
|
||||
// newOrChangedActiveUnitWorkOrderId = woId.WorkOrderId;//save for later contract update if necessary
|
||||
// var w = await WorkOrderGetFullAsync(woId.WorkOrderId);
|
||||
|
||||
// //iterate, look for *other* woitemunit records, are they contracted already?
|
||||
// foreach (WorkOrderItem wi in w.Items)
|
||||
// {
|
||||
// if (AlreadyHasAContractedUnit) continue;
|
||||
// foreach (WorkOrderItemUnit wiu in wi.Units)
|
||||
// {
|
||||
// if (isNew || wiu.Id != currentObj.Id)
|
||||
// {
|
||||
// var existingUnitInfo = await ct.Unit.AsNoTracking().Where(x => x.Id == wiu.UnitId).Select(x => new { x.ContractExpires, x.ContractId }).FirstOrDefaultAsync();
|
||||
// if (existingUnitInfo != null)
|
||||
// {
|
||||
// if (existingUnitInfo.ContractId != null && existingUnitInfo.ContractExpires > DateTime.UtcNow)
|
||||
// {
|
||||
// //Ok, we have a pre-existing contract, is it active?
|
||||
// if (await ct.Contract.AsNoTracking().Where(x => x.Id == existingUnitInfo.ContractId).Select(x => x.Active).FirstOrDefaultAsync())
|
||||
// {
|
||||
// AlreadyHasAContractedUnit = true;
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (AlreadyHasAContractedUnit)
|
||||
// {
|
||||
// AddError(ApiErrorCode.VALIDATION_WO_MULTIPLE_CONTRACTED_UNITS, "UnitId");
|
||||
// return;//this is a completely disqualifying error
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// newOrChangedActiveUnitContractId = null;//just in case it's non active but present so later biz actions don't process it
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
//Any form customizations to validate?
|
||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemUnit.ToString());
|
||||
if (FormCustomization != null)
|
||||
|
||||
Reference in New Issue
Block a user