public void AddNewRec_Click(object sender, EventArgs e) { if (!this.CheckValue(this.typename.Text, this.displayorder.Text, this.description.Text)) { return; } var entity = TopicType.FindByName(this.typename.Text); if (entity != null) { base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的主题分类名称');window.location.href='forum_topictypesgrid.aspx';</script>"); return; } //TopicTypes.CreateTopicTypes(this.typename.Text, int.Parse(this.displayorder.Text), this.description.Text); entity = new TopicType(); entity.Name = typename.Text; entity.DisplayOrder = Int32.Parse(displayorder.Text); entity.Description = description.Text; entity.Save(); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加主题分类", "添加主题分类,名称为:" + this.typename.Text); //XCache.Remove("/Forum/TopicTypes"); base.RegisterStartupScript("", "<script>window.location.href='forum_topictypesgrid.aspx';</script>"); }
protected void Page_Load(object sender, EventArgs e) { string typename = Request["typename"]; string typeorder = Request["typeorder"]; string typedescription = Request["typedescription"]; //if (TopicType.Exist(typename)) //{ // this.result = false; // return; //} //TopicTypes.CreateTopicTypes(typename, int.Parse(typeorder), typedescription); //this.maxId = TopicTypes.GetMaxTopicTypesId(); //DNTCache.Current.RemoveObject("/Forum/TopicTypes"); var entity = TopicType.FindByName(typename); if (entity != null) { this.result = false; return; } entity = new TopicType(); entity.Name = typename; entity.DisplayOrder = Int32.Parse(typeorder); entity.Description = typedescription; entity.Save(); maxId = entity.ID; }