//ELIMINAR Telefono de Taller public int eliminarTelefonoTaller(int cod) { NpgsqlConnection conn = DAOTelefono.getInstanceDAO(); conn.Open(); String sql = "DELETE FROM \"Telefono\" WHERE \"FK-TallerT\" = " + cod + ""; NpgsqlCommand cmd = new NpgsqlCommand(sql, conn); int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE conn.Close(); return(resp); }
//INSERTAR Telefono de Empleado public int insertarTelefonoEmp(int numero, int fkE) { NpgsqlConnection conn = DAOTelefono.getInstanceDAO(); conn.Open(); String sql = "INSERT INTO \"Telefono\" (\"COD\", \"Numero\", \"FK-Empleado\") " + "VALUES ((SELECT NEXTVAL('seq'))," + numero + ", " + fkE + ")"; NpgsqlCommand cmd = new NpgsqlCommand(sql, conn); try { int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE conn.Close(); return(resp); } catch { conn.Close(); return(0); } }
//MODIFICAR Telefono de Taller public int modificarTelefonoTaller(int fk, int numero) { NpgsqlConnection conn = DAOTelefono.getInstanceDAO(); conn.Open(); String sql = "UPDATE \"Telefono\" SET \"Numero\"='" + numero + "'" + "WHERE \"FK-TallerT\"= " + fk + ""; NpgsqlCommand cmd = new NpgsqlCommand(sql, conn); try { int resp = cmd.ExecuteNonQuery(); //CONTROLAR EXCEPTION DE UNIQUE conn.Close(); return(resp); } catch { conn.Close(); return(0); } }