Exemple #1
0
        public string GetTabContents(string tabName, int GroupId, int lastPostID)
        {
            GroupID = GroupId;
            #region NEWS FEED TAB
            if (tabName == "Posts")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20Posts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20PostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20NewsFeeds();
                }
                else if (GroupId > -1)
                {
                    ArrayPosts = bl.GetTop20NewsFeedsForAGroup(GroupId);
                }
                else if (GroupId == -2)
                {
                    ArrayPosts = bl.GetTop1Post();
                }



                int count = ArrayPosts.Count;

                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        #region TEXT POST
                        if (aPost.PostType == "Text")
                        {
                            GetTextPosts();
                        }
                        #endregion

                        #region EVENT POST
                        else if (aPost.PostType == "Event")
                        {
                            GetEventPosts();
                        }
                        #endregion

                        #region PHOTO POST
                        else if (aPost.PostType == "Photo")
                        {
                            GetPhotoPosts();
                        }
                        #endregion

                        #region ARTICLE POST
                        else if (aPost.PostType == "Article")
                        {
                            //GetArticlePosts();
                        }
                        #endregion

                        #region VIDEO POST
                        else if (aPost.PostType == "Video")
                        {
                            GetVideoPosts();
                        }
                        #endregion

                        #region FILE POST
                        else if (aPost.PostType == "File")
                        {
                            GetFilePosts();
                        }
                        #endregion

                        CloseWrapper();
                    }
                }
                else
                {
                    if (lastPostID == -1)
                    {
                        concatinater.Append("<div class='allComments noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                    }
                    else
                    {
                        concatinater.Append("<div class='allComments noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                    }
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            #region TEXT TAB
            else if (tabName == "Text")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20TextPosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20TextPostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20TextPosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20TextPostsForAGroup(GroupId);
                }

                int count = ArrayPosts.Count;

                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetTextPosts();

                        CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            #region EVENT TAB
            else if (tabName == "Events")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20EventPosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20EventPostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20EventPosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20EventPostsForAGroup(GroupId);
                }
                int count = ArrayPosts.Count;

                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetEventPosts();

                        CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noMorePosts noTabContent' style='display: block;'><h4>There are no more post here</h4></div>");
                }

                newsfeed = concatinater.ToString();
            }
            #endregion

            #region PHOTO TAB
            else if (tabName == "Pictures")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20PhotoPosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20PhotoPostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20PhotoPosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20PhotoPostsForAGroup(GroupId);
                }

                int count = ArrayPosts.Count;

                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetPhotoPosts();

                        CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noTabContent noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            #region ARTICLE TAB
            else if (tabName == "Articles")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20ArticlePosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20ArticlePostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20ArticlePosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20ArticlePostsForAGroup(GroupId);
                }

                int count = ArrayPosts.Count;

                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetArticlePosts();

                        //CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noTabContent noMorePosts' style='display: block;'><h4>There are no post here</h4></div>");
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            #region VIDEO TAB
            else if (tabName == "Videos")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20VideoPosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20VideoPostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20VideoPosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20VideoPostsForAGroup(GroupId);
                }

                int count = ArrayPosts.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetVideoPosts();

                        CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noTabContent noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            #region FILE TAB
            else if (tabName == "Files")
            {
                if (lastPostID > -1)
                {
                    ArrayPosts = bl.GetNextTop20FilePosts(lastPostID);
                }
                else if (lastPostID > -1 && GroupId > -1)
                {
                    ArrayPosts = bl.GetNextTop20FilePostsForAGroup(lastPostID, GroupId);
                }
                else if (GroupId == -1)
                {
                    ArrayPosts = bl.GetTop20FilePosts();
                }
                else
                {
                    ArrayPosts = bl.GetTop20FilePostsForAGroup(GroupId);
                }
                int count = ArrayPosts.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; ++i)
                    {
                        OpenWrapper(i);

                        GetFilePosts();

                        CloseWrapper();
                    }
                }
                else
                {
                    concatinater.Append("<div class='allComments noTabContent noMorePosts' style='display: block;'><h4>There are no more post here</h4></div>");
                }
                newsfeed = concatinater.ToString();
            }
            #endregion

            return(concatinater.ToString());
        }