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(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;
                }
            }
        }
Ejemplo n.º 2
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();
                    controller.ListCompletedTransactions(ref listCompleteTransactionsDialog);
                    //listCompleteTransactionsDialog.AddDisplayItems(null); // XXX null is a dummy argument
                    if (listCompleteTransactionsDialog.Display() == DialogReturn.Done)
                    {
                        return;
                    }
                    // select button is pressed

                    showCompleteTransactionDialog.ClearDisplayItems();
                    controller.PopulateCompletedTransaction(ref showCompleteTransactionDialog, controller.CompletedTransactions[listCompleteTransactionsDialog.SelectedIndex]);
                    //showCompleteTransactionDialog.AddDisplayItems(null); // XXX null is a dummy argument
                    switch (showCompleteTransactionDialog.Display())
                    {
                    case DialogReturn.Remove:     // transaction Remove
                        // XXX
                        controller.RemoveCompletedTransaction(controller.CompletedTransactions[listCompleteTransactionsDialog.SelectedIndex]);
                        continue;

                    case DialogReturn.Done:
                        continue;
                    }
                }
                catch (BookShopException bsex)
                {
                    MessageBox.Show(this, bsex.ErrorMessage);
                    continue;
                }
            }
        }
Ejemplo n.º 3
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;
                }
            }
        }