Ejemplo n.º 1
0
        private void bnCompleteTransactions_Click(object sender, EventArgs e)
        {
            // XXX List Complete Transactions button event handler

            while (true)
            {
                try
                {                                                                                              // to capture an exception from SelectedItem/SelectedIndex of listCompleteTransactionsDialog
                    listCompleteTransactionsDialog.ClearDisplayItems();
                    listCompleteTransactionsDialog.AddDisplayItems(_attachedControl.CompleteOrders.ToArray()); // XXX null is a dummy argument
                    if (listCompleteTransactionsDialog.Display() == DialogReturn.Done)
                    {
                        return;
                    }
                    // select button is pressed
                    Transaction selectedTransaction = (Transaction)listCompleteTransactionsDialog.SelectedItem;
                    showCompleteTransactionDialog.ClearDisplayItems();
                    showCompleteTransactionDialog.AddDisplayItems(selectedTransaction.BookList.ToArray()); // XXX null is a dummy argument
                    showCompleteTransactionDialog.AddDisplayItems(selectedTransaction.CartTotalArray());
                    switch (showCompleteTransactionDialog.Display())
                    {
                    case DialogReturn.Remove:     // transaction Remove
                        // XXX
                        _attachedControl.CompleteOrders.Remove(selectedTransaction);
                        continue;

                    case DialogReturn.Done:
                        continue;
                    }
                }
                catch (BookShopException bsex)
                {
                    MessageBox.Show(this, bsex.ErrorMessage);
                    continue;
                }
            }
        }
Ejemplo n.º 2
0
 public void PopulateCompletedTransaction(ref ShowCompleteTransactionDialog scp, Transaction t)
 {
     scp.AddDisplayItems(t.Cart.ToArray());
     scp.AddDisplayItems("====================================================");
     scp.AddDisplayItems("Total Price: $" + t.Price);
 }