コード例 #1
0
        private void btnSearchByBookTitle_Click(object sender, EventArgs e)
        {
            var bookmodels = EntityBroker.getBookModelByTitle(txtSearchByBookTitle.Text);

            dt.Rows.Clear();
            foreach (BooksModel bookmodel in bookmodels)
            {
                dt.Rows.Add(
                    bookmodel.BookTitle,
                    EntityBroker.getNumberOfBooksInLibraryByBookModelID(bookmodel.BookModelId),
                    EntityBroker.getNumberOfAvaiableBooksToRentInLibraryByBookModelID(bookmodel.BookModelId),
                    bookmodel.Author,
                    bookmodel.BookCategory,
                    bookmodel.MaxAvailableDayToRent,
                    bookmodel.BookModelId
                    );
            }

            dgvBooksList.DataSource = dt;
        }
コード例 #2
0
        private void ucListBooks_Load(object sender, EventArgs e)
        {
            var bookmodels = EntityBroker.getBooksModels();

            dt.Rows.Clear();
            foreach (BooksModel bookmodel in bookmodels)
            {
                dt.Rows.Add(
                    bookmodel.BookTitle,
                    EntityBroker.getNumberOfBooksInLibraryByBookModelID(bookmodel.BookModelId),
                    EntityBroker.getNumberOfAvaiableBooksToRentInLibraryByBookModelID(bookmodel.BookModelId),
                    bookmodel.Author,
                    bookmodel.BookCategory,
                    bookmodel.MaxAvailableDayToRent,
                    bookmodel.BookModelId
                    );
            }

            dgvBooksList.DataSource = dt;
            dgvBooksList.Refresh();
        }