private void Delete_Click(object sender, RoutedEventArgs e) { if (this.KlasifikasiKontakSelected == null) { MessageBox.Show("Contact classification has not been selected !"); } else { KlasifikasiKontakBLL KlasifikasiKontakBLL = new KlasifikasiKontakBLL(); if (KlasifikasiKontakBLL.RemoveKlasifikasiKontak(this.KlasifikasiKontakSelected.Id) == true) { MessageBox.Show("Contact Classification successfully deleted"); this.LoadKlasifikasiKontak(); this.KlasifikasiKontakSelected = null; } } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { if (CbContactType.Text == "" || txtKlasifikasiKontak.Text == "" || txtNote.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } KlasifikasiKontakBLL KlasifikasiKontakBLL = new KlasifikasiKontakBLL(); if (this.ContactClasificationForm.isEdit == false) { if (KlasifikasiKontakBLL.AddKlasifikasiKontak(this.GetData()) > 0) { this.ClearForm(); MessageBox.Show("Contact Classification successfully added !"); this.ContactClasificationForm.LoadKlasifikasiKontak(); } else { MessageBox.Show("Contact Classification failed to be added !"); } } else { if (KlasifikasiKontakBLL.EditKlasifikasiKontak(this.GetData()) == true) { this.ClearForm(); MessageBox.Show("Contact Classification successfully changed !"); this.ContactClasificationForm.LoadKlasifikasiKontak(); } else { MessageBox.Show("Contact Classification failed to change !"); } } this.Close(); }