public static bool IsValid(this CSValidation o) { var result = new ValidationBase(); if (o.Validations.Count > 0) { foreach (var val in o.Validations.Keys) { ((CValidationAttribute)o.Validations[val]).SetValidation(o.Value, ref result); } } return(false); }
public static string GetValidationMessage(this object model, string propertyName) { Type type = model.GetType(); var prp = type.GetProperties().Where(x => x.Name == propertyName).First(); var attributes = (from y in prp.GetCustomAttributes(typeof(CValidationAttribute), true) select(CValidationAttribute) y).ToList(); ValidationBase vbase = new ValidationBase(); var val = prp.GetValue(model); foreach (var k in attributes) { k.SetValidation(val, ref vbase); } return(string.Join("<br/>", vbase.ValidationMessages)); }
public virtual void SetValidation(object value, ref ValidationBase validationResult) { throw new NotImplementedException(); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateRegex_WithMsg(ExtentionMethods.RegexTypes.MailPattern, Message, validationResult); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateRegex_WithMsg(RegexPattern, Message, validationResult); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateMatch_WithMsg(MatchValue, Message, validationResult); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateNumberRange_WithMsg(null, Max, Message, validationResult); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateStringLengthRange_WithMsg(Min, null, Message, validationResult); }
public override void SetValidation(object value, ref ValidationBase validationResult) { value.ValidateRequiredField_WithMsg(Message, validationResult); }