/// <summary> /// This will delete the selected invoice /// </summary> private void deleteButton_Click(object sender, RoutedEventArgs e) { try { _logic.DeleteInvoice(invoicesDataGrid.SelectedItem.ToString()); invoicesDataGrid.Items.Refresh(); } catch (Exception ex) { MessageBox.Show("Unable to delete invoice. " + ex.ToString(), "Error - deleteButton_Click", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
/// <summary> /// Takes the selected item from the InvoiceSelectionComboBox and calls the DeleteInvoice() Function. /// </summary> /// <param name="sender">DeleteInvoiceButton</param> /// <param name="e"></param> private void DeleteInvoiceButton_Click(object sender, RoutedEventArgs e) { try { clsInvoice selectedItem = InvoiceSelectionComboBox.SelectedItem as clsInvoice; mainLogic.DeleteInvoice(selectedItem.Id); SetComboBoxes(); } catch (Exception ex) { ExceptionHandler(ex); throw; } }
/// <summary> /// Delete invoice when delete button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeleteButton_Click(object sender, RoutedEventArgs e) { try { mainLogic.DeleteInvoice(); DataGridOrderSummary.IsEnabled = false; EditInvoice.IsChecked = false; ButtonNewInvoice.IsEnabled = true; ButtonEditInvoice.ToolTip = "Edit Invoice"; } catch (Exception ex) { HandleException(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }