case 4025 replaced partnumber with partname and changed partname to partdescription
This commit is contained in:
@@ -409,7 +409,7 @@ namespace AyaNova.Biz
|
||||
if (obj != null)
|
||||
searchParams.AddText(obj.Notes)
|
||||
.AddText(obj.Name)
|
||||
.AddText(obj.PartNumber)
|
||||
.AddText(obj.Description)
|
||||
.AddText(obj.ManufacturerNumber)
|
||||
.AddText(obj.WholeSalerNumber)
|
||||
.AddText(obj.AlternativeWholeSalerNumber)
|
||||
@@ -431,19 +431,19 @@ namespace AyaNova.Biz
|
||||
|
||||
bool isNew = currentObj == null;
|
||||
|
||||
//PartNumber required
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.PartNumber))
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "PartNumber");
|
||||
//name required
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.Name))
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "PartName");
|
||||
|
||||
|
||||
|
||||
//If PartNumber is otherwise OK, check that PartNumber is unique
|
||||
if (!PropertyHasErrors("PartNumber"))
|
||||
//If name is otherwise OK, check that Name is unique
|
||||
if (!PropertyHasErrors("Name"))
|
||||
{
|
||||
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
|
||||
if (await ct.Part.AnyAsync(m => m.PartNumber == proposedObj.PartNumber && m.Id != proposedObj.Id))
|
||||
if (await ct.Part.AnyAsync(m => m.Name == proposedObj.Name && m.Id != proposedObj.Id))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "PartNumber");
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "PartName");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user