From 85a15e145087600e6e42595ddeb6af747bfff76b Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 8 Dec 2020 23:57:24 +0000 Subject: [PATCH] --- server/AyaNova/biz/CustomerBiz.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/biz/CustomerBiz.cs b/server/AyaNova/biz/CustomerBiz.cs index 8eeb562e..e8cfafce 100644 --- a/server/AyaNova/biz/CustomerBiz.cs +++ b/server/AyaNova/biz/CustomerBiz.cs @@ -164,8 +164,6 @@ namespace AyaNova.Biz //DELETE DIRECT CHILD OBJECTS //(note: the convention is to allow deletion of children created *in* the same UI area so this will delete contacts, customer notes, but not workorders of this customer for example) - //Will need to possibly display refintegrity error from the *linked* object delete attemp, i.e. Contact for here - //so should test that out so that it flows to the UI so user understands they can't delete the Customer due to a Contact having links to other objects { var ContactIds = await ct.User.AsNoTracking().Where(z => z.CustomerId == id).Select(z => z.Id).ToListAsync(); if (ContactIds.Count() > 0) @@ -174,7 +172,7 @@ namespace AyaNova.Biz foreach (long ItemId in ContactIds) if (!await b.DeleteAsync(ItemId, transaction)) { - AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, b.GetErrorsAsString()); + AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, $"CustomerContact [{ItemId}]: {b.GetErrorsAsString()}"); return false; } } @@ -187,7 +185,7 @@ namespace AyaNova.Biz foreach (long ItemId in CustomerNoteIds) if (!await b.DeleteAsync(ItemId, transaction)) { - AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, b.GetErrorsAsString()); + AddError(ApiErrorCode.CHILD_OBJECT_ERROR, null, $"CustomerNote [{ItemId}]: {b.GetErrorsAsString()}"); return false; } }