/// <summary> /// Returns the number of total published articles for the specified category /// </summary> public static int GetArticleCount(bool publishedOnly, int categoryID) { if (!publishedOnly) { return(GetArticleCount(categoryID)); } if (categoryID <= 0) { return(GetArticleCount(publishedOnly)); } int articleCount = 0; string key = "Articles_ArticleCount_" + publishedOnly.ToString() + "_" + categoryID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { articleCount = (int)BizObject.Cache[key]; } else { articleCount = SiteProvider.Articles.GetPublishedArticleCount(categoryID, DateTime.Now); BaseArticle.CacheData(key, articleCount); } return(articleCount); }
public static List <Article> GetArticles(bool publishedOnly, int categoryID, int startRowIndex, int maximumRows) { if (!publishedOnly) { return(GetArticles(categoryID, startRowIndex, maximumRows)); } if (categoryID <= 0) { return(GetArticles(publishedOnly, startRowIndex, maximumRows)); } List <Article> articles = null; string key = "Articles_Articles_" + publishedOnly.ToString() + "_" + categoryID.ToString() + "_" + startRowIndex.ToString() + "_" + maximumRows.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { articles = (List <Article>)BizObject.Cache[key]; } else { List <ArticleDetails> recordset = SiteProvider.Articles.GetPublishedArticles( categoryID, DateTime.Now, GetPageIndex(startRowIndex, maximumRows), maximumRows); articles = GetArticleListFromArticleDetailsList(recordset); BaseArticle.CacheData(key, articles); } return(articles); }
/// <summary> /// Returns a Category object with the specified ID /// </summary> public static Category GetCategoryByID(int categoryID) { Category category = null; string key = "Articles_Category_" + categoryID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { category = (Category)BizObject.Cache[key]; } else { category = GetCategoryFromCategoryDetails(SiteProvider.Articles.GetCategoryByID(categoryID)); BaseArticle.CacheData(key, category); } return(category); }
/// <summary> /// Returns a Comment object with the specified ID /// </summary> public static Comment GetCommentByID(int commentID) { Comment comment = null; string key = "Articles_Comment_" + commentID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { comment = (Comment)BizObject.Cache[key]; } else { comment = GetCommentFromCommentDetails(SiteProvider.Articles.GetCommentByID(commentID)); BaseArticle.CacheData(key, comment); } return(comment); }
/// <summary> /// Returns the number of total comments for the specified article /// </summary> public static int GetCommentCount(int articleID) { int commentCount = 0; string key = "Articles_CommentCount_" + articleID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { commentCount = (int)BizObject.Cache[key]; } else { commentCount = SiteProvider.Articles.GetCommentCount(articleID); BaseArticle.CacheData(key, commentCount); } return(commentCount); }
/// <summary> /// Returns an Article object with the specified ID /// </summary> public static Article GetArticleByID(int articleID) { Article article = null; string key = "Articles_Article_" + articleID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { article = (Article)BizObject.Cache[key]; } else { article = GetArticleFromArticleDetails(SiteProvider.Articles.GetArticleByID(articleID)); BaseArticle.CacheData(key, article); } return(article); }
/// <summary> /// Returns the number of total articles /// </summary> public static int GetArticleCount() { int articleCount = 0; string key = "Articles_ArticleCount"; if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { articleCount = (int)BizObject.Cache[key]; } else { articleCount = SiteProvider.Articles.GetArticleCount(); BaseArticle.CacheData(key, articleCount); } return(articleCount); }
/*********************************** * Static methods ************************************/ /// <summary> /// Returns a collection with all the categories /// </summary> public static List <Category> GetCategories() { List <Category> categories = null; string key = "Articles_Categories"; if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { categories = (List <Category>)BizObject.Cache[key]; } else { List <CategoryDetails> recordset = SiteProvider.Articles.GetCategories(); categories = GetCategoryListFromCategoryDetailsList(recordset); BaseArticle.CacheData(key, categories); } return(categories); }
public static List <Comment> GetComments(int articleID, int startRowIndex, int maximumRows) { List <Comment> comments = null; string key = "Articles_Comments_" + articleID.ToString() + "_" + startRowIndex.ToString() + "_" + maximumRows.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { comments = (List <Comment>)BizObject.Cache[key]; } else { List <CommentDetails> recordset = SiteProvider.Articles.GetComments(articleID, GetPageIndex(startRowIndex, maximumRows), maximumRows); comments = GetCommentListFromCommentDetailsList(recordset); BaseArticle.CacheData(key, comments); } return(comments); }
public static List <Article> GetArticles(int startRowIndex, int maximumRows) { List <Article> articles = null; string key = "Articles_Articles_" + startRowIndex.ToString() + "_" + maximumRows.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { articles = (List <Article>)BizObject.Cache[key]; } else { List <ArticleDetails> recordset = SiteProvider.Articles.GetArticles( GetPageIndex(startRowIndex, maximumRows), maximumRows); articles = GetArticleListFromArticleDetailsList(recordset); BaseArticle.CacheData(key, articles); } return(articles); }
/// <summary> /// Returns the number of total articles for the specified category /// </summary> public static int GetArticleCount(int categoryID) { if (categoryID <= 0) { return(GetArticleCount()); } int articleCount = 0; string key = "Articles_ArticleCount_" + categoryID.ToString(); if (BaseArticle.Settings.EnableCaching && BizObject.Cache[key] != null) { articleCount = (int)BizObject.Cache[key]; } else { articleCount = SiteProvider.Articles.GetArticleCount(categoryID); BaseArticle.CacheData(key, articleCount); } return(articleCount); }