protected void GridView2_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     GridView2.EditIndex = -1;
     RentDT = RentAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
     GridView2.DataSource = RentDT;
     GridView2.DataBind();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
            HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]["Houseid"].ToString()));

            Image3.ImageUrl      = HDT.Rows[0]["image"].ToString();
            lblsname.Text        = HDT.Rows[0]["sname"].ToString();
            lblbno.Text          = HDT.Rows[0]["blockno"].ToString();
            lbltype.Text         = HDT.Rows[0]["type"].ToString();
            ViewState["HID"]     = HDT.Rows[0]["HID"].ToString();
            RentDT               = RentAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
            GridView2.DataSource = RentDT;
            GridView2.DataBind();
            if (RentDT.Rows.Count == 1)
            {
                lblrent.Text = RentDT.Rows[0]["rent"].ToString();
            }
            else
            {
                lblrent.Text = "--";
            }
        }
    }
Exemple #3
0
 protected void btnreturn_Click(object sender, EventArgs e)
 {
     RDT = RAdapter.Select_by_Status_and_SID(Convert.ToInt32(Session["sid"].ToString()), 1);
     GridView2.DataSource = RDT;
     GridView2.DataBind();
     MultiView1.ActiveViewIndex = 1;
     lblr.Text = GridView2.Rows.Count.ToString();
 }
 protected void drppublication_SelectedIndexChanged(object sender, EventArgs e)
 {
     RDT = RAdapter.SelectBook_by_sid_and_status(Convert.ToInt32(drppublication.SelectedValue), 0);
     drpbook.DataSource     = RDT;
     drpbook.DataTextField  = "Bookname";
     drpbook.DataValueField = "rid";
     drpbook.DataBind();
     drpbook.Items.Insert(0, "SELECT");
 }
    protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int rid = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Value);

        RentAdapter.Delete(rid);

        RentDT = RentAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
        GridView2.DataSource = RentDT;
        GridView2.DataBind();
        lblrent.Text = "--";
    }
    protected void Button12_Click(object sender, EventArgs e)
    {
        if (drppublication.SelectedIndex == 0)
        {
            lblmsg.Text      = "Select Student";
            lblmsg.ForeColor = System.Drawing.Color.Red; MultiView1.ActiveViewIndex = -1;
        }
        else if (drpbook.SelectedIndex == 0)
        {
            lblmsg.Text      = "Select Book";
            lblmsg.ForeColor = System.Drawing.Color.Red; MultiView1.ActiveViewIndex = -1;
        }
        else
        {
            MultiView1.ActiveViewIndex = 0;
            BookDT            = BookAdapter.Select_By_BNAM(drpbook.SelectedItem.Text);
            ViewState["BBID"] = BookDT.Rows[0]["BookID"].ToString();
            lblbname.Text     = BookDT.Rows[0]["Bookname"].ToString();
            lblauthor.Text    = BookDT.Rows[0]["author"].ToString();
            lblbran.Text      = BookDT.Rows[0]["branch"].ToString();
            lblpub.Text       = BookDT.Rows[0]["publication"].ToString();
            lblprice.Text     = BookDT.Rows[0]["price"].ToString();

            Image2.ImageUrl = BookDT.Rows[0]["Image"].ToString();

            SDT             = SAdapter.Select_By_SID(Convert.ToInt32(drppublication.SelectedValue));
            lblstudent.Text = SDT.Rows[0]["Studentname"].ToString();

            RDT               = RAdapter.Select_SID_BName_Status(drpbook.SelectedItem.Text, Convert.ToInt32(drppublication.SelectedValue), 0);
            lbldays.Text      = RDT.Rows[0]["Days"].ToString();
            lblidate.Text     = RDT.Rows[0]["IssueDate"].ToString();
            ViewState["RRID"] = RDT.Rows[0]["rid"].ToString();

            int iday = Convert.ToDateTime(RDT.Rows[0]["IssueDate"].ToString()).Day;
            int rday = System.DateTime.Now.Day;

            int pday = rday - iday;
            if (pday > Convert.ToInt32(lbldays.Text))
            {
                lblpanalty.Text = "Yes";
            }
            else

            {
                lblpanalty.Text = "NO";
            }
        }
    }
    protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int     rid  = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Value);
        TextBox lblr = GridView2.Rows[e.RowIndex].FindControl("txtr") as TextBox;

        RentAdapter.RENT_UPDATE_RENT(rid, Convert.ToDouble(lblr.Text));
        GridView2.EditIndex = -1;
        RentDT = RentAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
        GridView2.DataSource = RentDT;
        GridView2.DataBind();
        if (RentDT.Rows.Count == 1)
        {
            lblrent.Text = RentDT.Rows[0]["rent"].ToString();
        }
        else
        {
            lblrent.Text = "--";
        }
    }
Exemple #8
0
    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

        {
            RDT = RAdapter.Select_by_Status_and_SID(Convert.ToInt32(drpstudent.SelectedValue), 0);
            GridView1.DataSource = RDT;
            GridView1.DataBind();
            lbl.Text = "Total Records = " + RDT.Rows.Count.ToString();
        }
    }
 protected void btnrentnow_Click(object sender, EventArgs e)
 {
     if (txtrent.Text == "")
     {
         lblsell.Text = "Enter rent price";
     }
     else
     {
         RentDT = RentAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
         if (RentDT.Rows.Count > 0)
         {
             lblsell.Text = "Rent Request Already Sent.";
         }
         else
         {
             RentAdapter.Insert(Convert.ToInt32(ViewState["HID"].ToString()), lblsname.Text, Convert.ToInt32(Session["uid"].ToString()), Convert.ToDouble(txtrent.Text));
             txtrent.Visible    = false;
             btnrentnow.Visible = false;
             txtrent.Text       = "";
             lblsell.Text       = "Rent Request Successfully";
         }
     }
 }
    protected void btnissue_Click(object sender, EventArgs e)
    {
        try
        {
            if (TextBox1.Text == "")
            {
                lblissue.Text = "Enter Days";
            }
            else
            {
                if (Convert.ToInt32(lblaqnt.Text) == 0)
                {
                    lblissue.Text = "Book Stock Empty";
                }
                else
                {
                    RDT = RAdapter.Select_SID_BName_Status(lblbname.Text, Convert.ToInt32(drpstudent.SelectedValue), 0);

                    if (RDT.Rows.Count != 0)
                    {
                        lblissue.Text = "Student can't get copies of same book !!";
                    }
                    else
                    {
                        RDT = RAdapter.Select_by_Status_and_SID(Convert.ToInt32(drpstudent.SelectedValue), 0);
                        if (RDT.Rows.Count == 3)
                        {
                            lblissue.Text = "A student has maximum 3 books";
                        }
                        else
                        {
                            RAdapter.Insert(lblbname.Text, Convert.ToInt32(drpstudent.SelectedValue), Convert.ToInt32(TextBox1.Text));


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

                            BookDT            = BookAdapter.Select_BY_BID(Convert.ToInt32(ViewState["BBID"]));
                            ViewState["BBID"] = BookDT.Rows[0]["BookID"].ToString();
                            lblbname.Text     = BookDT.Rows[0]["Bookname"].ToString();
                            lblauthor.Text    = BookDT.Rows[0]["author"].ToString();
                            lblbran.Text      = BookDT.Rows[0]["branch"].ToString();
                            lblpub.Text       = BookDT.Rows[0]["publication"].ToString();
                            lblprice.Text     = BookDT.Rows[0]["price"].ToString();
                            lblqnt.Text       = BookDT.Rows[0]["Quantities"].ToString();
                            lblaqnt.Text      = BookDT.Rows[0]["availableqnt"].ToString();
                            lblrqnt.Text      = BookDT.Rows[0]["rentqnt"].ToString();
                            lbldetail.Text    = BookDT.Rows[0]["Detail"].ToString();
                            Image2.ImageUrl   = BookDT.Rows[0]["Image"].ToString();

                            TextBox1.Text = "";
                            drpstudent.Items.Clear();
                            drpstudent.Items.Insert(0, "SELECT");
                            BDT = BAdapter.SelectBranch();
                            drpbranch.DataSource     = BDT;
                            drpbranch.DataTextField  = "Branchname";
                            drpbranch.DataValueField = "Branchid";
                            drpbranch.DataBind();
                            drpbranch.Items.Insert(0, "SELECT");
                        }
                    }
                }
            }
        }
        catch {
            lblissue.Text = "Sorry !!! Error !!!";
        }
    }
Exemple #11
0
 protected void btnseach_Click(object sender, EventArgs e)
 {
     RDT = RAdapter.Select_by_Status_and_SID(Convert.ToInt32(drpstudent.SelectedValue), 0);
     GridView1.DataSource = RDT;
     GridView1.DataBind();
 }