public bool Delete(int id) { string MYSql_Statement = "delete from clients where idclients = " + id; using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { return(true); } } }
public bool Insert(Cliente cliente) { string MYSql_Statement = "insert into clients (nombre) value ('" + cliente.Nombre + "')"; using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { return(true); } } }
public bool Insert(Direccion direccion) { string MYSql_Statement = "insert into direcciones (fkclients, calle, altura) value (" + direccion.fkClients + ",'" + direccion.Calle + "', " + direccion.Altura + ")"; using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { return(true); } } }
public bool Update(Cliente cliente) { string MYSql_Statement = "update clients set nombre = '" + cliente.Nombre + "' where idclients = " + cliente.id; using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { conexion.Open(); MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { return(true); } } }
public bool Update(Direccion direccion) { //Cliente clientAux = GetById(cliente.id); string MYSql_Statement = "update direcciones set calle = '" + direccion.Calle + "' where iddomicilios = " + direccion.id; using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { return(true); } } }
public Cliente GetById(int id) { string MYSql_Statement = "select idclients, nombre from clients where idclients = " + id; Cliente resultado = new Cliente(); using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { resultado = Mapper(dr); } } } return(resultado); }
public Direccion GetById(int id) { string MYSql_Statement = "select iddomicilios, calle, altura from direcciones where iddomicilios = " + id; Direccion resultado = new Direccion(); using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { resultado = Mapper(dr); } } } return(resultado); }
public List <Cliente> GetAll() { const string MYSql_Statement = "select idclients, nombre from clients"; List <Cliente> resultado = new List <Cliente>(); using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { Cliente cliente = Mapper(dr); resultado.Add(cliente); } } } return(resultado); }
public List <Direccion> GetAll() { const string MYSql_Statement = "select iddomicilios, calle, altura from direcciones"; List <Direccion> resultado = new List <Direccion>(); using (MySqlConnection conexion = BasedeDatos.getInstancia().getConexion()) { MySqlCommand cmd = new MySqlCommand(MYSql_Statement, conexion); using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { Direccion direccion = Mapper(dr); resultado.Add(direccion); } } } return(resultado); }