public override bool Validate(object value) { if (value == null) { return(true); } return(ValidationCheck.CheckFieldNumeric(value.ToString())); }
public override bool Validate(object value) { if (value == null || Convert.ToString(value).Length < 1) { return(true); } return(ValidationCheck.CheckFieldAmericanPhone(value.ToString()) || ValidationCheck.CheckFieldPhone(value.ToString())); }
public override bool Validate(object value) { if (value == null) { return(false); } return(ValidationCheck.CheckFieldDecimal(value.ToString())); }
public static void CheckErrors(object model, System.Web.Mvc.ModelStateDictionary modelState, bool validateNotUpdateedFields) { Dictionary <string, List <ValidationRule> > errorRules = ValidationCheck.GetValidationRules(model.GetType()); foreach (KeyValuePair <string, List <ValidationRule> > item in errorRules) { object obj = model.GetType().InvokeMember(item.Key, BindingFlags.GetProperty, null, model, null); foreach (ValidationRule rule in item.Value) { if (!rule.IFieldValidation.Validate(obj)) { if (modelState.ContainsKey(rule.FieldName) || validateNotUpdateedFields) { modelState.AddModelError(rule.FieldName, rule.IFieldValidation.GetErrorMessage(rule.FieldTitle)); } continue; } } } }
public override bool Validate(object value) { return(!ValidationCheck.IsEmpty(value)); }
public override bool Validate(object value) { return(ValidationCheck.CheckAlphanumericExt(value == null?String.Empty:value.ToString())); }
public override bool Validate(object value) { return((value == null) ? true : ValidationCheck.CheckAlpha(value.ToString())); }
public override bool Validate(object value) { return(ValidationCheck.CheckDateTime(value)); }
public override bool Validate(object value) { return(ValidationCheck.CheckMaxValue(value == null ? string.Empty : value.ToString(), MaxLength)); }
public override bool Validate(object value) { return(ValidationCheck.IsEmail(value == null ? string.Empty : value.ToString())); }