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); }
public bool IsGoal(Guid pageEventDefinitionId) { // TODO add caching to this call rather than pass thru return(_wrappedRepository.IsGoal(pageEventDefinitionId)); }