public void updateStatusLamaran(int id, boolean accepted) { String status = accepted ? "accept" : "reject"; String query = String.format("UPDATE %s SET status='%s' WHERE id=%s", this.TABLE_NAME, status, id); super.openConnection(); try { super.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } finally { closeConnection(); } }
public void deletePelamar(int id_lowongan, String username) { String query = String.format( "DELETE FROM %s WHERE id_lowongan='%s' AND username='******'", TABLE_NAME, id_lowongan, username); openConnection(); try { super.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } finally { closeConnection(); } }
public void cregPelamar(int id_lowongan, String username) { super.openConnection(); String query = String.format( "INSERT INTO %s (id_lowongan, username, jenis) VALUES ('%s','%s','%s')", TABLE_NAME, id_lowongan, username, "close"); try { super.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } finally { closeConnection(); } }
/** * menambahkan user baru * * @param username * @param password */ public void insertUser(String username, String password) { super.openConnection(); String query = String.format( "INSERT INTO %s(username, password) VALUES ('%s', '%s')", TABLE_NAME, username, password); openConnection(); try { super.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } finally { closeConnection(); } }
/** * untuk edit user password * * @param username * @param password */ public void editUser(String username, String password) { super.openConnection(); String query = "UPDATE " + TABLE_NAME + " SET password='******' WHERE username='******'"; openConnection(); try { super.getStatement().executeUpdate(query); } catch (SQLException ex) { Logger.getLogger(Model.class.getName()).log(Level.SEVERE, null, ex); } finally { closeConnection(); } }