示例#1
0
        /// <summary>
        /// Double CLick action for the datagrid displaying the invoices.
        /// Double clicking will pass the selected invoice to a new modifyinvoice window and the user can then update the items, or item quantity.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InvoiceRow_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row = sender as DataGridRow;

            if (row != null)
            {
                viewNavigationController.ChangeCurrentView(new ModifyInvoice(this.viewNavigationController, (row.Item as Invoice)));
            }
        }
        /// <summary>
        /// This function is called when the button labeled Submit is clicked.
        /// A new invoice is generated if there is more than 1 lineitem in the shopping cart.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubmitButton_Button(object sender, RoutedEventArgs e)
        {
            if (shoppingCart.TotalLineItems == 0)
            {
                MessageBox.Show("You must first add Items to the list to submit an invoice.", "Error submitting");
            }
            else
            {
                //Call the method to create a new invoice with the selected items, current time and running total.
                clsMainLogic.submitNewInvoice(new Invoice(DateTime.Now.ToString(), runningTotal.ToString(), shoppingCart));

                //Return to main screen
                viewNavigationController.ChangeCurrentView(new wndMain(viewNavigationController));
            }
        }
        /// <summary>
        /// This is the submit button which will modify the invoice, really the only thing that can be modified in this setup is the quantity of item
        /// so this button action updates the quantity of item in the database.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubmitButton_Button(object sender, RoutedEventArgs e)
        {
            //clsMainLogic.addNewLineItems();

            //update the invoice total cost.
            clsMainLogic.updateInvoiceTotalCost(CurrentInvoice);
            viewNavigationController.ChangeCurrentView(new wndMain(viewNavigationController));
        }
示例#4
0
 /// <summary>
 /// Returns back to the Main window.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ExitButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ReadView();
         viewNavigationController.ChangeCurrentView(new wndMain(viewNavigationController));
     }
     catch (System.Exception ex)
     {
         HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                     MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }
示例#5
0
 private void AddNewInvoiceMenuButton_Action(object sender, RoutedEventArgs e)
 {
     viewNavigationController.ChangeCurrentView(new NewInvoice(viewNavigationController));
 }
示例#6
0
 private void ReturnToMainButton_Action(object sender, RoutedEventArgs e)
 {
     viewNavigationController.ChangeCurrentView(new wndMain(viewNavigationController));
 }