public override void delete(int id) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Patron))); string query = "DELETE FROM `patron` WHERE `patron`.`id` = @identifier;"; Value values = new Value(); values.add("@identifier", id.ToString()); db.ExecSQL(query, values); }
public override bool update(Patron dto) { if (dto != null && dto.isValid() && dto.getid() > 0) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Patron))); string query = "UPDATE `patron` SET `nombre` = @nombre WHERE `patron`.`id` = @identifier;"; Value values = new Value(); values.add("@nombre", dto.getnombre()); values.add("@identifier", dto.getid().ToString()); return(db.ExecSQL(query, values)); } return(false); }
public override bool update(Tendencia dto) { if (dto != null && dto.isValid() && dto.getid() > 0) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Tendencia))); string query = "UPDATE `tendencia` SET `Categoria_id` = @Categoria_id, `Patron_id` = @Patron_id, `medida` = @medida WHERE `tendencia`.`id` = @identifier;"; Value values = new Value(); values.add("@Categoria_id", dto.getCategoria_id().ToString()); values.add("@Patron_id", dto.getPatron_id().ToString()); values.add("@medida", dto.getmedida().ToString()); values.add("@identifier", dto.getid().ToString()); return(db.ExecSQL(query, values)); } return(false); }
public void setKnowledge(Patron patron, Categoria cat) { if (patron != null && cat != null) { if (!String.IsNullOrEmpty(patron.getnombre()) && cat.getid() > 0) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Tendencia))); string query = "CALL `setKnowledge`(@p0, @p1);"; Value values = new Value(); values.add("@p0", patron.getnombre()); values.add("@p1", cat.getid().ToString()); db.ExecSQL(query, values); } } }
//Methods public override bool create(Patron dto) { if (dto != null && dto.isValid()) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Patron))); string query = "INSERT INTO `patron` ( `id`, `nombre`) VALUES ( NULL, @nombre);"; Value values = new Value(); values.add("@nombre", dto.getnombre()); if (db.ExecSQL(query, values)) { dto.setid((int)db.getLastInsertedID()); return(true); } } return(false); }
//Methods public override bool create(Tendencia dto) { if (dto != null && dto.isValid()) { MySQL_DBManager db = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Tendencia))); string query = "INSERT INTO `tendencia` ( `id`, `Categoria_id`, `Patron_id`, `medida`) VALUES ( NULL, @Categoria_id, @Patron_id, @medida);"; Value values = new Value(); values.add("@Categoria_id", dto.getCategoria_id().ToString()); values.add("@Patron_id", dto.getPatron_id().ToString()); values.add("@medida", dto.getmedida().ToString()); if (db.ExecSQL(query, values)) { dto.setid((int)db.getLastInsertedID()); return(true); } } return(false); }