コード例 #1
0
        /// <summary>
        /// Search for the book in the library and display if book is available.  If the book is not available
        /// user will get notification about that with the date when the book will be return and name of person who is keeping the book
        /// </summary>
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            string title = textBoxTitle.Text;

            ClearLabels();
            if (title != String.Empty)
            {
                try
                {
                    if (controller.IsBookExisting(title))
                    {
                        if (controller.IsBookLoaned(title))
                        {
                            labetShowTitle.Text     = title;
                            labelShowAvailable.Text = "Not Available";
                            labelShowDate.Text      = "Date: " + controller.BookReturnDate(title);
                            labelShowUser.Text      = "Keeped: " + controller.BookBorrower(title);
                        }
                        else
                        {
                            labetShowTitle.Text     = title;
                            labelShowAvailable.Text = "Available";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Book is not in our library", "Information");
                    }
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show("Connection to database problem", "Information");
                }
            }
            else
            {
                MessageBox.Show("Provide some Title", "Information");
            }
        }