コード例 #1
0
        private void bookAdd_click(object sender, MouseEventArgs e)
        {
            BookDAO addBook = new BookDAOImpl();
            Book    book    = new Book();

            book.setBookName(tbBookName.Text);
            book.setYear(Int32.Parse(tbBookYear.Text));
            book.setTimeRead(UInt16.Parse(tbTimeRead.Text));

            foreach (Author a in authors)
            {
                if (cbBookAuthor.Text.Equals(a.getAuthorName() + " " + a.getAuthorFamily()))
                {
                    book.setAuthorID(a.getAuthorID());
                }
            }

            foreach (Genre g in genres)
            {
                if (cbGenre.Text.Equals(g.getGenre()))
                {
                    book.setGenreID(g.getGenreID());
                }
            }

            addBook.add(book);
        }
コード例 #2
0
        private void SearchResult_Load(object sender, EventArgs e)
        {
            BookDAO dao = new BookDAOImpl();

            foreach (Book book in books)
            {
                dataGridViewResult.Rows.Add(book.getBookName(), book.getYear(), book.getTimeRead(), book.getAuthorName(), book.getGenre());
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: shenaikabilova/MyLibrary
        private void AllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BookDAO     bookDao = new BookDAOImpl();
            List <Book> books   = bookDao.searchAll();

            this.Hide();
            SearchResult result = new SearchResult(books);

            result.Show();
        }
コード例 #4
0
 private void searchByAuthor_click(object sender, MouseEventArgs e)
 {
     foreach (Author author in authors)
     {
         if (cbAuthor.SelectedItem.Equals(author.getAuthorName() + " " + author.getAuthorFamily()))
         {
             BookDAO     bookDao = new BookDAOImpl();
             List <Book> books   = bookDao.searchByAuthorID(author.getAuthorID());
             this.Hide();
             SearchResult result = new SearchResult(books);
             result.Show();
         }
     }
 }
コード例 #5
0
 private void searchByGenre_click(object sender, MouseEventArgs e)
 {
     foreach (Genre genre in genres)
     {
         if (cbGenre.SelectedItem.Equals(genre.getGenre()))
         {
             BookDAO     bookDao = new BookDAOImpl();
             List <Book> books   = bookDao.searchByGenreID(genre.getGenreID());
             this.Hide();
             SearchResult result = new SearchResult(books);
             result.Show();
         }
     }
 }