private void BindContent() { BehaviorAdvicePageItem item = Sitecore.Context.Item; litCommentsCount.Text = CommunityHelper.GetTotalComments(item.BlogId.Raw, item.BlogPostId.Raw).ToString(); litHelpfulCount.Text = CommunityHelper.GetTotalLikes(item.ContentId.Raw).ToString(); }
private void BindContent() { BehaviorAdvicePageItem item = Sitecore.Context.Item; ActivityLog log = new ActivityLog(); litCommentsCount.Text = CommunityHelper.GetTotalComments(item.BlogId.Raw, item.BlogPostId.Raw).ToString(); Guid contentId; int helpfulCount = 0; if (Guid.TryParse(Model.BehaviorAdvicePage.ContentId.Raw, out contentId)) { helpfulCount = log.GetActivityCountByValue(contentId, Constants.UserActivity_Values.FoundHelpful_True); } litHelpfulCount.Text = helpfulCount.ToString(); }
private void BindData(Item thePage) { string BlogId = ""; string BlogPostId = ""; if (thePage.InheritsTemplate(DefaultArticlePageItem.TemplateId)) { BlogId = new DefaultArticlePageItem(thePage).BlogId.Raw; BlogPostId = new DefaultArticlePageItem(thePage).BlogPostId.Raw; } else if (thePage.InheritsTemplate(BehaviorToolsAdvicePageItem.TemplateId)) { BlogId = new BehaviorAdvicePageItem(thePage).BlogId.Raw; BlogPostId = new BehaviorAdvicePageItem(thePage).BlogPostId.Raw; } ActivityLog tempLog = new ActivityLog(); //ContentId, ActivityValue int helpfulCount = tempLog.GetActivityCountByValue(new Guid(Sitecore.Context.Item.ID.ToString()), Constants.UserActivity_Values.FoundHelpful_True); int commentCount = 0; if (!string.IsNullOrEmpty(BlogId) && !string.IsNullOrEmpty(BlogPostId)) { commentCount = CommunityHelper.GetTotalComments(BlogId, BlogPostId); } lblHelpfulCount.Text = lblHelpfulCountMobile.Text = helpfulCount.ToString(); lblCommentCount.Text = lblCommentCountMobile.Text = commentCount.ToString(); ltlFoundThisHelpful.Text = ltlFoundThisHelpfulMobile.Text = DictionaryConstants.FoundThisHelpful; string commentLabel = DictionaryConstants.PluralCommentLabel; if (commentCount == 1) { commentLabel = DictionaryConstants.SingleCommentLabel; } ltlComments.Text = ltlCommentsMobile.Text = commentLabel; }
protected void Page_Load(object sender, EventArgs e) { Guid?ContentId = new Guid(blogCig.ContentId.Raw); // Guid ContentId = new Guid(blogCig.ContentId.Raw); // Guid MemberId = this.CurrentMember.MemberId; ActivityLog log = new ActivityLog(); //bool washelpful = log.FoundItemHelpful(ContentId, MemberId); int likeCount = log.GetActivityCountByValue(new Guid(blogCig.ContentId.Raw), Constants.UserActivity_Values.FoundHelpful_True); string commentCount = CommunityHelper.GetTotalComments(blogCig.BlogId, blogCig.BlogPostId).ToString(); //to get if the content was NOT helpful //bool wasNOThelpful = log.FoundItemNotHelpful(ContentId, MemberId); //LikeCount.Text = CommunityHelper.GetTotalLikes(ContentId.ToString()).ToString(); var blogId = blogCig.BlogId.Raw; var blogPostId = blogCig.BlogPostId.Raw; CommentCount.Text = commentCount; LikeCount.Text = likeCount.ToString(); var blogPostInfo = CommunityHelper.ReadBlogBody(Int32.Parse(blogId), Int32.Parse(blogPostId)); btnLike.CommandArgument = btnUnlike.CommandArgument = blogPostInfo.ContentId + "&" + blogPostInfo.ContentTypeId; }