Example #1
0
        private Goal[] GetGoals(int numberOfGoals)
        {
            if (Tracker.CurrentVisit != null)
            {
                // TODO: Query the Sitecore Context rather than doing a join on the tables
                var pageEvents = Tracker.Visitor.DataContext.PageEvents
                                 .Where(x => _sitecoreRepository.IsGoal(x.PageEventDefinitionId))
                                 .OrderByDescending(x => x.DateTime)
                                 .Take(numberOfGoals)
                                 .Select(x => new Goal
                {
                    Name      = _sitecoreRepository.GetItem(x.PageEventDefinitionId).Name,
                    Timestamp = x.DateTime
                });

                return(pageEvents.ToArray());
            }

            return(null);
        }
Example #2
0
 public bool IsGoal(Guid pageEventDefinitionId)
 {
     // TODO add caching to this call rather than pass thru
     return(_wrappedRepository.IsGoal(pageEventDefinitionId));
 }