예제 #1
0
 public override bool IsValid(object value)
 {
     if (value == null)
     {
         return(true);
     }
     if (value.ToString().Length > 11)
     {
         return(CustomAnnotationUtil.ValidarCnpj(value.ToString()));
     }
     else
     {
         return(CustomAnnotationUtil.ValidarCPF(value.ToString()));
     }
 }
예제 #2
0
        public override bool IsValid(object value)
        {
            if (value == null)
            {
                return(true);
            }
            CustomAnnotationUtil.LimparEspacoBranco(ref value);

            string valueAsString = value as string;

            if (valueAsString != null)
            {
                string rgPattern = @"[\\\/:\*\?""'<>|]";
                Regex  objRegEx  = new Regex(rgPattern);
                valueAsString = objRegEx.Replace(valueAsString, "");

                return(CustomAnnotationUtil.ValidarExtensaoArquivo(valueAsString, this.Extensoes));
            }

            return(false);
        }