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

📄 blogthreadquery.cs

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

using System;
using System.Collections;
using System.Text;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Provides consistent/simple access to the various blog thread views
	/// </summary>
	public class BlogThreadQuery
	{

		public BlogThreadQuery()
		{
		}

        #region Query Properties

        /// <summary>
        /// Blog to filer by
        /// </summary>
        public int BlogID = -1;

        /// <summary>
        /// BlogGroup to filter by
        /// </summary>
        public int BlogGroupID = -1;

        /// <summary>
        /// Current Page
        /// </summary>
        public int PageIndex = 0;

        /// <summary>
        /// # of threads per request
        /// </summary>
        public int PageSize = 20;

        /// <summary>
        /// CategoryID to filter by
        /// </summary>
        public int CategoryID = 0;

        /// <summary>
        /// User to filter by
        /// </summary>
        public int UserID = 0;

        /// <summary>
        /// Date to filter by. Generally relies on BlogThreadType property
        /// </summary>
        public DateTime DateFilter = DateTime.MinValue;

        /// <summary>
        /// Require posts be marked as Published/Acitve
        /// </summary>
        public bool IsPublished = true;

        /// <summary>
        /// Filter by if the blog is current enabled
        /// </summary>
        public bool IsBlogEnable = true;

        /// <summary>
        /// Type of post to filter by
        /// </summary>
        public BlogPostType BlogPostType = BlogPostType.Post;

        /// <summary>
        /// Type of thread (date, recent, etc)
        /// </summary>
        public BlogThreadType BlogThreadType = BlogThreadType.Recent;

        /// <summary>
        /// How to sort
        /// </summary>
        public SortOrder SortOrder = SortOrder.Ascending;

        /// <summary>
        /// Column to sort by
        /// </summary>
        public BlogThreadSortBy SortBy = BlogThreadSortBy.MostRecent;

        /// <summary>
        /// Filter by specific PostConfigurations
        /// </summary>
        public BlogPostConfig PostConfig = BlogPostConfig.Empty;

        /// <summary>
        /// Should the category data be returned as a seperate table.
        /// </summary>
        public bool IncludeCategories = false;


		public ArrayList FilterByList = null;

		public bool IgnorePaging = false;

        /// <summary>
        /// Flag to let a data provider know it is safe to 
        /// serve the request from a secondary datasource
        /// </summary>
        public bool IsCacheable = true;

        /// <summary>
        /// Flag to let the data provider know this is a request for aggregate 
        /// data
        /// </summary>
        public bool IsAggregate = false;


        #endregion
		
        #region Has/Helpers
        /// <summary>
        /// Are we filtering by a date?
        /// </summary>
        public bool HasDate
        {
            get{return DateFilter > DateTime.MinValue;}
        }

        /// <summary>
        /// Are we filtering by a category?
        /// </summary>
        public bool HasCategory
        {
            get{return CategoryID > 0;}
        }

        /// <summary>
        /// Are we filtering by a specific blog?
        /// </summary>
        public bool HasBlog
        {
            get{return BlogID > -1;}
        }

        /// <summary>
        /// Are we filtering by a specific group?
        /// </summary>
        public bool HasGroup
        {
            get{return BlogGroupID > -1;}
        }

		string _filterKey = null;
		public string FilterKey
		{
			get
			{
				if(_filterKey == null)
					if(FilterByList != null && FilterByList.Count > 0)
					{
						string[] ids = new string[FilterByList.Count];
						for(int i = 0; i < FilterByList.Count; i++)
							ids[i] = ((Section)FilterByList[i]).SectionID.ToString();

						_filterKey = string.Join(",", ids);
					}
				else
						_filterKey = string.Empty;

				return _filterKey;
			}
		}

        /// <summary>
        /// Unquie key represeting the current query
        /// </summary>
        public string Key
        {
            get
            {
                return string.Format("B:{0}-PI{1}-PS:{2}-C:{3}-DF:{4}-IP:{5}-BPT:{6}-BTT:{7}-BSB:{8}-SO:{9}-PC:{10}-IC:{11}-GID:{12}-F:{13}-IC:{14}",
                    BlogID,PageIndex,PageSize,CategoryID,DateFilter,IsPublished,BlogPostType,BlogThreadType,SortBy,SortOrder,PostConfig,IncludeCategories,BlogGroupID,FilterKey,IgnorePaging);
            }
        }

        #endregion

	}
}

⌨️ 快捷键说明

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