protected void btnreturn_Click(object sender, EventArgs e)
        {
            _RentBL = new RentBL();
            List <Rent> _RentList = new List <Rent>();

            _RentList            = _RentBL.BL_Student_Select_BY_SID_Status(Convert.ToInt32(Session["sid"].ToString()), 1);
            GridView2.DataSource = _RentList;
            GridView2.DataBind();
            MultiView1.ActiveViewIndex = 1;
            lblr.Text = GridView2.Rows.Count.ToString();
        }
Esempio n. 2
0
        protected void drppublication_SelectedIndexChanged(object sender, EventArgs e)

        {
            if (drppublication.SelectedValue != "0")
            {
                List <Rent> __RentList = new List <Rent>();
                _RentBL    = new RentBL();
                __RentList = _RentBL.BL_Student_Select_BY_SID_Status(Convert.ToInt32(drppublication.SelectedValue), 0);


                drpbook.DataSource     = __RentList;
                drpbook.DataTextField  = "BookName";
                drpbook.DataValueField = "RID";
                drpbook.DataBind();
                drpbook.Items.Insert(0, "SELECT");
            }
        }
        protected void btnseach_Click(object sender, EventArgs e)
        {
            lbl.Text = "";
            if (drpbranch.SelectedItem.Text == "SELECT")
            {
                lbl.Text = "Select Branch First !!";
            }
            else if (drpstudent.SelectedItem.Text == "SELECT")
            {
                lbl.Text = "Select Student First !!";
            }
            else

            {
                List <Rent> _RentList = new List <Rent>();
                _RentBL   = new RentBL();
                _RentList = _RentBL.BL_Student_Select_BY_SID_Status(Convert.ToInt32(drpstudent.SelectedValue), 0);

                GridView1.DataSource = _RentList;
                GridView1.DataBind();
                lbl.Text = "Total Records = " + _RentList.Count.ToString();
            }
        }
        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 !!!";
            }
        }