⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 weblogcommentrsshandler.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Summary description for WeblogCommentRssHandler.
	/// </summary>
	public class WeblogCommentRssHandler : BaseWeblogSyndicationHandler
	{
		public WeblogCommentRssHandler()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		protected int PostID;

		protected override int CacheTime
		{
			get { return 5;}
		}

		protected override string CacheKey
		{
			get { return "CommentRss-PostID:" + PostID.ToString(); }
		}

		protected override void ProcessFeed()
		{
			PostID = Int32.Parse(Context.Request.QueryString["PostID"]);

			base.ProcessFeed ();
		}


		protected override CachedFeed BuildFeed()
		{
            BlogPostQuery query = new BlogPostQuery();
			query.PostID = PostID;
			query.ReturnFullThread = true;
			query.BlogID = this.CurrentWeblog.SectionID;
			
			PostSet ps =  WeblogPosts.GetPosts(query,true);

			ps.Organize();

			WeblogPost we = ps.ThreadStarter as WeblogPost;

			//If we do not have a post, there is not much we can do
			if(we == null)
			{
				Context.Response.End();
				return null;
			}




			DateTime dt = (ps.Replies != null &&  ps.Replies.Count > 0) ? ((WeblogPost)(ps.Replies[ps.Replies.Count -1])).PostDate : we.PostDate;

			WeblogCommentRssWriter writer = new WeblogCommentRssWriter(we,ps.Replies,this.CurrentWeblog,this.BaseUrl);
			return new CachedFeed(dt,dt.ToString(),writer.GetXml());
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -