Пример #1
0
  public void deleteRentIdp(Emp emp) {
    int count = 0;

    try {
      deleteRentById_pStmt.setInt(1, emp.getId_pracownik());

      count = deleteRentById_pStmt.executeUpdate();
    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
Пример #2
0
  public List<Rent> getRentbyIdp(Emp emp) {
    List<Rent> rents = new ArrayList<Rent>();

    try {

      getRentById_pStmt.setInt(1, emp.getId_pracownik());
      ResultSet rs = getRentById_pStmt.executeQuery();

      while (rs.next()) {
        Rent e = new Rent();
        e.setId_wypozyczenie(rs.getInt("id_wypozyczenie"));
        e.setIdreff_samochod(rs.getInt("idreff_samochod"));
        e.setIdreff_pracownik(rs.getInt("idreff_pracownik"));
        e.setData_wypozyczenia(rs.getString("data_wypozyczenia"));
        e.setIlosc_dni(rs.getInt("ilosc_dni"));
        e.setOplata(rs.getInt("oplata"));
        rents.add(e);
      }

    } catch (SQLException e) {
      e.printStackTrace();
    }
    return rents;
  }