static AggregationFacade() { baseAggregationData = new AggregationData(); forumAggregationData = new ForumAggregationData(); //加载要通知的聚合数据对象 AggregationDataSubject.Attach(baseAggregationData); AggregationDataSubject.Attach(forumAggregationData); }
static AggregationFacade() { baseAggregationData = new AggregationData(); forumAggregationData = new ForumAggregationData(); spaceAggregationData = new SpaceAggregationData(); albumAggregationData = new AlbumAggregationData(); photoAggregationData = new PhotoAggregationData(); goodsAggregationData = new GoodsAggregationData(); //加载要通知的聚合数据对象 AggregationDataSubject.Attach(baseAggregationData); AggregationDataSubject.Attach(forumAggregationData); AggregationDataSubject.Attach(spaceAggregationData); AggregationDataSubject.Attach(albumAggregationData); AggregationDataSubject.Attach(photoAggregationData); }
/// <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 { PostInfo[] posts = new ForumAggregationData().GetPostListFromFile("Website"); //得到所选择帖子信息 Posts.WriteAggregationPostData(posts, tablelist.SelectedValue, tidlist, configPath, "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist", "/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist"); AggregationFacade.BaseAggregation.ClearAllDataBind(); Response.Redirect("aggregation_editforumaggset.aspx"); } #endregion }
/// <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 == "") { if (File.Exists(configPath)) { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); doc.RemoveNodeAndChildNode("/Aggregationinfo/Data/Topiclist"); doc.RemoveNodeAndChildNode("/Aggregationinfo/Forum/Topiclist"); doc.Save(configPath); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/TopicByForumId_" + fid); } Response.Redirect("aggregation_editforumaggset.aspx?fid=" + fid); return; } else { PostInfo[] posts = new ForumAggregationData().GetPostListFromFile("Website"); //得到所选择帖子信息 Posts.WriteAggregationPostData(posts, tablelist.SelectedValue, tidlist, configPath, "/Aggregationinfo/Data/Topiclist", "/Aggregationinfo/Forum/Topiclist"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Aggregation/TopicByForumId_" + fid); Response.Redirect("aggregation_editforumaggset.aspx?fid=" + fid); } #endregion }
/// <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 { PostInfo[] posts = new ForumAggregationData().GetPostListFromFile("Website"); //得到所选择帖子信息 Posts.WriteAggregationPostData(posts, tablelist.SelectedValue, tidlist, configPath); //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) //{ // PostInfo newpost = null; // foreach (PostInfo post in posts) // { // if (post.Tid.ToString() == dr["tid"].ToString()) // { // newpost = post; // } // } // //创建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) + "..."; // if (newpost != null) // { // tempubbstr = newpost.Message; // } // 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 }