Example #1
0
        //Precondition: checkout menu item click
        //Postcondition: show checkout form and pass data to checkout form
        private void checkoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CheckOutForm checkOutDialog = new CheckOutForm(LibraryData.GetItemsList(), LibraryData.GetPatronsList());
            DialogResult result;

            result = checkOutDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                LibraryData.CheckOut(checkOutDialog.items, checkOutDialog.patrons);
            }
        }
Example #2
0
        //Precondition: Item -> Checkout item is activated
        //Postcondition: item is checked out
        private void checkOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <LibraryItem>   items;   //List of library items
            List <LibraryPatron> patrons; //List of library patrons

            items   = library.GetItemsList();
            patrons = library.GetPatronsList();

            CheckOutForm checkoutForm = new CheckOutForm(items, patrons); //Check out dialog box form
            DialogResult result       = checkoutForm.ShowDialog();        //Show form as dialog & store the result

            if (result == DialogResult.OK)
            {
                library.CheckOut(checkoutForm.ItemIndex, checkoutForm.PatronIndex);
            }
        }
Example #3
0
        // Precondition:  None
        // Postcondition: Checkouts the items and updates the mainform.
        private void checkOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //sends the items, and patrons list to the checkout subform
            CheckOutForm checkoutForm = new CheckOutForm(_lib._items, _lib._patrons);
            DialogResult result;          //holds the dialog result
            int          itemIndx;        //holds the item index
            int          patron;          //holds the patron index


            result = checkoutForm.ShowDialog();

            if (result == DialogResult.OK)        //  updates when checkout is selected from dialog box
            {
                itemIndx = checkoutForm.ItemIndex;
                patron   = checkoutForm.PatronIndex;
                _lib.CheckOut(itemIndx, patron);
                MessageBox.Show("You just checked out a library item!");
            }
        }
Example #4
0
        private void checkOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //precondition: none
            //postcondition: item is checked out by patron

            CheckOutForm checkoutBox = new CheckOutForm(item._items, item._patrons);
            DialogResult result;

            result = checkoutBox.ShowDialog();



            if (checkoutBox.bookComboBox.SelectedIndex >= 0 && checkoutBox.patronComboBox.SelectedIndex >= 0)
            {
                item._items[checkoutBox.bookComboBox.SelectedIndex].
                CheckOut(item._patrons[checkoutBox.patronComboBox.SelectedIndex]);
            }
            //check out
        }