コード例 #1
0
ファイル: Addbook.aspx.cs プロジェクト: BADHARUDEEN/lms
    protected void Page_Load(object sender, EventArgs e)
    {
        lblmsg.Text = "";
        if (Page.IsPostBack == false)
        {
            BDT = BAdapter.SelectBranch();
            drpbranch.DataSource     = BDT;
            drpbranch.DataTextField  = "Branchname";
            drpbranch.DataValueField = "Branchid";
            drpbranch.DataBind();
            drpbranch.Items.Insert(0, "SELECT");


            //CheckBoxList1.DataSource = BDT;
            //CheckBoxList1.DataTextField = "Branchname";
            //CheckBoxList1.DataValueField = "branchid";
            //CheckBoxList1.DataBind();


            PubDT = PubAdapter.Select();
            drppublication.DataSource     = PubDT;
            drppublication.DataTextField  = "Publication";
            drppublication.DataValueField = "pid";
            drppublication.DataBind();
            drppublication.Items.Insert(0, "SELECT");
        }
    }
コード例 #2
0
 protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     GridView1.EditIndex = -1;
     BDT = BAdapter.SelectBranch();
     GridView1.DataSource = BDT;
     GridView1.DataBind();
 }
コード例 #3
0
 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
 {
     GridView1.EditIndex = e.NewEditIndex;
     BDT = BAdapter.SelectBranch();
     GridView1.DataSource = BDT;
     GridView1.DataBind();
 }
コード例 #4
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int bid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);

        BAdapter.Delete(bid);
        lblmsg.Text          = "Branch Deleted";
        BDT                  = BAdapter.SelectBranch();
        GridView1.DataSource = BDT;
        GridView1.DataBind();
    }
コード例 #5
0
 protected void btnadd_Click(object sender, EventArgs e)
 {
     BAdapter.Insert(txtaddbranch.Text);
     lblmsg.Text          = "Branch Inserted";
     BDT                  = BAdapter.SelectBranch();
     GridView1.DataSource = BDT;
     GridView1.DataBind();
     txtaddbranch.Text = "";
     txtaddbranch.Focus();
 }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lblmsg.Text = "";
     if (Page.IsPostBack == false)
     {
         BDT = BAdapter.SelectBranch();
         GridView1.DataSource = BDT;
         GridView1.DataBind();
     }
 }
コード例 #7
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int     bid   = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
        TextBox bname = GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox;

        BAdapter.Update(bid, bname.Text);
        lblmsg.Text         = "Branch Updated";
        GridView1.EditIndex = -1;
        BDT = BAdapter.SelectBranch();
        GridView1.DataSource = BDT;
        GridView1.DataBind();
    }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lblmsg.Text = "";
     if (Page.IsPostBack == false)
     {
         BDT = BAdapter.SelectBranch();
         drpbranch.DataSource     = BDT;
         drpbranch.DataTextField  = "Branchname";
         drpbranch.DataValueField = "Branchid";
         drpbranch.DataBind();
         drpbranch.Items.Insert(0, "SELECT");
     }
 }
コード例 #9
0
    protected void btnadd_Click(object sender, EventArgs e)
    {
        BAdapter.Insert(txtaddbranch.Text);

        /*SqlConnection con = new SqlConnection("Data source=DESKTOP-G5RCU8B\\SUMAN_SQL; initial catalog=LMS; user id=sa; password=password100");
         * //integretade security =true; in case we doesn't have security case
         * SqlCommand cmd = new SqlCommand("insert into add_branch values(@branch_name)", con);
         * con.Open();
         * cmd.Parameters.AddWithValue("@branch_name", txtaddbranch.Text);
         * //cmd.Parameters.AddWithValue("@age", int.Parse(TextBox2.Text));
         * cmd.ExecuteNonQuery();*/

        lblmsg.Text          = "Branch Inserted";
        BDT                  = BAdapter.SelectBranch();
        GridView1.DataSource = BDT;
        GridView1.DataBind();
        txtaddbranch.Text = "";
        txtaddbranch.Focus();
    }
コード例 #10
0
    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 !!!";
        }
    }