protected void Button3_Click(object sender, EventArgs e) { Model.Helpcate mh = new Model.Helpcate(); BLL.Helpcate bh = new BLL.Helpcate(); int result = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1"); if (cb.Checked) { mh.ID = Convert.ToInt32(GridView1.DataKeys[i].Value); result = bh._delete(mh); } } if (result > 0) { Response.Write("<script>alert('删除成功'),location.href='helpcatelist.aspx'</script>"); } else { Response.Write("<script>alert('删除失败'),location.href='helpcatelist.aspx'</script>"); } }
protected void up() { Model.Helpcate mh = new Model.Helpcate(); mh.ID = Convert.ToInt32(Request.QueryString["uid"]); BLL.Helpcate bh = new BLL.Helpcate(); MySqlDataReader dr = bh.sqlDataReader(mh); if (dr.Read()) { Label1.Text = dr["_cateid"].ToString(); name.Text = dr["_catename"].ToString(); } dr.Close(); }
protected void Button1_Click(object sender, EventArgs e) { Model.Helpcate mh = new Model.Helpcate(); BLL.Helpcate bn = new BLL.Helpcate(); mh.Catename = TextBox1.Text; int result = bn.insert(mh); if (result > 0) { Response.Write("<script>alert('添加成功'),location.href='helpcatelist.aspx'</script>"); } else { Response.Write("<script>alert('添加失败'),location.href='helpcatelist.aspx'</script>"); } }
protected void 提交_Click(object sender, EventArgs e) { Model.Helpcate mh = new Model.Helpcate(); mh.ID = Convert.ToInt32(Request.QueryString["uid"]); mh.Catename = name.Text; BLL.Helpcate bh = new BLL.Helpcate(); int result = bh.update(mh); if (result > 0) { Response.Write("<script>alert('更新成功'),location.href='helpcatelist.aspx'</script>"); } else { Response.Write("<script>alert('更新失败'),location.href='helpcatelist.aspx'</script>"); } }
protected void up() { Model.Helpcate mh = new Model.Helpcate(); mh.ID = Convert.ToInt32(Request.QueryString["uid"]); BLL.Helpcate bh = new BLL.Helpcate(); SqlDataReader dr = bh.sqldatareader(mh); if (dr.Read()) { Label1.Text = dr["_cateid"].ToString(); name.Text = dr["_catename"].ToString(); } dr.Close(); }