private void Delete_Click(object sender, RoutedEventArgs e) { if (this.GrupDiskonSelected == null) { MessageBox.Show("Customer Group not yet selected !"); } else { GrupDiskonBLL GrupDiskonBLL = new GrupDiskonBLL(); if (GrupDiskonBLL.RemoveGrupDiskon(this.GrupDiskonSelected.Id) == true) { MessageBox.Show("Customer Group successfully deleted"); this.LoadGrupDiskon(""); this.GrupDiskonSelected = null; } } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { if (txtGroupName.Text == "" || txtDiscount.Text == "" || txtNote.Text == "") { MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error); return; } GrupDiskonBLL GrupDiskonBLL = new GrupDiskonBLL(); if (this.customerGroupForm.isEdit == false) { if (GrupDiskonBLL.AddGrupDiskon(this.GetData()) > 0) { this.ClearForm(); MessageBox.Show("Customer Group successfully added !"); this.customerGroupForm.LoadGrupDiskon(""); } else { MessageBox.Show("Customer Group failed to add !"); } } else { if (GrupDiskonBLL.EditGrupDiskon(this.GetData()) == true) { this.ClearForm(); MessageBox.Show("Customer Group successfully changed !"); this.customerGroupForm.LoadGrupDiskon(""); } else { MessageBox.Show("Customer Group failed to change !"); } } this.Close(); }