예제 #1
0
 public override bool Validate(object value)
 {
     if (value == null)
     {
         return(true);
     }
     return(ValidationCheck.CheckFieldNumeric(value.ToString()));
 }
예제 #2
0
        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()));
        }
예제 #3
0
        public override bool Validate(object value)
        {
            if (value == null)
            {
                return(false);
            }

            return(ValidationCheck.CheckFieldDecimal(value.ToString()));
        }
예제 #4
0
        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;
                    }
                }
            }
        }
예제 #5
0
 public override bool Validate(object value)
 {
     return(!ValidationCheck.IsEmpty(value));
 }
예제 #6
0
 public override bool Validate(object value)
 {
     return(ValidationCheck.CheckAlphanumericExt(value == null?String.Empty:value.ToString()));
 }
예제 #7
0
 public override bool Validate(object value)
 {
     return((value == null) ? true : ValidationCheck.CheckAlpha(value.ToString()));
 }
예제 #8
0
 public override bool Validate(object value)
 {
     return(ValidationCheck.CheckDateTime(value));
 }
예제 #9
0
 public override bool Validate(object value)
 {
     return(ValidationCheck.CheckMaxValue(value == null ? string.Empty : value.ToString(), MaxLength));
 }
예제 #10
0
 public override bool Validate(object value)
 {
     return(ValidationCheck.IsEmail(value == null ? string.Empty : value.ToString()));
 }