Exemple #1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Model.BorTable mBrt = new Model.BorTable();
     try
     {
         if (BorPassword.Text == BorPass.Text)
         {
             mBrt.BorId       = int.Parse(BorId.Text);
             mBrt.BorName     = BorName.Text;
             mBrt.BorClass    = BorClass.Text;
             mBrt.BorTitle    = BorTitle.Text;
             mBrt.BorLoss     = "否";
             mBrt.BorPassword = BorPassword.Text;
             Bll.BorTable bBrt = new Bll.BorTable();
             if (bBrt.insert(mBrt))
             {
                 Response.Write("<script>alert('添加成功!')</script>");
             }
             else
             {
                 Response.Write("<script>alert('添加失败!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('两次密码不一致!')</script>");
         }
     }
     catch
     {
         Response.Write("<script>alert('添加失败!')</script>");
     }
 }
 public void bind()
 {
     Bll.BorTable bBor = new Bll.BorTable();
     this.GridView1.DataSource   = bBor.select("");
     this.GridView1.DataKeyNames = new string[] { "ID" };
     this.GridView1.DataBind();
 }
Exemple #3
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (TextBox3.Text != "")
     {
         if (DropDownList1.Text == "借书证号")
         {
             Bll.BorTable bBor = new Bll.BorTable();
             this.GridView1.DataSource   = bBor.select("BorId like '%" + TextBox3.Text + "%'");
             this.GridView1.DataKeyNames = new string[] { "ID" };
             this.GridView1.DataBind();
         }
         if (DropDownList1.Text == "读者名字")
         {
             Bll.BorTable bBor = new Bll.BorTable();
             this.GridView1.DataSource   = bBor.select("BorName like '%" + TextBox3.Text + "%'");
             this.GridView1.DataKeyNames = new string[] { "ID" };
             this.GridView1.DataBind();
         }
         if (DropDownList1.Text == "读者班级")
         {
             Bll.BorTable bBor = new Bll.BorTable();
             this.GridView1.DataSource   = bBor.select("BorClass like '%" + TextBox3.Text + "%'");
             this.GridView1.DataKeyNames = new string[] { "ID" };
             this.GridView1.DataBind();
         }
         this.Label4.Text = "";
     }
     else
     {
         this.Label4.Text = "不能为空";
     }
 }
 public void bind()
 {
     Bll.BorTable bpre = new Bll.BorTable();
     GridView_Excel.DataSource        = bpre.select("");
     this.GridView_Excel.DataKeyNames = new string[] { "ID" };
     this.GridView_Excel.DataBind();
 }
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     Bll.BorTable   bBor = new Bll.BorTable();
     Model.BorTable mBor = new Model.BorTable();
     mBor.ID          = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[0].Text.Trim());
     mBor.BorId       = Convert.ToInt32(((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim());
     mBor.BorName     = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
     mBor.BorClass    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
     mBor.BorTitle    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
     mBor.BorLoss     = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
     mBor.BorPassword = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim();
     bBor.update(mBor, GridView1.Rows[e.RowIndex].Cells[0].Text.Trim());
     GridView1.EditIndex = -1;
     this.bind();
 }
Exemple #6
0
        protected void txt_bookid_TextChanged(object sender, EventArgs e)
        {
            Bll.BorTable bor = new Bll.BorTable();
            DataTable    da  = bor.select("BorId='" + Convert.ToInt32(txt_broid.Text) + "'");

            if (da.Rows.Count == 1)
            {
                txt_broname.Text = da.Rows[0]["BorName"].ToString();
                cunzai           = true;
                btn_add.Enabled  = true;
            }
            else
            {
                btn_add.Enabled  = false;
                txt_broname.Text = "用户不存在";
            }
        }
Exemple #7
0
 private void BindData()
 {
     Bll.BorTable bBor = new Bll.BorTable();
     GridView1.DataSource = bBor.select(string.Empty);
     GridView1.DataBind();
 }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Bll.BorTable bBor = new Bll.BorTable();
     bBor.delete(GridView1.Rows[e.RowIndex].Cells[0].Text);
     this.bind();
 }