public static M_Popedom GetPopedom(SqlDataReader PopedomTable) { M_Popedom popedom = new M_Popedom(); popedom.Popedom_ID = (int)PopedomTable["Popedom_ID"]; popedom.Class_ID = (int)PopedomTable["Class_ID"]; popedom.Admin_ID = (int)PopedomTable["Admin_ID"]; return(popedom); }
protected void Button1_Click(object sender, EventArgs e) { string adminid = Request.QueryString["AdminID"]; List <M_Popedom> listpopedom = new List <M_Popedom>(); foreach (GridViewRow gvr in gvPopedom.Rows) { if (((CheckBox)(gvr.FindControl("Popedom"))).Checked) { M_Popedom popedom = new M_Popedom(); popedom.Admin_ID = Convert.ToInt32(adminid); popedom.Class_ID = Convert.ToInt32(gvr.Cells[0].Text); listpopedom.Add(popedom); } } if (B_Popedom.InsertPopedom(adminid, listpopedom)) { Response.Write("<script>alert('修改成功!')</script>"); } else { Response.Write("<script>alert('修改失败!')</script>"); } }