Beispiel #1
0
 public static int Update(Cliente cliente)
 {
     if (cliente != null)
     {
         string        sql     = string.Format("UPDATE Cliente SET Nombre='{0}', Apellido='{1}' WHERE IdCliente={2}", cliente.Nombre, cliente.Apellido, cliente.IdCliente);
         IDbConnection conn    = ComunBD.CreateConnection();
         IDbCommand    comando = ComunBD.CreateCommand(conn, sql);
         return(ComunBD.ExecuteNonQueryTransaction(conn, comando));
     }
     return(0);
 }
Beispiel #2
0
 public static int Delete(long?id)
 {
     if (id != null)
     {
         string        sql     = string.Format("DELETE Cliente WHERE IdCliente={0}", id);
         IDbConnection conn    = ComunBD.CreateConnection();
         IDbCommand    comando = ComunBD.CreateCommand(conn, sql);
         return(ComunBD.ExecuteNonQueryTransaction(conn, comando));
     }
     return(0);
 }
Beispiel #3
0
 public static int Insert(Cliente cliente)
 {
     if (cliente != null)
     {
         string        sql     = string.Format("INSERT INTO Cliente(Nombre, Apellido)VALUES('{0}', '{1}')", cliente.Nombre, cliente.Apellido);
         IDbConnection conn    = ComunBD.CreateConnection();
         IDbCommand    comando = ComunBD.CreateCommand(conn, sql);
         return(ComunBD.ExecuteNonQueryTransaction(conn, comando));
     }
     return(0);
 }