예제 #1
0
 public int Inserir(modelo.Cliente c)
 {
     if (ta.GetCodigo(c.Telefone) != null)
     {
         return(int.Parse(ta.GetCodigo(c.Telefone).ToString()));
     }
     else
     {
         int rc = 0;
         try
         {
             ta.Insert(c.Nome, c.Telefone, c.Endereco);
             rc = int.Parse(ta.GetCodigo(c.Telefone).ToString());
         }
         catch (System.Data.SqlClient.SqlException ex)
         {
             rc = -1;
             Console.WriteLine(ex.Message);
         }
         return(rc);
     }
 }