protected void btnissue_Click(object sender, EventArgs e)
        {
            _RentBL = new RentBL();
            _BookBL = new BookBL();
            try
            {
                if (TextBox1.Text == "")
                {
                    lblissue.Text = "Enter Days !!";
                }
                else
                {
                    if (Convert.ToInt32(lblaqnt.Text) == 0)
                    {
                        lblissue.Text = "Book Stock Empty !!";
                    }
                    else
                    {
                        List <Rent> _RentList = new List <Rent>();
                        _RentBL   = new RentBL();
                        _RentList = _RentBL.BL_Student_Select_BY_SID_BName_Status(Convert.ToInt32(drpstudent.SelectedValue), lblbname.Text, 0);


                        if (_RentList.Count != 0)
                        {
                            lblissue.Text = "Student can't get copies of same book !!";
                        }
                        else
                        {
                            _RentList = _RentBL.BL_Student_Select_BY_SID_Status(Convert.ToInt32(drpstudent.SelectedValue), 0);


                            if (_RentList.Count == 3)
                            {
                                lblissue.Text = "A student has maximum 3 books !!";
                            }
                            else
                            {
                                int result  = 0;
                                int result1 = 0;
                                result = _RentBL.BL_RENT_Insert(lblbname.Text, Convert.ToInt32(drpstudent.SelectedValue), Convert.ToInt32(TextBox1.Text));

                                result1       = _BookBL.BL_Book_ISSUE_TO_STUDENT(Convert.ToInt32(ViewState["BBID"].ToString()));
                                lblissue.Text = "Book Issued to " + drpstudent.SelectedItem.Text;


                                List <Book> _BOOKList = new List <Book>();

                                _BOOKList = _BookBL.BL_BOOK_Select_BY_BID(Convert.ToInt32(ViewState["BBID"]));
                                if (_BOOKList.Count > 0)
                                {
                                    ViewState["BBID"] = _BOOKList[0].BID.ToString();
                                    lblbname.Text     = _BOOKList[0].BookName.ToString();
                                    lblauthor.Text    = _BOOKList[0].Author.ToString();
                                    lblbran.Text      = _BOOKList[0].Branch.ToString();
                                    lblpub.Text       = _BOOKList[0].Publication.ToString();
                                    lblprice.Text     = _BOOKList[0].Price.ToString();
                                    lblqnt.Text       = _BOOKList[0].Quantites.ToString();
                                    lblaqnt.Text      = _BOOKList[0].AvailableQnt.ToString();
                                    lblrqnt.Text      = _BOOKList[0].RentQnt.ToString();
                                    lbldetail.Text    = _BOOKList[0].Detail.ToString();
                                    Image2.ImageUrl   = _BOOKList[0].Image.ToString();
                                }
                                TextBox1.Text = "";
                                drpstudent.Items.Clear();
                                drpstudent.Items.Insert(0, "SELECT");


                                List <Branch> _BranchList = new List <Branch>();
                                _BranchBL   = new BranchBL();
                                _BranchList = _BranchBL.BL_Branch_Select();


                                drpbranch.DataSource     = _BranchList;
                                drpbranch.DataTextField  = "BranchName";
                                drpbranch.DataValueField = "BranchID";
                                drpbranch.DataBind();
                                drpbranch.Items.Insert(0, "SELECT");
                            }
                        }
                    }
                }
            }
            catch
            {
                lblissue.Text = "Sorry !!! Error !!!";
            }
        }