This commit is contained in:
@@ -155,7 +155,7 @@ namespace AyaNova.Biz
|
|||||||
AddError(ApiErrorCode.NOT_FOUND);
|
AddError(ApiErrorCode.NOT_FOUND);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
await ValidateCanDelete(dbObject);
|
await ValidateCanDelete(dbObject);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return false;
|
return false;
|
||||||
ct.PartWarehouse.Remove(dbObject);
|
ct.PartWarehouse.Remove(dbObject);
|
||||||
@@ -254,7 +254,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
private async Task ValidateCanDelete(PartWarehouse inObj)
|
private async Task ValidateCanDelete(PartWarehouse inObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Can't delete the default warehouse
|
//Can't delete the default warehouse
|
||||||
if (inObj.Id == 1)
|
if (inObj.Id == 1)
|
||||||
{
|
{
|
||||||
@@ -267,7 +267,7 @@ namespace AyaNova.Biz
|
|||||||
//PartInventory record?
|
//PartInventory record?
|
||||||
if (await ct.PartInventory.AnyAsync(m => m.PartWarehouseId == inObj.Id))
|
if (await ct.PartInventory.AnyAsync(m => m.PartWarehouseId == inObj.Id))
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", "LT:PartInventoryTransaction");
|
AddError(ApiErrorCode.VALIDATION_REFERENTIAL_INTEGRITY, "generalerror", await TranslationBiz.GetTranslationStaticAsync("PartInventoryTransaction", UserTranslationId, ct));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,6 +372,19 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
// Get translation of one key for specified translation id
|
||||||
|
// Used for internal error message translation to return
|
||||||
|
// during object validation etc. Intended to be as efficient as possible
|
||||||
|
//
|
||||||
|
internal static async Task<string> GetTranslationStaticAsync(string translationKey, long translationId, AyContext ct)
|
||||||
|
{
|
||||||
|
#if (DEBUG)
|
||||||
|
TrackRequestedKey(translationKey);
|
||||||
|
#endif
|
||||||
|
return await ct.TranslationItem.Where(z => z.TranslationId == translationId && z.Key == translationKey).AsNoTracking().Select(z => z.Display).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user