public List<partners> listar() throws Exception { List<partners> lista; ResultSet rs; try { this.Conectar(); PreparedStatement st = this.getCon().prepareCall("select * from partner"); rs = st.executeQuery(); lista = new ArrayList(); while (rs.next()) { partners part = new partners(); part.setIdPartner(rs.getInt("id")); part.setName(rs.getString("name")); part.setLastName(rs.getString("lastName")); part.setStreet(rs.getString("street")); part.setNoExt(rs.getString("noExt")); part.setNoInt(rs.getString("noInt")); part.setColony(rs.getString("Colony")); part.setZip(rs.getString("Zip")); part.setLocality(rs.getString("Locality")); part.setPhone(rs.getString("Phone")); part.setMobile(rs.getString("Mobile")); part.setEmail(rs.getString("Email")); part.setCustomer(rs.getBoolean("Customer")); part.setSupplier(rs.getBoolean("Supplier")); part.setImage(rs.getBytes("image")); part.setCity_id(rs.getInt("City_id")); part.setState_id(rs.getInt("State_id")); part.setCountry_id(rs.getInt("Country_id")); part.setActive(rs.getInt("active")); lista.add(part); } } catch (Exception e) { throw e; } finally { this.Cerrar(); } return lista; }
public partners LeerID_Actualizar(int pa) throws Exception { partners part = null; ResultSet rs; try { this.Conectar(); PreparedStatement st = this.getCon().prepareStatement("" + "select * from partner where id= ? "); st.setInt(1, pa); rs = st.executeQuery(); while (rs.next()) { part = new partners(); part.setIdPartner(rs.getInt("id")); part.setName(rs.getString("name")); part.setLastName(rs.getString("lastname")); part.setStreet(rs.getString("street")); part.setNoExt(rs.getString("noExt")); part.setNoInt(rs.getString("noInt")); part.setColony(rs.getString("Colony")); part.setZip(rs.getString("Zip")); part.setLocality(rs.getString("Locality")); part.setPhone(rs.getString("Phone")); part.setMobile(rs.getString("Mobile")); part.setCustomer(rs.getBoolean("Customer")); part.setSupplier(rs.getBoolean("Supplier")); part.setImage(rs.getBytes("image")); part.setCity_id(rs.getInt("City_id")); part.setState_id(rs.getInt("State_id")); part.setCountry_id(rs.getInt("Country_id")); } } catch (Exception e) { throw e; } finally { this.Cerrar(); } return part; }