private void btn_edit_Click(object sender, RoutedEventArgs e) { c = new ConnectionUtils(); sd = new sppdDAO(); var na = new StringBuilder(); na.Append(agenda.Text); na.Append(txt_separator1.Text); na.Append(txt_autoNumber.Text); na.Append(txt_separator2.Text); na.Append(txt_currentMonth.Text); na.Append(txt_separator3.Text); na.Append(txt_currentYear.Text); string no_agenda = na.ToString(); if (!edit) { edit = true; btn_hapus.IsEnabled = true; iconUbah.Kind = MaterialDesignThemes.Wpf.PackIconKind.ContentSaveOutline; } else { edit = false; btn_hapus.IsEnabled = false; iconUbah.Kind = MaterialDesignThemes.Wpf.PackIconKind.BriefcaseEditOutline; if (sd.updateDataSPPD(no_agenda.ToString(), txt_ds.Text.ToString(), dp_ts.Text.ToString(), cmb_namaPerangkat.Text.ToString(), IntegerExtensions.ParseInt(txt_nip.Text), txt_jabatan.Text.ToString(), txt_maksud.Text.ToString(), cmb_alat.Text.ToString(), txt_tempatBerangkat.Text.ToString(), txt_tempatTujuan.Text.ToString(), dp_tb.Text.ToString(), dp_tk.Text.ToString(), txt_lk.Text.ToString(), cmb_pengikut1.Text.ToString(), txt_jabatan_pengikut1.Text.ToString(), cmb_pengikut2.Text.ToString(), txt_jabatan_pengikut2.Text.ToString(), txt_sumberAnggaran.Text.ToString(), txt_ket.Text.ToString())) { MessageBox.Show("Berhasil Mengubah Data Bosku", "Success", MessageBoxButton.OK, MessageBoxImage.Information); } emptyFields(); loadTableSPPD(); sd.resetAutoIncrement(); } }
private void btn_hapus_Click(object sender, RoutedEventArgs e) { c = new ConnectionUtils(); sd = new sppdDAO(); var na = new StringBuilder(); na.Append(agenda.Text); na.Append(txt_separator1.Text); na.Append(txt_autoNumber.Text); na.Append(txt_separator2.Text); na.Append(txt_currentMonth.Text); na.Append(txt_separator3.Text); na.Append(txt_currentYear.Text); string no_agenda = na.ToString(); MessageBoxResult re = MessageBox.Show("Apakah anda yakin ingin menghapus Data ini bosku?", "Konfirmasi", MessageBoxButton.YesNo, MessageBoxImage.Question); if (re == MessageBoxResult.Yes) { if (!sd.CheckAgenda(no_agenda)) { if (sd.removeData(no_agenda)) { MessageBox.Show("Berhasil Menghapus Data Bosku", "Succes", MessageBoxButton.OK, MessageBoxImage.Information); emptyFields(); loadTableSPPD(); sd.resetAutoIncrement(); } } else { MessageBox.Show("Data Tidak Ditemukan Bosku", "Gagal Menghapus", MessageBoxButton.OK, MessageBoxImage.Error); } } else { //Exit Selection } }