public Book GetBookInfo(int id)
        {
            SqlConnection connection = new SqlConnection(connectionstring);

            string query = "SELECT * FROM Book WHERE Id='"+id+"'";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            Book book = new Book();

            while (reader.Read())
            {

                book.Id = int.Parse(reader["Id"].ToString());
                book.Title = reader["Title"].ToString();
                book.AuthorName = reader["Author"].ToString();
                book.Publisher = reader["Publisher"].ToString();

            }

            reader.Close();
            connection.Close();

            return book;
        }
        public List<Book> GetrInfo(int id)
        {
            List<Book>books=new List<Book>();

            SqlConnection connection = new SqlConnection(connectionstring);

            string query = "SELECT Author,Publisher FROM BOOK WHERE Id='"+id+"'";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Book book = new Book();
                book.AuthorName = reader["Author"].ToString();
                book.Publisher = reader["Publisher"].ToString();
                books.Add(book);
            }

            reader.Close();
            connection.Close();

            return books;
        }
        protected void bookTitleDropDownList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            book = bookManager.GetBookDetails(int.Parse(bookTitleDropDownList.SelectedValue.ToString()));

            authorNameTextBox.Text = book.AuthorName;

            borrowPublisherNameTextBox.Text = book.Publisher;
            borrowPublisherNameTextBox.Text = book.Publisher;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadDataInDropDownList();

                book = bookManager.GetBookDetails(int.Parse(bookTitleDropDownList.SelectedValue.ToString()));

                authorNameTextBox.Text = book.AuthorName;

                borrowPublisherNameTextBox.Text = book.Publisher;
            }
        }
        public List<Book> GetLoadBorrowedBooks(int num)
        {
            List<Book> books=new List<Book>();

            SqlConnection connection = new SqlConnection(connectionstring);

            string query = "SELECT b.Title FROM Book as b JOIN Borrow_Return as br on b.Id=br.Book_Id join Member as m on m.Number=br.Member_Id WHERE m.Number='" + num + "' ";

            connection.Open();

            SqlCommand command = new SqlCommand(query, connection);

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
               Book book=new Book();

                book.Title = reader["Title"].ToString();
                books.Add(book);
            }

            return books;
        }
        public List<Book> GetBookName()
        {
            List<Book> books=new List<Book>();

            SqlConnection connection = new SqlConnection(connectionstring);

            string query = "SELECT * FROM Book";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Book book =new Book();

                book.Id = int.Parse(reader["Id"].ToString());
                book.Title = reader["Title"].ToString();
                book.AuthorName = reader["Author"].ToString();
                book.Publisher = reader["Publisher"].ToString();
                books.Add(book);
            }

            reader.Close();
            connection.Close();

            return books;
        }
        public int Save(Book book)
        {
            SqlConnection connection = new SqlConnection(connectionstring);
            string query = "INSERT INTO Book VALUES('" + book.Title + "','" + book.AuthorName + "','"+book.Publisher+"')";

            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            int rowsAffected = command.ExecuteNonQuery();

            connection.Close();
            return rowsAffected;
        }