This commit is contained in:
2019-01-17 18:52:20 +00:00
parent 595222a996
commit 3d7aeed504
5 changed files with 47 additions and 41 deletions

View File

@@ -16,11 +16,6 @@ SERVER
- DO ALL THE THINGS!!!! - all the way down to DOCS MANUAL below which isn't urgent and go back to client stuff - DO ALL THE THINGS!!!! - all the way down to DOCS MANUAL below which isn't urgent and go back to client stuff
- Resource localization edit wherever possible to change "Common*" such as "CommonActive" to remove the "common" part wherever possible.
- Also check if used anywhere in client or at server and rename there too
- Error messages from the API, shouldn't they be localized??
- USER object add the custom fields code as in Widget - USER object add the custom fields code as in Widget
- JWT issues?? - JWT issues??

View File

@@ -40,7 +40,7 @@ namespace AyaNova.Biz
l.Add(new FormField("WidgetStartDate", "StartDate", false, false)); l.Add(new FormField("WidgetStartDate", "StartDate", false, false));
l.Add(new FormField("WidgetEndDate", "EndDate", false, false)); l.Add(new FormField("WidgetEndDate", "EndDate", false, false));
l.Add(new FormField("WidgetNotes", "Notes")); l.Add(new FormField("WidgetNotes", "Notes"));
l.Add(new FormField("CommonActive", "Active", true)); l.Add(new FormField("Active", "Active", true));
l.Add(new FormField("Tags", "Tags", true)); l.Add(new FormField("Tags", "Tags", true));
l.Add(new FormField("WidgetCustom1", false, true, true)); l.Add(new FormField("WidgetCustom1", false, true, true));
l.Add(new FormField("WidgetCustom2", false, true, true)); l.Add(new FormField("WidgetCustom2", false, true, true));
@@ -60,34 +60,31 @@ namespace AyaNova.Biz
l.Add(new FormField("WidgetCustom16", false, true, true)); l.Add(new FormField("WidgetCustom16", false, true, true));
break; break;
// case USER_FORM_KEY: case USER_FORM_KEY:
// l.Add(new FormField("WidgetName", false, false));//is not shared localized text key and not hideable as it is in the validation rules for widget l.Add(new FormField("Name", true, false));//is not shared localized text key and not hideable as it is in the validation rules for widget
// l.Add(new FormField("WidgetSerial"));//not in validation rules...you get the idea l.Add(new FormField("EmployeeNumber"));
// l.Add(new FormField("WidgetDollarAmount")); l.Add(new FormField("Roles", false, false));
// l.Add(new FormField("WidgetCount")); l.Add(new FormField("UserNotes","UserNotes"));
// l.Add(new FormField("WidgetRoles")); l.Add(new FormField("UserType",false,false));
// l.Add(new FormField("WidgetStartDate", false, false)); l.Add(new FormField("Active", true, false));
// l.Add(new FormField("WidgetEndDate", false, false)); l.Add(new FormField("Tags", true, false));
// l.Add(new FormField("WidgetNotes")); l.Add(new FormField("UserCustom1", false, true, true));
// l.Add(new FormField("CommonActive", true)); l.Add(new FormField("UserCustom2", false, true, true));
// l.Add(new FormField("Tags", true)); l.Add(new FormField("UserCustom3", false, true, true));
// l.Add(new FormField("WidgetCustom1", false, true, true)); l.Add(new FormField("UserCustom4", false, true, true));
// l.Add(new FormField("WidgetCustom2", false, true, true)); l.Add(new FormField("UserCustom5", false, true, true));
// l.Add(new FormField("WidgetCustom3", false, true, true)); l.Add(new FormField("UserCustom6", false, true, true));
// l.Add(new FormField("WidgetCustom4", false, true, true)); l.Add(new FormField("UserCustom7", false, true, true));
// l.Add(new FormField("WidgetCustom5", false, true, true)); l.Add(new FormField("UserCustom8", false, true, true));
// l.Add(new FormField("WidgetCustom6", false, true, true)); l.Add(new FormField("UserCustom9", false, true, true));
// l.Add(new FormField("WidgetCustom7", false, true, true)); l.Add(new FormField("UserCustom10", false, true, true));
// l.Add(new FormField("WidgetCustom8", false, true, true)); l.Add(new FormField("UserCustom11", false, true, true));
// l.Add(new FormField("WidgetCustom9", false, true, true)); l.Add(new FormField("UserCustom12", false, true, true));
// l.Add(new FormField("WidgetCustom10", false, true, true)); l.Add(new FormField("UserCustom13", false, true, true));
// l.Add(new FormField("WidgetCustom11", false, true, true)); l.Add(new FormField("UserCustom14", false, true, true));
// l.Add(new FormField("WidgetCustom12", false, true, true)); l.Add(new FormField("UserCustom15", false, true, true));
// l.Add(new FormField("WidgetCustom13", false, true, true)); l.Add(new FormField("UserCustom16", false, true, true));
// l.Add(new FormField("WidgetCustom14", false, true, true)); break;
// l.Add(new FormField("WidgetCustom15", false, true, true));
// l.Add(new FormField("WidgetCustom16", false, true, true));
// break;
@@ -117,16 +114,19 @@ namespace AyaNova.Biz
{ {
public string Key { get; set; } public string Key { get; set; }
public string PropertyName { get; set; } public string PropertyName { get; set; }
//NOTE: Not hideable fields don't require a PropertyName value because they are already required and will be validated
public bool Hideable { get; set; } public bool Hideable { get; set; }
public bool SharedLTKey { get; set; } public bool SharedLTKey { get; set; }
public bool Custom { get; set; } public bool Custom { get; set; }
public FormField(string key, string propertyName, bool sharedLTKey = false, bool hideable = true, bool custom = false) public FormField(string key, string propertyName, bool sharedLTKey = false, bool hideable = true, bool custom = false)
{ {
Key = key; Key = key;
Hideable = hideable; Hideable = hideable;
Custom = custom; Custom = custom;
SharedLTKey = sharedLTKey; SharedLTKey = sharedLTKey;
PropertyName = propertyName; PropertyName = propertyName;//Only if hideable do they require this as non-hideable ones are automatically validated anyway and this is only required for validation
} }
public FormField(string key, bool sharedLTKey = false, bool hideable = true, bool custom = false) public FormField(string key, bool sharedLTKey = false, bool hideable = true, bool custom = false)

View File

@@ -27,7 +27,7 @@ namespace AyaNova.Biz
var FldLtKey = jo["fld"].Value<string>(); var FldLtKey = jo["fld"].Value<string>();
// - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]} // - e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
//get teh FormField object //get the FormField object
FormField FF = FormFields.Where(x => x.Key == FldLtKey).Single(); FormField FF = FormFields.Where(x => x.Key == FldLtKey).Single();
if (!string.IsNullOrWhiteSpace(FF.PropertyName)) if (!string.IsNullOrWhiteSpace(FF.PropertyName))
{ {

View File

@@ -159,12 +159,12 @@ namespace AyaNova.Biz
FilterOptions f = new FilterOptions("user"); FilterOptions f = new FilterOptions("user");
f. f.
AddField("id", "ID", AyDataType.Integer). AddField("id", "ID", AyDataType.Integer).
AddField("name", "CommonName", AyDataType.Text). AddField("name", "Name", AyDataType.Text).
AddField("active", "CommonActive", AyDataType.Bool). AddField("active", "Active", AyDataType.Bool).
AddField("tags", "Tags", AyDataType.Tags). AddField("tags", "Tags", AyDataType.Tags).
AddField("EmployeeNumber", "UserEmployeeNumber", AyDataType.Text). AddField("EmployeeNumber", "UserEmployeeNumber", AyDataType.Text).
AddField("usertype", "UserUserType", AyDataType.Enum). AddField("usertype", "UserUserType", AyDataType.Enum).
AddField("notes", "WidgetNotes", AyDataType.Text); AddField("notes", "UserNotes", AyDataType.Text);
if (localizeToLocaleId != 0) if (localizeToLocaleId != 0)
f.Localize(localizeToLocaleId); f.Localize(localizeToLocaleId);
@@ -521,7 +521,18 @@ namespace AyaNova.Biz
if (!string.IsNullOrWhiteSpace(proposedObj.EmployeeNumber) && proposedObj.EmployeeNumber.Length > 255) if (!string.IsNullOrWhiteSpace(proposedObj.EmployeeNumber) && proposedObj.EmployeeNumber.Length > 255)
AddError(ValidationErrorType.LengthExceeded, "EmployeeNumber", "255 max"); AddError(ValidationErrorType.LengthExceeded, "EmployeeNumber", "255 max");
//CustomFieldsValidator.Validate(this, "user", proposedObj.CustomFields); //Any form customizations to validate?
var FormCustomization = ct.FormCustom.SingleOrDefault(x => x.FormKey == FormAvailableFields.USER_FORM_KEY);
if (FormCustomization != null)
{
//Yeppers, do the validation, there are two, the custom fields and the regular fields that might be set to required
//validate users choices for required non custom fields
RequiredFieldsValidator.Validate(this, FormCustomization, proposedObj);
//validate custom fields
CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
}
return; return;
} }

View File

@@ -252,7 +252,7 @@ namespace AyaNova.Biz
AddField("serial", "WidgetSerial", AyDataType.Integer). AddField("serial", "WidgetSerial", AyDataType.Integer).
AddField("notes", "WidgetNotes", AyDataType.Text). AddField("notes", "WidgetNotes", AyDataType.Text).
AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal). AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal).
AddField("active", "CommonActive", AyDataType.Bool). AddField("active", "Active", AyDataType.Bool).
AddField("startdate", "WidgetStartDate", AyDataType.Date). AddField("startdate", "WidgetStartDate", AyDataType.Date).
AddField("count", "WidgetCount", AyDataType.Integer). AddField("count", "WidgetCount", AyDataType.Integer).
AddField("tags", "Tags", AyDataType.Tags). AddField("tags", "Tags", AyDataType.Tags).