/// <summary>
        /// Creator: Jaeho Kim
        /// Created: 03/25/2020
        /// Approver: Rasha Mohammed
        ///
        /// Completes the transaction and performs the transaction entry operation.
        /// </summary>
        /// <remarks>
        /// Updater: NA
        /// Updated: NA
        /// Update: NA
        /// </remarks>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        private void btnCompleteTransaction_Click(object sender, RoutedEventArgs e)
        {
            var transactionType   = new TransactionType();
            var transactionStatus = new TransactionStatus();

            // This transactionDate operation
            // involves ignoring Milliseconds.
            // Seconds do count however!
            DateTime transactionDate = DateTime.Now;

            transactionDate = new DateTime(
                transactionDate.Ticks -
                (transactionDate.Ticks % TimeSpan.TicksPerSecond),
                transactionDate.Kind
                );
            // end transactionDate ignore milliseconds operation.

            var transaction = new Transaction();

            try
            {
                // This is for practical purposes. A cashier should not have to
                // constantly put in the transaction type for each transaction.
                // A default transaction type is retrieved from the database
                // everytime the transaction type text is empty.
                if (cbTransactionType.Text == "")
                {
                    transactionType        = _transactionManager.RetrieveDefaultTransactionType();
                    cbTransactionType.Text = transactionType.TransactionTypeID;
                }

                if (cbTransactionStatus.Text == "")
                {
                    transactionStatus        = _transactionManager.RetrieveDefaultTransactionStatus();
                    cbTransactionStatus.Text = transactionStatus.TransactionStatusID;
                }

                // if the transaction type was return or void, the values for item quantity
                // and total calculations must be negative.
                if (cbTransactionType.Text == "return")
                {
                    subTotalTaxable *= -1;
                    subTotal        *= -1;
                    total           *= -1;
                }

                if (cbTransactionType.Text == "void")
                {
                    subTotalTaxable *= -1;
                    subTotal        *= -1;
                    total           *= -1;
                }

                transaction.TransactionDateTime = transactionDate;
                transaction.TaxRate             = taxRate;
                transaction.SubTotalTaxable     = subTotalTaxable;
                transaction.SubTotal            = subTotal;
                transaction.Total               = total;
                transaction.TransactionTypeID   = cbTransactionType.Text.ToString();
                transaction.EmployeeID          = employeeID;
                transaction.TransactionStatusID = cbTransactionStatus.Text.ToString();
                transaction.TaxExemptNumber     = txtTaxExemptNumber.Text.ToString();

                transaction.CustomerEmail = txtEmail.Text.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + "Please set the default transaction type or status!");
            }

            var transactionLineProducts       = new TransactionLineProducts();
            List <ProductVM> ProductsSoldList = new List <ProductVM>();

            foreach (var item in _transactionManager.GetAllProducts())
            {
                // return transaction type!
                if (cbTransactionType.Text == "return")
                {
                    item.Quantity *= -1;
                }

                // return transaction type!
                if (cbTransactionType.Text == "void")
                {
                    item.Quantity *= -1;
                }
                ProductsSoldList.Add(item);
            }

            transactionLineProducts.ProductsSold = ProductsSoldList;

            try
            {
                // Creating the transaction in the database
                if (transaction.SubTotal != 0)
                {
                    if (collectPayment(transaction))
                    {
                        _transactionManager.AddTransaction(transaction);
                        _transactionManager.AddTransactionLineProducts(transactionLineProducts);
                        _transactionManager.EditItemQuantity(transactionLineProducts);

                        txtSearchProduct.Text   = "";
                        txtItemName.Text        = "";
                        chkTaxable.IsChecked    = false;
                        txtPrice.Text           = "";
                        txtQuantity.Text        = "";
                        txtItemDescription.Text = "";


                        cbTransactionType.Text   = "";
                        cbTransactionStatus.Text = "";

                        txtTaxExemptNumber.Text = "";
                        txtEmail.Clear();

                        txtTotal.Text           = "";
                        txtSubTotal.Text        = "";
                        txtSubTotalTaxable.Text = "";

                        dgShoppingCart.ItemsSource = null;
                        subTotalTaxable            = 0.0M;
                        subTotal = 0.0M;
                        total    = 0.0M;
                        _transactionManager.ClearShoppingCart();

                        btnAddProduct.Visibility = Visibility.Hidden;



                        MessageBox.Show("Transaction Complete", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        WPFErrorHandler.ErrorMessage("Payment Processing incomplete.");
                    }
                }
                else
                {
                    MessageBox.Show("Could Not Add Transaction!");
                }
            }
            catch (ApplicationException ae)
            {
                MessageBox.Show(ae.Message + "\n\n" + "You Must Enter Transaction Admin Data!");
            }
        }