Exemplo n.º 1
0
 public void bind()
 {
     Bll.PressTable bpre = new Bll.PressTable();
     GridView1.DataSource        = bpre.select("");
     this.GridView1.DataKeyNames = new string[] { "ID" };
     this.GridView1.DataBind();
 }
Exemplo n.º 2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (TextBox3.Text != "")
            {
                if (DropDownList1.Text == "出版社名字")
                {
                    Bll.PressTable bpre = new Bll.PressTable();

                    this.GridView1.DataSource   = bpre.select("PreName like '%" + TextBox3.Text + "%'");
                    this.GridView1.DataKeyNames = new string[] { "ID" };
                    this.GridView1.DataBind();
                }
                if (DropDownList1.Text == "出版社地址")
                {
                    Bll.PressTable bpre = new Bll.PressTable();
                    this.GridView1.DataSource   = bpre.select("PreAddress like '%" + TextBox3.Text + "%'");
                    this.GridView1.DataKeyNames = new string[] { "ID" };
                    this.GridView1.DataBind();
                }
                if (DropDownList1.Text == "出版社电话")
                {
                    Bll.PressTable bpre = new Bll.PressTable();
                    this.GridView1.DataSource   = bpre.select("PreTel like '%" + TextBox3.Text + "%'");
                    this.GridView1.DataKeyNames = new string[] { "ID" };
                    this.GridView1.DataBind();
                }
                this.Label4.Text = "";
            }
            else
            {
                this.Label4.Text = "不能为空";
            }
        }
Exemplo n.º 3
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Bll.PressTable bpre = new Bll.PressTable();
     // bpre.delete (GridView1 .DataKeys [e .RowIndex].Value .ToString ());
     bpre.delete(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()));
     GridView1.EditIndex = -1;
     this.bind();
 }
Exemplo n.º 4
0
 private void SetDrop()
 {
     Bll.PressTable press = new Bll.PressTable();
     DropDownList1.DataSource     = press.aselect("");
     DropDownList1.DataValueField = "PreName";
     DropDownList1.DataBind();
     Bll.CategoryTable cate = new Bll.CategoryTable();
     DropDownList2.DataSource     = cate.aselect("");
     DropDownList2.DataValueField = "BookCategory";
     DropDownList2.DataBind();
 }
Exemplo n.º 5
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     Model.PressTable mpre = new Model.PressTable();
     mpre.ID         = int.Parse(GridView1.Rows[e.RowIndex].Cells[0].Text.ToString().Trim());
     mpre.PreName    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
     mpre.PreAddress = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
     //mpre.PreTel = int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text);
     mpre.PreTel = Convert.ToInt32(((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text);
     Bll.PressTable bpre = new Bll.PressTable();
     bpre.update(mpre, mpre.ID);
     this.GridView1.EditIndex = -1;
     this.bind();
 }
Exemplo n.º 6
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.PressTable mpre = new Model.PressTable();
     try
     {
         mpre.PreName    = txtCategory.Text;
         mpre.PreAddress = TextBox1.Text;
         mpre.PreTel     = int.Parse(TextBox2.Text.ToString());
         Bll.PressTable bpre = new Bll.PressTable();
         bpre.insert(mpre);
         Response.Write("<script>alert('添加成功! ')</script>");
         this.bind();
     }
     catch
     {
         Response.Write("<script>alert('添加失败!')</script>");
     }
 }
Exemplo n.º 7
0
 public SqlDataReader bbang()
 {
     Bll.PressTable press = new Bll.PressTable();
     return(press.aselect(""));
 }