Ejemplo n.º 1
0
 @Override
 public List<TravelAgent> getAll() {
   this.list = new ArrayList<TravelAgent>();
   try {
     this.stat = this.conn.createStatement();
     this.rs = this.stat.executeQuery(SELECT_ALL);
     while (rs.next()) {
       TravelAgent ag = new TravelAgent();
       ag.setId(rs.getString("id_agent"));
       ag.setName(rs.getString("name_agent"));
       ag.setAlamat(rs.getString("alamat_agent"));
       ag.setNegara(rs.getString("negara_agent"));
       ag.setProvinsi(rs.getString("provinsi_agent"));
       ag.setWebsite(rs.getString("website_agent"));
       ag.setPhone(rs.getString("telp_agent"));
       ag.setEmail(rs.getString("email_agent"));
       ag.setFax(rs.getString("fax_agent"));
       ag.setRegDate(rs.getString("reg_agent"));
       ag.setStatus(rs.getInt("status_agent"));
       ag.setContactName(rs.getString("contact_name_agent"));
       ag.setContactPosisi(rs.getString("contact_posisi_agent"));
       ag.setContactPhone(rs.getString("contact_phone_agent"));
       ag.setFee(rs.getInt("fee_agent"));
       this.list.add(ag);
     }
   } catch (SQLException ex) {
     Logger.getLogger(PegawaiDAO.class.getName()).log(Level.SEVERE, null, ex);
   }
   return this.list;
 }
Ejemplo n.º 2
0
  @Override
  public boolean insert(TravelAgent agent) {
    boolean bool = false;

    try {
      this.pStat = this.conn.prepareStatement(INSERT);
      this.pStat.setString(1, agent.getId());
      this.pStat.setString(2, agent.getName());
      this.pStat.setString(3, agent.getAlamat());
      this.pStat.setString(4, agent.getProvinsi());
      this.pStat.setString(5, agent.getNegara());
      this.pStat.setString(6, agent.getPhone());
      this.pStat.setString(7, agent.getFax());
      this.pStat.setString(8, agent.getEmail());
      this.pStat.setString(9, agent.getWebsite());
      this.pStat.setDouble(10, agent.getFee());
      this.pStat.setInt(11, agent.getStatus());
      this.pStat.setString(12, agent.getContactName());
      this.pStat.setString(13, agent.getContactPosisi());
      this.pStat.setString(14, agent.getContactPhone());
      if (this.pStat.executeUpdate() == 1) {
        bool = true;
      } else {
        bool = false;
      }

    } catch (SQLException ex) {
      System.out.println(ex.getMessage());
    }
    return bool;
  }
Ejemplo n.º 3
0
  @Override
  public boolean update(String id, TravelAgent agent) {
    try {
      this.pStat = this.conn.prepareStatement(UPDATE);
      this.pStat.setString(1, agent.getName());
      this.pStat.setString(2, agent.getAlamat());
      this.pStat.setString(3, agent.getProvinsi());
      this.pStat.setString(4, agent.getNegara());
      this.pStat.setString(5, agent.getPhone());
      this.pStat.setString(6, agent.getFax());
      this.pStat.setString(7, agent.getEmail());
      this.pStat.setString(8, agent.getWebsite());
      this.pStat.setDouble(9, agent.getFee());
      this.pStat.setInt(10, agent.getStatus());
      this.pStat.setString(11, agent.getContactName());
      this.pStat.setString(12, agent.getContactPosisi());
      this.pStat.setString(13, agent.getContactPhone());
      this.pStat.setString(14, id);
      if (this.pStat.executeUpdate() == 1) {
        return true;
      } else {
        return false;
      }
    } catch (SQLException e) {

    }
    return false;
  }