Example #1
0
        // *********************************************************************
        //  Initializeskin
        //
        /// <summary>
        /// Initialize the control template and populate the control with values
        /// </summary>
        // ***********************************************************************/
        protected override void InitializeSkin(Control skin)
        {
            IDataProviderBase dp = DataProvider.Instance();
            int LC;
            LC = dp.GetLastCount((UlterSystems.PortalLib.BusinessObjects.Person.RequestUser().ID).ToString());

            // Find the thread tracking thread list control
            threadTracking = (ThreadList)skin.FindControl("ThreadTracking");
            if (null != threadTracking)
            {
                ThreadCollection trackedThreads = Threads.GetThreadsUserIsTracking(ForumUser.Username);

                if (trackedThreads.Count > 0)
                {
                    threadTracking.DataSource = trackedThreads;
                    threadTracking.DataBind();
                }
                else
                {
                    threadTracking.Visible = false;
                    Label label = (Label)skin.FindControl("NoTrackedThreads");
                    if (null != label)
                    {
                        label.Visible = true;
                    }

                }
            }

            // Find the participated threads control
            participatedThreads = (ThreadList)skin.FindControl("ParticipatedThreads");
            LastCount = (DropDownList)skin.FindControl("LastCount");
            LastCount.SelectedIndex = (LC - 5) / 5;
            LastCount.SelectedIndexChanged += new System.EventHandler(LastCount_SelectedIndexChanged);
            LastCount_SelectedIndexChanged(null, null);

            if (null != participatedThreads)
            {
                ThreadCollection participatedInThreads = Threads.GetThreadsUserMostRecentlyParticipatedIn(ForumUser.Username, LC);

                if (participatedInThreads.Count > 0)
                {
                    participatedThreads.DataSource = participatedInThreads;
                    participatedThreads.DataBind();
                }
                else
                {
                    participatedThreads.Visible = false;
                    Label label = (Label)skin.FindControl("NoParticipatedThreads");
                    if (null != label)
                    {
                        label.Visible = true;
                    }
                }
            }
        }
Example #2
0
        // *********************************************************************
        //  Initializeskin
        //
        /// <summary>
        /// Initialize the control template and populate the control with values
        /// </summary>
        // ***********************************************************************/
        override protected void InitializeSkin(Control skin)
        {
            // Find the thread tracking thread list control
            threadTracking = (ThreadList)skin.FindControl("ThreadTracking");
            if (null != threadTracking)
            {
                ThreadCollection trackedThreads = Threads.GetThreadsUserIsTracking(ForumUser.Username);

                if (trackedThreads.Count > 0)
                {
                    threadTracking.DataSource = trackedThreads;
                    threadTracking.DataBind();
                }
                else
                {
                    threadTracking.Visible = false;
                    Label label = (Label)skin.FindControl("NoTrackedThreads");
                    if (null != label)
                    {
                        label.Visible = true;
                    }
                }
            }

            // Find the participated threads control
            participatedThreads = (ThreadList)skin.FindControl("ParticipatedThreads");
            if (null != participatedThreads)
            {
                ThreadCollection participatedInThreads = Threads.GetThreadsUserMostRecentlyParticipatedIn(ForumUser.Username);

                if (participatedInThreads.Count > 0)
                {
                    participatedThreads.DataSource = participatedInThreads;
                    participatedThreads.DataBind();
                }
                else
                {
                    participatedThreads.Visible = false;
                    Label label = (Label)skin.FindControl("NoParticipatedThreads");
                    if (null != label)
                    {
                        label.Visible = true;
                    }
                }
            }


            // Find the search link
            search = (HyperLink)skin.FindControl("FindMorePosts");
            if (null != search)
            {
                search.NavigateUrl = Globals.UrlSearchForPostsByUser + ForumUser.Username;
            }
        }
        // *********************************************************************
        //  OnPreRender
        //
        /// <summary>
        /// Override OnPreRender and databind
        /// </summary>
        ///
        // ********************************************************************/
        protected override void OnPreRender(EventArgs e)
        {
            ThreadCollection threads;
            string           username = null;

            if (null != ForumUser)
            {
                username = ForumUser.Username;
            }

            // Get the total records in the pager
            if (hideReadThreads != null)
            {
                pager.TotalRecords = Forums.GetTotalThreadsInForum(ForumID, threadMaxValue, CalculateDateTimeFilter(), username, hideReadThreads.Checked);
            }
            else
            {
                pager.TotalRecords = Forums.GetTotalThreadsInForum(ForumID, threadMaxValue, CalculateDateTimeFilter(), username, false);
            }

            // User specific data source
            if ((ForumUser != null) && (hideReadThreads != null))
            {
                threads = Threads.GetAllThreads(ForumID, pager.PageSize, pager.PageIndex, CalculateDateTimeFilter(), username, hideReadThreads.Checked);
            }
            else
            {
                threads = Threads.GetAllThreads(ForumID, pager.PageSize, pager.PageIndex, CalculateDateTimeFilter(), null, false);
            }

            // Do we have data to display?
            if ((threads.Count == 0) && (forum.TotalThreads > 0))
            {
                noPostsDueToFilter.Visible = true;
            }
            else if (threads.Count == 0)
            {
                noThreads.Visible          = true;
                noPostsDueToFilter.Visible = false;
            }
            else
            {
                noThreads.Visible          = false;
                noPostsDueToFilter.Visible = false;
                markAllRead.Visible        = true;
                threadList.DataSource      = threads;
                threadList.DataBind();
            }
        }