private void PopulateCount() { ActivityLog tempLog = new ActivityLog(); int helpfulCount = tempLog.GetActivityCountByValue(Guid.Parse(this.model.ID.ToString()), Constants.UserActivity_Values.FoundHelpful_True); lblHelpfulCount.Text = lblHelpfulCountMobile.Text = helpfulCount.ToString(); ltlFoundThisHelpful.Text = ltlFoundThisHelpfulMobile.Text = DictionaryConstants.FoundThisHelpful; }
private void BindData(DefaultArticlePageItem page) { ActivityLog tempLog = new ActivityLog(); //ContentId, ActivityValue int helpfulCount = tempLog.GetActivityCountByValue(new Guid(Sitecore.Context.Item.ID.ToString()), Constants.UserActivity_Values.FoundHelpful_True ); lblHelpfulCount.Text = lblHelpfulCountMobile.Text = helpfulCount.ToString(); ltlFoundThisHelpful.Text = ltlFoundThisHelpfulMobile.Text = DictionaryConstants.FoundThisHelpful; }
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; }
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; }
protected void Page_Load(object sender, EventArgs e) { ActivityLog throwawaylog = new ActivityLog(); //ContentId, ActivityValue lblActivityCount.Text = throwawaylog.GetActivityCountByValue(new Guid("ECEFA524-93F5-4CE3-817B-A6DBBDA7640F"), Constants.UserActivity_Values.Favorited).ToString(); //i read this page. now record it. // Guid MemberId = new Guid(); // Guid ContentId = new Guid(); /* //Create an instance of the Membership Manager MembershipManager mgr = new MembershipManager(); //log that this member has skipped a blog: mgr.LogMemberActivity(MemberId, ContentId, Constants.UserActivity_Values.Skipped_Blog, Constants.UserActivity_Types.ContentSkipped); //log that this member has skipped a blog post: mgr.LogMemberActivity(MemberId, ContentId, Constants.UserActivity_Values.Skipped_BlogPost , Constants.UserActivity_Types.ContentSkipped); //log that this member has skipped a : mgr.LogMemberActivity(MemberId, ContentId, Constants.UserActivity_Values.Skipped_Group , Constants.UserActivity_Types.ContentSkipped); //log that this member has viewed this page //bg: note: we are going to need views for some things and consider how this will behave when we have hundreds of millions of rows mgr.LogMemberActivity(MemberId, ContentId, Constants.UserActivity_Values.ItemViewed, Constants.UserActivity_Types.ContentRelated); mgr.LogMemberActivity(new Guid(), new Guid(), Constants.UserActivity_Values.ItemViewed , Constants.UserActivity_Types.Type_Blog); mgr.LogMemberActivity(new Guid(), new Guid(), Constants.UserActivity_Values.SharedWithTwitter, Constants.UserActivity_Types.Type_BlogPost); */ /* mgr.LogMemberHelpfulVote(MemberIdValue, ContentIdValue, Constants.UserActivity_Values.FoundHelpful_True, Constants.UserActivity_Types.FoundHelpfulVote); */ // MembershipManager mgr = new MembershipManager(); ////to say something was helpful //mgr.LogMemberHelpfulVote(MemberId, ContentId, Constants.UserActivity_Values.FoundHelpful_True, Constants.UserActivity_Types.FoundHelpfulVote); //// to say something was not helpful //mgr.LogMemberHelpfulVote(MemberId, ContentId, Constants.UserActivity_Values.FoundHelpful_False , Constants.UserActivity_Types.FoundHelpfulVote); ////to get IF a content item was helpful to this user //ActivityLog log = new ActivityLog(); //bool washelpful = log.FoundItemHelpful(ContentId, MemberId); ////to get if the content was NOT helpful //bool wasNOThelpful = log.FoundItemNotHelpful(ContentId, MemberId); ActivityLog log = new ActivityLog(new Guid("810EBB87-14E1-4DAF-8EAE-F69E1754C640"), Constants.UserActivity_Values.Favorited); foreach (ActivityItem item in log.Activities) { Response.Write("ContentId: " + item.ContentId + Environment.NewLine); Response.Write("ActivityValue: " + item.ActivityValue + Environment.NewLine + "------------------" + Environment.NewLine); } string targetUrl = "http://www.somethinghostedonconvio.com/myarticle.php"; txtActivityValue.Text = targetUrl ; txtActivityType.Text = UnderstoodDotOrg.Common.Constants.UserActivity_Types.Advocacy_Page.ToString(); /* Quiz quiz = new Quiz(); quiz.QuizID = new Guid(); QuizItem answer = new QuizItem(); answer.QuestionId = Guid.NewGuid(); answer.AnswerValue = "I am the answer."; quiz.MemberAnswers.Add(answer); quiz.MemberAnswers.Add(new QuizItem(Guid.NewGuid(), "I am also an answer")); quiz.MemberAnswers.Add(new QuizItem(Guid.NewGuid(), "I am a third answer")); this.CurrentMember.CompletedQuizes.Add(quiz); */ //member contains data. member manager will save data. // this.CurrentMember.AgreedToSignUpTerms; /* Checklist cl = new Checklist(); cl.MemberId = CurrentMember.MemberId ; ChecklistItem clItem = new ChecklistItem(); clItem.QuestionId = Guid.NewGuid(); clItem.Checked = true; cl.MemberAnswers.Add(clItem); mgr = new MembershipManager(); mgr.ChecklistResults_SaveToDb(cl.MemberId, cl); */ }