Example #1
0
        protected void btnLogSub_Click(object sender, EventArgs e)
        {
            MembershipManager mgr = new MembershipManager();

            mgr.LogSubtopicPageView(Guid.Parse("93e4c02c-3d3d-4ccd-95a3-180bb513e543"), Guid.NewGuid(), new Guid());
            mgr.LogSubtopicPageView(Guid.Parse("93e4c02c-3d3d-4ccd-95a3-180bb513e543"), Guid.NewGuid(), new Guid());
        }
Example #2
0
        /// <summary>
        /// Log page view for subtopic filter nav
        /// </summary>
        private void LogViewForPopularity()
        {
            if (Sitecore.Context.PageMode.IsPreview)
            {
                return;
            }
            if (_currentItem.InheritsTemplate(DefaultArticlePageItem.TemplateId))
            {
                // Check for subtopic
                Item parent = _currentItem.Parent;
                if (parent != null &&
                    parent.InheritsTemplate(SubtopicLandingPageItem.TemplateId))
                {
                    // Setup user which page view will be logged against
                    var  mm     = new MembershipManager();
                    Guid viewer = Guid.Empty;
                    if (IsUserLoggedIn)
                    {
                        viewer = CurrentMember.MemberId;
                    }
                    else
                    {
                        // Look up shadow user
                        var shadowUser = mm.GetMemberByScreenName(Constants.UnauthenticatedMember_ScreeName);
                        if (shadowUser != null)
                        {
                            viewer = shadowUser.MemberId;
                        }
                    }

                    try
                    {
                        mm.LogSubtopicPageView(viewer, _currentItem.ID.ToGuid(), parent.ID.ToGuid());
                    }
                    catch (Exception ex)
                    {
                        Sitecore.Diagnostics.Log.Error("Error saving article view log", ex, this);
                    }
                }
            }
        }