/// <summary> /// Adds an invoice and blanks out everything. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddInvoice_Click(object sender, RoutedEventArgs e) { editing = true; btnAddInvoice.IsEnabled = false; btnEditInvoice.IsEnabled = false; btnDeleteInvoice.IsEnabled = true; btnSave.IsEnabled = true; btnCancel.IsEnabled = true; lblIDnum.Content = "TBD"; dpDatePick.IsEnabled = true; cbItems.IsEnabled = true; btnAddToCart.IsEnabled = true; try { MyInvoice = new InvoiceCls(-1); MyInvoice.GetNewInvoice(); //lblIDnum.Content = MyInvoice.invNum; lblTotalNum.Content = ""; dgItems.ItemsSource = MyInvoice.itemList; dpDatePick.SelectedDate = MyInvoice.date; //dpDatePick.Text = MyInvoice.date.ToString(); } catch (Exception ex) { HandleError("MainWindow.xaml.cs", System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Constructor. Instantiates window objects and /// maximizes self. /// </summary> public MainWindow() { winSearch = new wndSearch(); winUpdate = new AddItems(); //At startup, shouldn't have an invoice selected. try { MyInvoice = new InvoiceCls(-1); InitializeComponent(); WindowState = WindowState.Maximized; LoadInvoice(); } catch (Exception ex) { HandleError("MainWindow.xaml.cs", "MainWindow", ex.Message); } //SetUpComboBoxes(); //Is there a current Invoice ID? //OpenCurrentInvoice(); //sets the combo boxes to the correct selections //sets the data grid and whatever else. Label. //Else, Delete isn't an option }