Esempio n. 1
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = this.Get <YafDBBroker>().BoardLayout(PageContext.PageBoardID, PageContext.PageUserID, PageContext.PageCategoryID, null);

            this.CategoryList.DataSource = ds.Tables[YafDBAccess.GetObjectName("Category")];
            this.CategoryList.DataBind();
        }
Esempio n. 2
0
        /// <summary>
        /// The bind data.
        /// </summary>
        private void BindData()
        {
            using (DataSet ds = DB.ds_forumadmin(PageContext.PageBoardID))
            {
                this.CategoryList.DataSource = ds.Tables[YafDBAccess.GetObjectName("Category")];
            }

            DataBind();
        }
Esempio n. 3
0
        /// <summary>
        /// Bind data for this control.
        /// </summary>
        private void BindData()
        {
            // get list of forums and their moderating data
            using (DataSet ds = DB.forum_moderatelist(PageContext.PageUserID, PageContext.PageBoardID))
            {
                this.CategoryList.DataSource = ds.Tables[YafDBAccess.GetObjectName("Category")];
            }

            // bind data to controls
            DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// The bind data.
        /// </summary>
        void BindData()
        {
            DataSet ds = this.Get <YafDBBroker>().BoardLayout(PageContext.PageBoardID, PageContext.PageUserID, PageContext.PageCategoryID, PageContext.PageForumID);

            if (ds.Tables[YafDBAccess.GetObjectName("Forum")].Rows.Count > 0)
            {
                this.ForumList.DataSource = ds.Tables[YafDBAccess.GetObjectName("Forum")].Rows;
                this.SubForums.Visible    = true;
            }

            this.Pager.PageSize = PageContext.BoardSettings.TopicsPerPage;

            // when userId is null it returns the count of all deleted messages
            int?userId = null;

            // get the userID to use for the deleted posts count...
            if (!PageContext.BoardSettings.ShowDeletedMessagesToAll)
            {
                // only show deleted messages that belong to this user if they are not admin/mod
                if (!PageContext.IsAdmin && !PageContext.ForumModeratorAccess)
                {
                    userId = PageContext.PageUserID;
                }
            }

            DataTable dt = StyleTransformDataTable(DB.topic_list(PageContext.PageForumID, userId, 1, null, 0, 10, PageContext.BoardSettings.UseStyledNicks, true));

            int nPageSize = Math.Max(5, this.Pager.PageSize - dt.Rows.Count);

            this.Announcements.DataSource = dt;

            /*if ( !m_bIgnoreQueryString && Request.QueryString ["p"] != null )
             *                {
             *                        // show specific page (p is 1 based)
             *                        int tPage = (int)Security.StringToLongOrRedirect( Request.QueryString ["p"] );
             *
             *                        if ( tPage > 0 )
             *                        {
             *                                Pager.CurrentPageIndex = tPage - 1;
             *                        }
             *                }*/
            int nCurrentPageIndex = this.Pager.CurrentPageIndex;

            DataTable dtTopics;

            if (this._showTopicListSelected == 0)
            {
                dtTopics =
                    StyleTransformDataTable(
                        DB.topic_list(PageContext.PageForumID, userId, 0, null, nCurrentPageIndex * nPageSize, nPageSize, PageContext.BoardSettings.UseStyledNicks, true));
            }
            else
            {
                DateTime date = DateTime.UtcNow;
                switch (this._showTopicListSelected)
                {
                case 1:
                    date -= TimeSpan.FromDays(1);
                    break;

                case 2:
                    date -= TimeSpan.FromDays(2);
                    break;

                case 3:
                    date -= TimeSpan.FromDays(7);
                    break;

                case 4:
                    date -= TimeSpan.FromDays(14);
                    break;

                case 5:
                    date -= TimeSpan.FromDays(31);
                    break;

                case 6:
                    date -= TimeSpan.FromDays(2 * 31);
                    break;

                case 7:
                    date -= TimeSpan.FromDays(6 * 31);
                    break;

                case 8:
                    date -= TimeSpan.FromDays(365);
                    break;
                }

                dtTopics =
                    StyleTransformDataTable(
                        DB.topic_list(PageContext.PageForumID, userId, 0, date, nCurrentPageIndex * nPageSize, nPageSize, PageContext.BoardSettings.UseStyledNicks, true));
            }

            int nRowCount = 0;

            if (dtTopics.Rows.Count > 0)
            {
                nRowCount = (int)dtTopics.Rows[0]["RowCount"];
            }

            int nPageCount = (nRowCount + nPageSize - 1) / nPageSize;

            this.TopicList.DataSource = dtTopics;

            DataBind();

            // setup the show topic list selection after data binding
            this.ShowList.SelectedIndex = this._showTopicListSelected;
            YafContext.Current.Get <YafSession>().ShowList = this._showTopicListSelected;

            this.Pager.Count = nRowCount;
        }