This commit is contained in:
@@ -216,19 +216,14 @@ namespace AyaNova.Biz
|
||||
if (string.IsNullOrWhiteSpace(proposedObj.Name))
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
|
||||
|
||||
|
||||
|
||||
//If name is otherwise OK, check that name is unique
|
||||
if (!PropertyHasErrors("Name"))
|
||||
//Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
|
||||
if (proposedObj.Color.Length > 12 || proposedObj.Color.Length < 4 || proposedObj.Color[0] != '#')
|
||||
{
|
||||
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
|
||||
if (await ct.Reminder.AnyAsync(m => m.Name == proposedObj.Name && m.Id != proposedObj.Id))
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
|
||||
}
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UiColor", "UiColor must be valid HEX color value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Any form customizations to validate?
|
||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(x => x.FormKey == AyaType.Reminder.ToString());
|
||||
if (FormCustomization != null)
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace AyaNova.Biz
|
||||
private async Task SearchIndexAsync(Review obj, bool isNew)
|
||||
{
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserTranslationId, obj.Id, BizType);
|
||||
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
|
||||
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.CompletionNotes).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
|
||||
if (isNew)
|
||||
await Search.ProcessNewObjectKeywordsAsync(SearchParams);
|
||||
else
|
||||
@@ -198,7 +198,7 @@ namespace AyaNova.Biz
|
||||
var obj = await ct.Review.SingleOrDefaultAsync(m => m.Id == id);
|
||||
var SearchParams = new Search.SearchIndexProcessObjectParameters();
|
||||
if (obj != null)
|
||||
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
|
||||
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.CompletionNotes).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
|
||||
return SearchParams;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,17 +87,16 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//UserOptions is never new, it's created with the User object so were only here for an edit
|
||||
|
||||
|
||||
|
||||
//UserId required
|
||||
if (inObj.UserId == 0)
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId");
|
||||
|
||||
if (inObj.UiColor.Length > 12)
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "UiColor", "UiColor must be HEX color value");
|
||||
}
|
||||
|
||||
//Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
|
||||
if (inObj.UiColor.Length > 12 || inObj.UiColor.Length < 4 || inObj.UiColor[0] != '#')
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UiColor", "UiColor must be valid HEX color value");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user