コード例 #1
0
ファイル: BasePage.cs プロジェクト: ridhouan/teamlab.v6.5
        protected void InitSubscribers(ActionContainer actionsContainer, Guid blogAutorID)
        {
            if (!SecurityContext.DemoMode && SecurityContext.IsAuthenticated)
            {
                Utility.RegisterTypeForAjax(typeof (Subscriber));
                _subscriber = new Subscriber();

                AddNewPostSubscriber(actionsContainer);

                if (this is Default && !String.IsNullOrEmpty(Request["userID"]))
                {
                    var userID = Guid.Empty;
                    try
                    {
                        userID = new Guid(Request["userID"]);

                    }
                    catch
                    {
                        userID = Guid.Empty;
                    }

                    if (!userID.Equals(Guid.Empty))
                        AddPersonalBlogSubscriber(userID, actionsContainer);
                }

                if (this is ViewBlog)
                {
                    if (!blogAutorID.Equals(Guid.Empty))
                        AddPersonalBlogSubscriber(blogAutorID, actionsContainer);


                    var blogID = Guid.Empty;
                    try
                    {
                        blogID = new Guid(Request["blogID"]);
                    }
                    catch
                    {
                        blogID = Guid.Empty;
                    }


                    if (!blogID.Equals(Guid.Empty))
                        AddCommentsSubscriber(blogID, actionsContainer);

                }
            }
        }
コード例 #2
0
        private void ShowPost(BlogsEngine engine)
        {
            //EditBlogPresenter presenter = new EditBlogPresenter(ctrlViewBlogView, DaoFactory.GetBlogDao());
            //ctrlViewBlogView.AttachPresenter(presenter);

            ctrlViewBlogView.UpdateCompleted += HandleUpdateCompleted;
            ctrlViewBlogView.UpdateCancelled += HandleUpdateCancelled;

            if (IsPostBack) return;

            Post post;
            try
            {
                post = engine.GetPostById(new Guid(BlogId));
            }
            catch (Exception)
            {
                post = null;
            }

            if (post != null)
            {
                ctrlViewBlogView.post = post;
                var subscriber = new Subscriber();
                var postId = String.IsNullOrEmpty(BlogId) ? new Guid() : new Guid(BlogId);
                var isBlogSubscribe = subscriber.IsCommentsSubscribe(postId);
                var subscribeTopicLink = subscriber.RenderCommentsSubscriptionLink(!isBlogSubscribe, postId);

                SubscribeLinkBlock.Text = subscribeTopicLink;

                BlogTitle = post.Title;

                var loadedComments = engine.GetPostComments(post.ID);

                commentList.Items = BuildCommentsList(post, loadedComments);

                ConfigureComments(commentList, loadedComments.Count, post);
                engine.SavePostReview(post, SecurityContext.CurrentAccount.ID);
            }
            else
            {
                ctrlViewBlogView.Visible = false;
                lblMessage.Visible = true;
                mainContainer.CurrentPageCaption = BlogsResource.AddonName;
                commentList.Visible = false;
                ConfigureComments(commentList, 0, null);
            }
        }