private static void CheckID(JPanel PanelComponent, AdmUnity admUnity, AdmNewUnity admNewUnity) { String id; id = UnityLog.getId(); String message, sql; sql = "SELECT id AS `ID` FROM unity_id WHERE id = '" + id + "';"; resultSet = SQLAdapter.getData(sql); try { if (resultSet.next()) { message = "Mohon gunakan id lain !"; Pesan.Warning(message); } else { SaveUnity(PanelComponent, admUnity, admNewUnity); } } catch (SQLException ex) { ex.printStackTrace(); } }
private static void CheckID(String idUpdate, JPanel PanelComponent, RootPeoples rootPeoples) { String message, sql; sql = "SELECT person_id.id AS `ID` " + "FROM person_id " + "WHERE person_id.id = '" + idUpdate + "';"; resultSet = SQLAdapter.getData(sql); try { if (resultSet.next()) { message = "Mohon gunakan id lain !"; Pesan.Warning(message); } else { UpdatePersonID(idUpdate, PanelComponent, rootPeoples); } } catch (SQLException ex) { ex.printStackTrace(); } }
public static void GettingInformation( JLabel labelCompanyID, JLabel labelCompanyName, JLabel labelCompanyPhone, JLabel labelCompanyDirectedBy, JLabel labelCompanyCity, JLabel labelCompanyAddress, link linkCompanyEmployersCount) { String rootID, sql; rootID = UserLog.getId(); sql = "SELECT office_id.id AS `Office ID`, office_id.nama AS `Office Name`, office_id.kontak AS `Office Phone`, " + "person_id.nama AS `Directed by`, person_id.kelamin AS `Kelamin`, " + "office_id.kota AS `Office City`, office_id.alamat AS `Office Address`, " + "(SELECT COUNT(office_peoples.id_person) AS `Count Peoples`" + " " + "FROM office_id, office_peoples, person_id" + " " + "WHERE " + " " + "office_peoples.id_office = office_id.id AND" + " " + "person_id.id = office_peoples.id_person" + ") AS `Employers Count` " + "FROM office_id, office_peoples, person_id " + "WHERE office_peoples.id_office = office_id.id AND " + "person_id.id = office_peoples.id_person AND " + "office_id.id_person = '" + rootID + "';"; resultSet = SQLAdapter.getData(sql); try { if (resultSet.next()) { String id, nama, kontak, pemilik, preparedPemilik, kelamin, kota, alamat; id = resultSet.getString("Office ID"); nama = resultSet.getString("Office Name"); kontak = resultSet.getString("Office Phone"); preparedPemilik = resultSet.getString("Directed by"); kelamin = resultSet.getString("Kelamin"); if (kelamin.equals("Laki-laki") == true) { pemilik = "Tn." + " " + preparedPemilik; } else { pemilik = "Ny." + " " + preparedPemilik; } kota = resultSet.getString("Office City"); alamat = resultSet.getString("Office Address"); Integer count; count = resultSet.getInt("Employers Count"); labelCompanyID.setText(id); labelCompanyName.setText(nama); labelCompanyPhone.setText(kontak); labelCompanyDirectedBy.setText(pemilik); labelCompanyCity.setText(kota); labelCompanyAddress.setText(alamat); String message; if (count == 0) { message = "No employer !"; } else { if (count == 1) { message = count.toString() + " " + "Employer"; } else { message = count.toString() + " " + "Employers"; } } linkCompanyEmployersCount.setText(message); SetInformation(id, nama, kontak, pemilik, kota, alamat); } } catch (SQLException ex) { ex.printStackTrace(); } }