private static void SaveUnity(JPanel PanelComponent, AdmUnity admUnity, AdmNewUnity admNewUnity) { String id, satuan; id = UnityLog.getId(); satuan = UnityLog.getSatuan(); String message, sql; sql = "INSERT INTO " + "unity_id(id, satuan) " + "VALUES('" + id + "', '" + satuan + "')"; Integer operation; operation = SQLAdapter.dataOperation(1, sql); if (operation == 1) { message = "Data berhasil disimpan."; Pesan.Information(message); admNewUnity.setVisible(false); CloseFrame(PanelComponent, admUnity); } }
private static void UpdatePersonID( String idUpdate, JPanel PanelComponent, RootPeoples rootPeoples) { String idDefault; idDefault = PeoplesLog.getId(); String nama, kelamin, kota, tglLahir, dLahir, kontak, alamat; nama = PeoplesLog.getNama(); kelamin = PeoplesLog.getKelamin(); kota = PeoplesLog.getKota(); tglLahir = PeoplesLog.getTglLahir(); dLahir = PeoplesLog.getdLahir(); kontak = PeoplesLog.getKontak(); alamat = PeoplesLog.getAlamat(); String message, sql; if (idUpdate.equals(idDefault) == true) { sql = "UPDATE person_id " + "SET " + "nama = '" + nama + "', kelamin = '" + kelamin + "', kota = '" + kota + "', " + "tgl_lahir = '" + tglLahir + "', d_lahir = '" + dLahir + "', " + "kontak = '" + kontak + "', alamat = '" + alamat + "' " + "WHERE id = '" + idDefault + "';"; } else { sql = "UPDATE person_id " + "SET " + "id = '" + idUpdate + "', " + "nama = '" + nama + "', kelamin = '" + kelamin + "', kota = '" + kota + "', " + "tgl_lahir = '" + tglLahir + "', d_lahir = '" + dLahir + "', " + "kontak = '" + kontak + "', alamat = '" + alamat + "' " + "WHERE id = '" + idDefault + "';"; } Integer operation; operation = SQLAdapter.dataOperation(1, sql); if (operation == 1) { message = "Terima kasih telah memperbaharui data."; Pesan.Information(message); ReturnFrame(PanelComponent, rootPeoples); } }