Example #1
0
        private void AddBook(object sender, EventArgs e)
        {
            Book book = new Book();

            if (BookSubmission())
            {
                book.ISBN = txtISBN.Text;

                book.Title = txtTitle.Text;

                book.Author = txtAuthor.Text;

                book.PubDate = Convert.ToInt32(txtPubDate.Text);

                book.Category = txtCategory.Text;

                if (LibraryHelper.IsBook(book))
                {
                    MessageBox.Show("There is a book in the " +
                                    "database with such a title. Please try again.");
                }
                else
                {
                    LibraryHelper.AddBook(book);
                }
            }
            else
            {
                MessageBox.Show("Incorrect submission. " +
                                "Please check your input.");
            }

            LoadBoxes();
        }