protected void btnAddQY_Click(object sender, EventArgs e) { Model.TcZidian mzd = new Model.TcZidian(); BLL.TcZidian bzd = new BLL.TcZidian(); mzd.Name = txtqymc.Text.Trim(); mzd.Paixu = txtpx.Text.Trim().GetInt(); mzd.Types = types; mzd.Pid = 0; bzd.Add(mzd); txtqymc.Text = ""; txtpx.Text = ""; BindGridView(); }
//删除 protected void buttondel_Click(object sender, EventArgs e) { LinkButton lb = sender as LinkButton; int id = lb.CommandArgument.Trim().GetInt(); int[] ids = { 0 }; if (!ids.Contains(id)) { BLL.TcZidian bbk = new BLL.TcZidian(); bbk.Delete(id); BindGridView(); } }
//执行编辑 protected void gvqy_RowUpdating(object sender, GridViewUpdateEventArgs e) { int qyid = gvqy.DataKeys[e.RowIndex][0].GetString().GetInt(); TextBox txtqymc = gvqy.Rows[e.RowIndex].FindControl("txtqymc") as TextBox; TextBox txtqypx = gvqy.Rows[e.RowIndex].FindControl("txtqypx") as TextBox; BLL.TcZidian bbk = new BLL.TcZidian(); Model.TcZidian mbk = new Model.TcZidian(); mbk = bbk.GetModel(qyid); mbk.Name = txtqymc.Text; mbk.Paixu = txtqypx.Text.GetInt(); mbk.Types = types; bbk.Update(mbk); gvqy.EditIndex = -1; BindGridView(); }