Exemple #1
0
        private void BtnCheckIn_Click(object sender, EventArgs e)
        {
            List <Book> memberBooks = LibraryDB.GetMemberBooks();

            if (memberBooks != null)
            {
                var selectedItems = chkListCheckedOut.SelectedItems;

                List <Book> selectedBooks = GetSelectedItems(
                    selectedItems);

                if (LibraryDB.CheckInBooks(selectedBooks))
                {
                    MessageBox.Show("Check-In Successful.");

                    LoadBoxes();
                }
                else
                {
                    MessageBox.Show("Nothing selected.");
                }
            }
            else
            {
                MessageBox.Show("Nothing to check-in.");
            }
        }
Exemple #2
0
        /// <summary>
        /// Clears form and loads list boxes with data.
        /// </summary>
        private void LoadBoxes()
        {
            chkListCheckedOut.Items.Clear();

            List <Book> checkedBooks =
                LibraryDB.GetMemberBooks();

            if (checkedBooks != null)
            {
                foreach (Book b in checkedBooks)
                {
                    chkListCheckedOut.Items.Add($"{b.ISBN}, " +
                                                $"{b.Title},  " +
                                                $"{b.Author},  " +
                                                $"{b.PubDate},  " +
                                                $"{b.Category}");
                }
            }

            cboBooksAvail.Items.Clear();

            List <Book> uncheckedBooks =
                LibraryDB.GetAllUncheckedBooks();

            if (uncheckedBooks != null)
            {
                foreach (Book b in uncheckedBooks)
                {
                    cboBooksAvail.Items.Add($"{b.ISBN}, " +
                                            $"{b.Title},  " +
                                            $"{b.Author},  " +
                                            $"{b.PubDate},  " +
                                            $"{b.Category}");
                }
            }

            lstSelectedBooks.Items.Clear();
        }