Пример #1
0
  public void actualizar(partners pa) throws Exception {
    try {
      this.Conectar();
      System.out.println("Aqui vamos");
      String query =
          "update partner set name=?, lastname=?, street=?, noExt=?, noInt=?, colony=?, zip=?, locality=?, phone=?, mobile=?, email=?, customer=? ,supplier=?, image=?,city_id=?,state_id=?,country_id=?,active=? where id=?";
      PreparedStatement st = this.getCon().prepareStatement(query);
      st.setString(1, pa.getName());
      st.setString(2, pa.getLastName());
      st.setString(3, pa.getStreet());
      st.setString(4, pa.getNoExt());
      st.setString(5, pa.getNoInt());
      st.setString(6, pa.getColony());
      st.setString(7, pa.getZip());
      st.setString(8, pa.getLocality());
      st.setString(9, pa.getPhone());
      st.setString(10, pa.getMobile());
      st.setString(11, pa.getEmail());
      st.setBoolean(12, pa.getCustomer());
      st.setBoolean(13, pa.isSupplier());
      st.setBytes(14, pa.getImage());
      st.setInt(15, pa.getCity_id());
      st.setInt(16, pa.getState_id());
      st.setInt(17, pa.getCity_id());
      st.setInt(18, pa.getActive());
      st.setInt(19, pa.getIdPartner());
      st.executeUpdate();
    } catch (Exception e) {
      throw e;
    } finally {

      this.Cerrar();
    }
  }
Пример #2
0
 public void registrar(partners pa) throws Exception {
   try {
     this.Conectar();
     String query =
         "insert into partner (name,lastname,street,noExt,noInt,colony,zip,locality,phone,mobile,email,customer,supplier,image,city_id,state_id,country_id,active)"
             + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?); ";
     PreparedStatement st = this.getCon().prepareStatement(query);
     st.setString(1, pa.getName());
     st.setString(2, pa.getLastName());
     st.setString(3, pa.getStreet());
     st.setString(4, pa.getNoExt());
     st.setString(5, pa.getNoInt());
     st.setString(6, pa.getColony());
     st.setString(7, pa.getZip());
     st.setString(8, pa.getLocality());
     st.setString(9, pa.getPhone());
     st.setString(10, pa.getMobile());
     st.setString(11, pa.getEmail());
     st.setBoolean(12, pa.getCustomer());
     st.setBoolean(13, pa.isSupplier());
     st.setBytes(14, pa.getImage());
     st.setInt(15, pa.getCity_id());
     st.setInt(16, pa.getState_id());
     st.setInt(17, pa.getCity_id());
     st.setInt(18, pa.getActive());
     st.executeUpdate();
   } catch (Exception e) {
     throw e;
   } finally {
     this.Cerrar();
   }
 }