Example #1
0
 protected void ValidateCNPJ(Expression <Func <T, string> > cnpjField)
 {
     RuleFor(cnpjField).Cascade(CascadeMode.StopOnFirstFailure)
     .NotNull().WithMessage("CNPJ was not provided.")
     .NotEmpty().WithMessage("CNPJ was not provided.")
     .Must(cnpj => CNPJ.IsCnpj(cnpj)).WithMessage("Invalid CNPJ");
 }
Example #2
0
 public virtual void ValidateNewOrUpdateCompany()
 {
     TestCondition(CNPJ.IsNullOrEmpty(), CnpjRequired);
     TestCondition(!CNPJ.IsCnpj(), CnpjInvalid);
     TestCondition(CompanyName.IsNullOrEmpty(), NameEmpty);
     TestCondition(!State.HasValue || State.Value.Equals(Enums.State.EscolhaUmEstado), StateEmpty);
 }
        public IncluirEmpresaValidator()
        {
            RuleFor(v => v.Cnpj)
            .Must(cnpj => CNPJ.IsCnpj(cnpj))
            .WithMessage("CPF Invalido.")
            .NotEmpty()
            .WithMessage("CPF Invalido..");

            RuleFor(v => v.NomeFantasia)
            .NotEmpty()
            .WithMessage("NomeFantasia Invalida.");

            RuleFor(v => v.RazaoSocial)
            .NotEmpty()
            .WithMessage("RazaoSocial Invalida.");
        }
        public FilterGetAllEmployeesValidador()
        {
            RuleFor(v => v.EmailUsuario)
            .Must(email => Util.Regex.Email.IsValidEmail(email))
            .WithMessage("Email Usuario Invalido.");

            RuleFor(v => v.Cnpj)
            .Must(cnpj => cnpj == null || cnpj == "" ? true : CNPJ.IsCnpj(cnpj))
            .WithMessage("CNPJ Invalido.");

            RuleFor(v => v.Cpf)
            .Must(cpf => cpf == null || cpf == "" ? true : CPF.IsCpf(cpf))
            .WithMessage("CPF Invalido.");

            RuleFor(v => v.EmailFuncionario)
            .Must(email => email == null || email == "" ? true : Util.Regex.Email.IsValidEmail(email))
            .WithMessage("Email Funcionario.");
        }
Example #5
0
 public bool ValidaCNPJ(string cnpj)
 {
     return(CNPJ.IsCnpj(cnpj));
 }