private void BindData(Item thePage) { string BlogId = ""; string BlogPostId = ""; if (thePage.TemplateID.ToString() == DefaultArticlePageItem.TemplateId) { BlogId = new DefaultArticlePageItem(thePage).BlogId.Raw; BlogPostId = new DefaultArticlePageItem(thePage).BlogPostId.Raw; } else if (thePage.TemplateID.ToString() == 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; }
public object ComputeFieldValue(IIndexable indexable) { var indexItem = indexable as SitecoreIndexableItem; if (indexItem == null) { return null; } var item = (Sitecore.Data.Items.Item)indexItem.Item; if (item == null) { return null; } // Skip non-behavior articles if (!item.InheritsTemplate(BehaviorAdvicePageItem.TemplateId)) { return null; } var article = new BehaviorAdvicePageItem(item); bool fieldMatch = true; CustomTreeListField target = null; // Only index the following fields switch (FieldName) { case UnderstoodDotOrg.Common.Constants.SolrFields.ChildChallenges: target = article.ChildChallenges; break; case UnderstoodDotOrg.Common.Constants.SolrFields.ChildBehaviorGrades: target = article.ChildGrades; break; default: fieldMatch = false; break; } return fieldMatch ? GetSelectedItems(target) : null; }
public BehaviorToolsAdviceVideoPageItem(Item innerItem) : base(innerItem) { _BehaviorAdvicePageItem = new BehaviorAdvicePageItem(innerItem); }