This commit is contained in:
2022-12-22 22:21:27 +00:00
parent 04e06dfed8
commit 29bbf5663c
5 changed files with 69 additions and 13 deletions

View File

@@ -277,7 +277,7 @@ namespace Sockeye.Biz
}
}
if (proposedObj.BillHeadOffice && (proposedObj.HeadOfficeId == null || proposedObj.HeadOfficeId == 0))
{
@@ -315,14 +315,19 @@ namespace Sockeye.Biz
//Workorders and things that you select a Customer for would trigger an error and NOT be deleted automatically
//The Mass delete Extension will be used in those cases to clear out all the workorders etc
//FOREIGN KEY CHECKS
if (await ct.User.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("User"));
// await Task.CompletedTask;
if (await ct.License.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("License"));
if (await ct.SubscriptionServer.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("SubscriptionServer"));
if (await ct.Purchase.AnyAsync(m => m.CustomerId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("Purchase"));
}

View File

@@ -230,7 +230,8 @@ namespace Sockeye.Biz
private async Task ValidateCanDeleteAsync(License inObj)
{
await Task.CompletedTask;
if (await ct.SubscriptionServer.AnyAsync(m => m.LicenseId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("SubscriptionServer"));
}

View File

@@ -227,8 +227,8 @@ namespace Sockeye.Biz
private async Task ValidateCanDeleteAsync(Product inObj)
{
await Task.CompletedTask;
if (await ct.Purchase.AnyAsync(m => m.ProductId == inObj.Id))
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await Translate("Purchase"));
}
@@ -414,7 +414,7 @@ namespace Sockeye.Biz
log.LogDebug($"HandlePotentialNotificationEvent processing: [SockType:{this.BizType}, AyaEvent:{ayaEvent}]");
bool isNew = currentObj == null;
//STANDARD EVENTS FOR ALL OBJECTS
await NotifyEventHelper.ProcessStandardObjectEvents(ayaEvent, proposedObj, ct);