Beispiel #1
0
        private void bnTransactionHistory_Click(object sender, EventArgs e)
        {
            // XXX Transaction History button handler
            while (true)
            {
                try
                {  // to capture an exception from SelectedIndex/SelectedItem of listTransactionHistoryDialog
                    if (_attachedControl.IsLoggedIn())
                    {
                        listTransactionHistoryDialog.ClearDisplayItems();
                        listTransactionHistoryDialog.AddDisplayItems(_attachedControl.CurrentCustomer.OrderHistory.ToArray()); // null is a dummy argument
                        if (listTransactionHistoryDialog.Display() == DialogReturn.Done)
                        {
                            return;
                        }
                        // Select is pressed
                        Transaction selectedTransaction = (Transaction)listTransactionHistoryDialog.SelectedItem;

                        showTransactionDialog.ClearDisplayItems();
                        showTransactionDialog.AddDisplayItems(selectedTransaction.BookList.ToArray()); // null is a dummy argument
                        showTransactionDialog.AddDisplayItems(selectedTransaction.CartTotalArray());
                        showTransactionDialog.ShowDialog();
                    }
                    else
                    {
                        throw new BookShopException("Customer not logged in.");
                    }
                }
                catch (BookShopException bsex)
                {
                    MessageBox.Show(this, bsex.ErrorMessage);
                }
            }
        }
Beispiel #2
0
        private void bnTransactionHistory_Click(object sender, EventArgs e)
        {
            // XXX Transaction History button handler
            while (true)
            {
                try
                {  // to capture an exception from SelectedIndex/SelectedItem of listTransactionHistoryDialog
                    listTransactionHistoryDialog.ClearDisplayItems();
                    controller.ShowCustomerHistory(ref listTransactionHistoryDialog);
                    //listTransactionHistoryDialog.AddDisplayItems(null); // null is a dummy argument
                    if (listTransactionHistoryDialog.Display() == DialogReturn.Done)
                    {
                        return;
                    }
                    // Select is pressed


                    showTransactionDialog.ClearDisplayItems();
                    showTransactionDialog.AddDisplayItems(controller.CurrentCustomer.History[listTransactionHistoryDialog.SelectedIndex].Cart.ToArray());
                    showTransactionDialog.AddDisplayItems("====================================================");
                    showTransactionDialog.AddDisplayItems("Total Price: $" + controller.CurrentCustomer.History[listTransactionHistoryDialog.SelectedIndex].Price);
                    //showTransactionDialog.AddDisplayItems(null); // null is a dummy argument
                    showTransactionDialog.ShowDialog();
                }
                catch (BookShopException bsex)
                {
                    MessageBox.Show(this, bsex.ErrorMessage);
                    return;
                }
            }
        }
        public void showPastCartInformation(ShowTransactionDialog cart, Transaction tran)
        {
            if (!isCustomerLoggedIn)
            {
                throw new NullReferenceException("You are not logged in.");
            }

            for (int i = 0; i < tran.subTransactionCount; i++)
            {
                cart.AddDisplayItems(tran.itemsPurchased[i].ToString());
            }
            cart.AddDisplayItems("=======================================================");
            cart.AddDisplayItems("Total Price : $" + tran.totalPrice);
        }