using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class SysAdmin_DiscussType : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { BindClassType(); } private void BindClassType() { string SelectClassType = "select * from ClassType"; this.Repeater1.DataSource = new common().ExcuteReader(SelectClassType).Tables[0].DefaultView; this.Repeater1.DataBind(); } protected void LinkButton1_Click(object sender, EventArgs e) { string InsertClassInfo = "insert into ClassType values('" + this.TextBox1.Text.ToString() + "')"; if (new common().ExcuteNoneQuery(InsertClassInfo, null)) { Methods1.Methods1.Alert(this, "添加成功"); BindClassType(); } else { Methods1.Methods1.Alert(this, "添加失败,请联系管理员"); } } protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "del") { string DelClassLesson = "delete from ClassImg where ClassId=" + e.CommandArgument + "; delete from Discuss where ClassId = " + e.CommandArgument + " ; delete from ClassType where ClassId =" + e.CommandArgument + ";delete from Class where ClassTypeId = " + e.CommandArgument + "; "; if (new common().ExcuteNoneQuery(DelClassLesson, null)) { Methods1.Methods1.Alert(this,"删除成功!"); } } if (e.CommandName == "update") { Response.Redirect("ClassInfo.aspx?ClassInfo="+e.CommandArgument); } } }