コード例 #1
0
        private void resultsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Gets the selected book from the listbox, then finds the author
            int selectedIndex = resultsListBox.SelectedIndex;

            selectedBook = foundBooksFiltered[selectedIndex];
            PersonBLL selectedAuthor = people[selectedBook.AuthorID];

            //Finds the number of copies checked out for the book.
            int checkedOut = (from checkOut in logs
                              where checkOut.BookID == selectedBook.BookID
                              select checkOut).ToList().Count;

            //Display information about the selected book
            string output = selectedBook.Details(selectedAuthor, checkedOut);

            bookDetailTextBox.Text = output;
        }