Example #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(null); // XXX null is a dummy argument

                    foreach (Transaction tran in BookShopControl.listOfCompleteTransactions)
                    {
                        listCompleteTransactionsDialog.AddDisplayItems(tran.customerName.userName + " : " + tran.ToString());
                    }
                    if (listCompleteTransactionsDialog.Display() == DialogReturn.Done)
                    {
                        return;
                    }
                    // select button is pressed

                    showCompleteTransactionDialog.ClearDisplayItems();
                    //showCompleteTransactionDialog.AddDisplayItems(null); // XXX null is a dummy argument

                    //moved it into it's own method but casted it to it's base class so i can use it for pending and complete
                    BookShopControl.listTransactionDetails((SelectDialog)showCompleteTransactionDialog, BookShopControl.listOfCompleteTransactions[listCompleteTransactionsDialog.SelectedIndex]);

                    switch (showCompleteTransactionDialog.Display())
                    {
                    case DialogReturn.Remove:     // transaction Remove
                        // XXX
                        BookShopControl.removeTransactionFromComplete(null);
                        continue;

                    case DialogReturn.Done:
                        continue;
                    }
                }
                catch (BookShopException bsex)
                {
                    MessageBox.Show(this, bsex.ErrorMessage);
                    continue;
                }
            }
        }