/// <summary>
        /// Returns an Post object with the specified ID
        /// </summary>
        public static Post GetPostByID(int postID)
        {
            Post   post = null;
            string key  = "Forums_Post_" + postID.ToString();

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                post = (Post)BizObject.Cache[key];
            }
            else
            {
                post = GetPostFromPostDetails(SiteProvider.Forums.GetPostByID(postID));
                BaseForum.CacheData(key, post);
            }
            return(post);
        }
        /// <summary>
        /// Returns the number of total threads
        /// </summary>
        public static int GetThreadCount()
        {
            int    postCount = 0;
            string key       = "Forums_ThreadCount";

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                postCount = (int)BizObject.Cache[key];
            }
            else
            {
                postCount = SiteProvider.Forums.GetThreadCount();
                BaseForum.CacheData(key, postCount);
            }
            return(postCount);
        }
예제 #3
0
        /// <summary>
        /// Returns a Forum object with the specified ID
        /// </summary>
        public static Forum GetForumByID(int forumID)
        {
            Forum  forum = null;
            string key   = "Forums_Forum_" + forumID.ToString();

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                forum = (Forum)BizObject.Cache[key];
            }
            else
            {
                forum = GetForumFromForumDetails(SiteProvider.Forums.GetForumByID(forumID));
                BaseForum.CacheData(key, forum);
            }
            return(forum);
        }
        /// <summary>
        /// Returns a collection with all unapproved posts
        /// </summary>
        public static List <Post> GetUnapprovedPosts()
        {
            List <Post> posts = null;
            string      key   = "Forums_UnapprovedPosts";

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                posts = (List <Post>)BizObject.Cache[key];
            }
            else
            {
                List <PostDetails> recordset = SiteProvider.Forums.GetUnapprovedPosts();
                posts = GetPostListFromPostDetailsList(recordset);
                BaseForum.CacheData(key, posts);
            }
            return(posts);
        }
예제 #5
0
        /***********************************
         * Static methods
         ************************************/

        /// <summary>
        /// Returns a collection with all the forums
        /// </summary>
        public static List <Forum> GetForums()
        {
            List <Forum> forums = null;
            string       key    = "Forums_Forums";

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                forums = (List <Forum>)BizObject.Cache[key];
            }
            else
            {
                List <ForumDetails> recordset = SiteProvider.Forums.GetForums();
                forums = GetForumListFromForumDetailsList(recordset);
                BaseForum.CacheData(key, forums);
            }
            return(forums);
        }
        /// <summary>
        /// Returns the number of total posts for the specified forum
        /// </summary>
        public static int GetThreadCount(int forumID)
        {
            if (forumID <= 0)
            {
                return(GetThreadCount());
            }

            int    postCount = 0;
            string key       = "Forums_ThreadCount_" + forumID.ToString();

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                postCount = (int)BizObject.Cache[key];
            }
            else
            {
                postCount = SiteProvider.Forums.GetThreadCount(forumID);
                BaseForum.CacheData(key, postCount);
            }
            return(postCount);
        }
        public static List <Post> GetThreadByID(int threadPostID, int startRowIndex, int maximumRows)
        {
            List <Post> posts = null;
            string      key   = "Forums_Thread_" + threadPostID.ToString();

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                posts = (List <Post>)BizObject.Cache[key];
            }
            else
            {
                List <PostDetails> recordset = SiteProvider.Forums.GetThreadByID(threadPostID);
                posts = GetPostListFromPostDetailsList(recordset);
                BaseForum.CacheData(key, posts);
            }

            int count = (posts.Count < startRowIndex + maximumRows ? posts.Count - startRowIndex : maximumRows);

            Post[] array = new Post[count];
            posts.CopyTo(startRowIndex, array, 0, count);
            return(new List <Post>(array));;
        }
        public static List <Post> GetThreads(string sortExpression, int startRowIndex, int maximumRows)
        {
            if (sortExpression == null)
            {
                sortExpression = "";
            }

            List <Post> posts = null;
            string      key   = "Forums_Threads_" + sortExpression + "_" + startRowIndex.ToString() + "_" + maximumRows.ToString();

            if (BaseForum.Settings.EnableCaching && BizObject.Cache[key] != null)
            {
                posts = (List <Post>)BizObject.Cache[key];
            }
            else
            {
                List <PostDetails> recordset = SiteProvider.Forums.GetThreads(
                    sortExpression, GetPageIndex(startRowIndex, maximumRows), maximumRows);
                posts = GetPostListFromPostDetailsList(recordset);
                BaseForum.CacheData(key, posts);
            }
            return(posts);
        }