Beispiel #1
0
 public static void ValidaNumero(string numero)
 {
     if (!DefaultFactory.IsNumeric(numero))
     {
         throw new NewUserFailedException("Número do endereço inválido.");
     }
 }
 public static Telefone ValidaTelefone(int tipo, string ddd, string numero)
 {
     if (DefaultFactory.IsNumeric(ddd))
     {
         int dddConvertido = Convert.ToInt32(ddd);
         if (IsValidDdd(dddConvertido))
         {
             if (DefaultFactory.IsNumeric(numero))
             {
                 return(new Telefone()
                 {
                     Tipo = tipo, Ddd = dddConvertido, Numero = numero
                 });
             }
             else
             {
                 throw new NewUserFailedException("Número de telefone inválido.");
             }
         }
         else
         {
             throw new NewUserFailedException("DDD inválido.");
         }
     }
     else
     {
         throw new NewUserFailedException("DDD inválido.");
     }
 }