private void btnApprove_Click(object sender, RoutedEventArgs e) { if (_supplierMgr != null) { if (_supplier.IsApproved) { MessageBox.Show("Cannot re-add supplier, Supplier already approved", "Supplier already approved", MessageBoxButton.OK, MessageBoxImage.Exclamation); this.Close(); } else { try { if (_supplierMgr.ApproveSupplier(_supplier, _userid)) { MessageBox.Show("Supplier approved.", "System Updated", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { MessageBox.Show("Supplier record not altered", "Oops, no record was modified", MessageBoxButton.OK, MessageBoxImage.Hand); } } catch (Exception) { MessageBox.Show("There was an error approving this record. Please try again later", "Oops, something went wrong", MessageBoxButton.OK, MessageBoxImage.Error); } this.DialogResult = true; } } if (_customerMgr != null) { try { if (_customerMgr.ApproveCommercialCustomer(_commercialCustomer, _userid)) { MessageBox.Show("Commercial Customer approved.", "System Updated", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { MessageBox.Show("Commercial Customer record not altered", "Oops, no record was modified", MessageBoxButton.OK, MessageBoxImage.Hand); } } catch (Exception) { MessageBox.Show("There was an error approving this record. Please try again later", "Oops, something went wrong", MessageBoxButton.OK, MessageBoxImage.Error); } } this.Close(); }