Esempio n. 1
0
        void ThreadsViewer_UC_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int ThreadID = 0;
                int.TryParse(Request.QueryString["ThreadID"], out ThreadID);

                ObjectID = ThreadID;
                DataLayer.Entities.ForumThread forumThread = null;
                DataLayer.Entities.Forum forum = null;
                if (ObjectID > 0)
                {
                    forumThread = ForumThreadManager.GetByPublishedID(ThreadID);
                    if (forumThread != null)
                        forum = ForumManager.GetPublishedByID(forumThread.ForumID);
                }
                if (forum != null && forumThread != null)
                {
                    BindForumThread(forumThread);
                    BindPosts(forumThread.ID);
                    plcThread.Visible = true;

                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString().Substring(0, 9), "UpdateThreadViews('" + forumThread.ID + "');", true);

                    #region PagePath

                    List<PagePath> allPaths = new List<PagePath>();
                    PagePath pagePath = new PagePath();
                    pagePath.Name = forum.ForumGroupName;
                    pagePath.Url = ConfigContext.GetForumGroupPage;
                    allPaths.Add(pagePath);

                    pagePath = new PagePath();
                    pagePath.Name = forum.Name;
                    pagePath.Url = UtilitiesManager.GetForumURL(forum.ID);
                    allPaths.Add(pagePath);

                    pagePath = new PagePath();
                    pagePath.Name = forumThread.Name;
                    pagePath.Url = string.Empty;
                    allPaths.Add(pagePath);

                    ucPagePath.BindPath(allPaths);
                    #endregion
                }
                else
                {
                    plcThread.Visible = false;
                }
            }
            ScriptManager CurrentScriptManager = ScriptManager.GetCurrent(this.Page);
            CurrentScriptManager.Services.Add(new ServiceReference("~/Services/ForumService.asmx"));
        }
Esempio n. 2
0
        void ForumViewer_UC_Load(object sender, EventArgs e)
        {
            dvAddThreadMessages.InnerText = "";
            if (!IsPostBack)
            {
                int ForumID = 0;
                int.TryParse(Request.QueryString["ForumID"], out ForumID);

                ObjectID = ForumID;
                DataLayer.Entities.Forum forum = null;
                if (ObjectID > 0)
                {
                    forum = ForumManager.GetPublishedByID(ForumID);
                }
                if (forum != null)
                {
                    BindForum(forum);
                    BindForumThread(forum.ID);
                    //lbtnAddThread.Visible = SecurityContext.CheckAccessAddThread();
                    plcForum.Visible = true;

                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString().Substring(0, 9), "UpdateForumViews('" + forum.ID + "');", true);

                    #region PagePath
                    List<PagePath> allPaths = new List<PagePath>();
                    PagePath pagePath = new PagePath();
                    pagePath.Name = forum.ForumGroupName;
                    pagePath.Url = ConfigContext.GetForumGroupPage;
                    allPaths.Add(pagePath);

                    pagePath = new PagePath();
                    pagePath.Name = forum.Name;
                    pagePath.Url = string.Empty;
                    allPaths.Add(pagePath);

                    ucPagePath.BindPath(allPaths);
                    #endregion
                }
                else
                {
                    plcForum.Visible = false;
                }
                pnlAddThread.Visible = false;
            }
            ScriptManager CurrentScriptManager = ScriptManager.GetCurrent(this.Page);
            CurrentScriptManager.Services.Add(new ServiceReference("~/Services/ForumService.asmx"));
        }