示例#1
0
 private bool Validar(Aluno aluno)
 {
     if (aluno.GetMatricula() <= 0)
     {
         throw new ExcecaoSAG("A Matrícula dave ser válida.");
     }
     if (aluno.GetNomeCompleto() == null || aluno.GetNomeCompleto().Trim().Equals(""))
     {
         throw new ExcecaoSAG("Nome completo deve ser preenchido");
     }
     if (aluno.GetNascimento() <= 0 || !FormatarData.DataNascimentoValida(aluno.GetNascimento()))
     {
         throw new ExcecaoSAG("Data de nascimento deve ser válida");
     }
     if (aluno.GetCpf() == null || aluno.GetCpf().Trim().Equals("") || !ValidaCPF.Valida(aluno.GetCpf()))
     {
         throw new ExcecaoSAG("CPF deve ser válido");
     }
     if (aluno.GetTelefone() <= 0)
     {
         throw new ExcecaoSAG("O Telefone deve ser preenchido com um número válido.");
     }
     if (aluno.GetCelular() <= 0)
     {
         throw new ExcecaoSAG("O Celular deve ser preenchido com um número válido.");
     }
     if (aluno.GetTelefone().ToString().Length <= 7)
     {
         throw new ExcecaoSAG("O Telefone deve ser preenchido com no mínimo 8 dígitos.");
     }
     if (aluno.GetCelular().ToString().Length <= 8)
     {
         throw new ExcecaoSAG("O Celular deve ser preenchido com no mínimo 9 dígitos.");
     }
     if (aluno.GetUsuario() == null || aluno.GetUsuario().Trim().Equals(""))
     {
         throw new ExcecaoSAG("Usuario deve ser preenchido");
     }
     if (aluno.GetSenha() == null || aluno.GetSenha().Trim().Equals(""))
     {
         throw new ExcecaoSAG("Senha deve ser preenchida");
     }
     if (aluno.GetEmail() == null || aluno.GetEmail().Trim().Equals(""))
     {
         throw new ExcecaoSAG("Email deve ser preenchido");
     }
     return(true);
 }