
BlogThreadQuery

/**//// <summary>
/// Provides consistent/simple access to the various blog thread views
/// </summary>
public class BlogThreadQuery

{

public BlogThreadQuery()

{
}


/**//// <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;


/**//// <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);
}
}

posted on 2005-10-19 21:35
Konimeter 阅读(82)
评论(0) 编辑 收藏 网摘 所属分类:
CommunityServer