/// <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> /// Focuses the Search Window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SearchMenuItem_Click(object sender, RoutedEventArgs e) { this.Hide(); wndSearch wndSearch = new wndSearch(); clsInvoice selectedItem = wndSearch.ShowSearch(); if (selectedItem != null) { var tempInvoice = mainLogic.invoices.FirstOrDefault(m => m.Id == selectedItem.Id); InvoiceSelectionComboBox.SelectedItem = tempInvoice; } this.Show(); }
/// <summary> /// Takes the Selected Invoice, Selected Card, and the Quantity then calls the AddOrderToInvoice() function. /// </summary> /// <param name="sender">EditAddItemButton</param> /// <param name="e"></param> private void EditAddItemButton_Click(object sender, RoutedEventArgs e) { try { clsInvoice invoice = InvoiceSelectionComboBox.SelectedItem as clsInvoice; mainLogic.AddOrderToInvoice(invoice.Id, EditItemSelectionComboBox.SelectedIndex + 1, Int32.Parse(EditItemQuantityTextBox.Text)); int returnIndex = InvoiceSelectionComboBox.SelectedIndex; EditItemQuantityTextBox.Text = ""; SetComboBoxes(); InvoiceSelectionComboBox.SelectedIndex = returnIndex; } catch (Exception ex) { ExceptionHandler(ex); throw; } }