/// <summary> /// 保存信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveTopic_Click(object sender, EventArgs e) { #region 保存信息 string tidlist = DNTRequest.GetString("forumtopicstatus"); //当未选择主题时,则清除所有选择 if (tidlist == "") { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); doc.Save(configPath); Response.Redirect("aggregation_editforumaggset.aspx"); return; } else { //得到所选择帖子信息 DataTable dt = DatabaseProvider.GetInstance().GetTopicListByTidlist(tablelist.SelectedValue, tidlist); XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); //清除以前选择 XmlNode topiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist"); XmlNode websitetopiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); tidlist = DNTRequest.GetString("tid"); foreach (DataRow dr in dt.Rows) { //创建Topic节点 XmlElement topic = doc.CreateElement("Topic"); doc.AppendChildElementByDataRow(ref topic, dt.Columns, dr, "tid,message"); doc.AppendChildElementByNameValue(ref topic, "topicid", dr["tid"].ToString()); string tempubbstr = UBB.ClearUBB(dr["message"].ToString()); if (tempubbstr.Length > 200) { tempubbstr = tempubbstr.Substring(0, 200) + "..."; } doc.AppendChildElementByNameValue(ref topic, "shortdescription", tempubbstr, true); doc.AppendChildElementByNameValue(ref topic, "fulldescription", UBB.ClearUBB(dr["message"].ToString()), true); topiclistnode.AppendChild(topic); if (("," + tidlist + ",").IndexOf("," + dr["tid"].ToString() + ",") >= 0) { websitetopiclistnode.AppendChild(topic.Clone()); } } doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_editforumaggset.aspx"); } #endregion }