Exemplo n.º 1
0
    public IEnumerable<PatternMatch> GetPatternsWithGravityShare(ProfileItem visibleProfile, ProfilingTypes type)
    {
      Assert.ArgumentNotNull(visibleProfile, nameof(visibleProfile));

      var userPattern = type == ProfilingTypes.Historic ? GetHistoricMatchedPattern(visibleProfile) : GetActiveMatchedPattern(visibleProfile);

      var patterns = PopulateProfilePatternMatchesWithXdbData.GetPatternsWithGravityShare(visibleProfile, userPattern);
      return patterns.Select(patternKeyValuePair => CreatePatternMatch(visibleProfile, patternKeyValuePair)).OrderByDescending(pm => pm.MatchPercentage);
    }
Exemplo n.º 2
0
    public IEnumerable<Profile> GetProfiles(ProfilingTypes profiling)
    {
      if (!Tracker.IsActive)
      {
        return Enumerable.Empty<Profile>();
      }

      return profileProvider.GetSiteProfiles().Where(p => profileProvider.HasMatchingPattern(p, profiling)).Select(x => new Profile { Name = x.NameField, PatternMatches = profileProvider.GetPatternsWithGravityShare(x, profiling) });
    }
Exemplo n.º 3
0
        public IEnumerable <Profile> GetProfiles(ProfilingTypes profiling)
        {
            if (!Tracker.IsActive)
            {
                return(Enumerable.Empty <Profile>());
            }

            return(profileProvider.GetSiteProfiles().Where(p => profileProvider.HasMatchingPattern(p, profiling)).Select(x => new Profile {
                Name = x.NameField, PatternMatches = profileProvider.GetPatternsWithGravityShare(x, profiling)
            }));
        }
 public bool HasMatchingPattern(ProfileItem currentProfile, ProfilingTypes type)
 {
     if (type == ProfilingTypes.Historic)
     {
         var userPattern = Tracker.Current.Contact.BehaviorProfiles[currentProfile.ID];
         return(userPattern != null && userPattern.NumberOfTimesScored != 0);
     }
     else
     {
         var userPattern = Tracker.Current.Interaction.Profiles[currentProfile.Name];
         return(userPattern != null && userPattern.Count != 0);
     }
 }
Exemplo n.º 5
0
 public bool HasMatchingPattern(ProfileItem currentProfile, ProfilingTypes type)
 {
     if (type == ProfilingTypes.Historic)
     {
         var userPattern = Tracker.Current.Contact.BehaviorProfiles[currentProfile.ID];
         return userPattern != null && userPattern.NumberOfTimesScored != 0;
     }
     else
     {
         var userPattern = Tracker.Current.Interaction.Profiles[currentProfile.Name];
         return userPattern != null && userPattern.Count != 0;
     }
 }
Exemplo n.º 6
0
 public bool HasMatchingPattern(ProfileItem currentProfile, ProfilingTypes type)
 {
   if (type == ProfilingTypes.Historic)
   {
     var userPattern = Tracker.Current.Contact.BehaviorProfiles[currentProfile.ID];
     if (userPattern == null || ID.IsNullOrEmpty(userPattern.PatternId))
     {
       return false;
     }
     return Context.Database.GetItem(userPattern.PatternId) != null;
   }
   else
   {
     var userPattern = Tracker.Current.Interaction.Profiles[currentProfile.Name];
     if (userPattern?.PatternId == null)
     {
       return false;
     }
     return Context.Database.GetItem(userPattern.PatternId.Value.ToID()) != null;
   }
 }
Exemplo n.º 7
0
 public bool HasMatchingPattern(ProfileItem currentProfile, ProfilingTypes type)
 {
     if (type == ProfilingTypes.Historic)
     {
         var userPattern = Tracker.Current.Contact.BehaviorProfiles[currentProfile.ID];
         if (userPattern == null || ID.IsNullOrEmpty(userPattern.PatternId))
         {
             return(false);
         }
         return(Context.Database.GetItem(userPattern.PatternId) != null);
     }
     else
     {
         var userPattern = Tracker.Current.Interaction.Profiles[currentProfile.Name];
         if (userPattern?.PatternId == null)
         {
             return(false);
         }
         return(Context.Database.GetItem(userPattern.PatternId.Value.ToID()) != null);
     }
 }
 public void GetPatternsWithGravityShare_NullProfile_ThrowArgumentNullException(ProfilingTypes profilingTypes, ProfileProvider profileProvider)
 {
     //Act
     profileProvider.Invoking(x => x.GetPatternsWithGravityShare(null, profilingTypes)).ShouldThrow <ArgumentNullException>();
 }
        public IEnumerable <PatternMatch> GetPatternsWithGravityShare(ProfileItem visibleProfile, ProfilingTypes type)
        {
            Assert.ArgumentNotNull(visibleProfile, nameof(visibleProfile));

            var userPattern = type == ProfilingTypes.Historic ? this.GetHistoricMatchedPattern(visibleProfile) : this.GetActiveMatchedPattern(visibleProfile);

            var patterns = PopulateProfilePatternMatchesWithXdbData.GetPatternsWithGravityShare(visibleProfile, userPattern);

            return(patterns.Select(patternKeyValuePair => CreatePatternMatch(visibleProfile, patternKeyValuePair)).OrderByDescending(pm => pm.MatchPercentage));
        }
Exemplo n.º 10
0
 public void GetPatternsWithGravityShare_NullProfile_ThrowArgumentNullException(ProfilingTypes profilingTypes, ProfileProvider profileProvider)
 {
   //Act
   profileProvider.Invoking(x => x.GetPatternsWithGravityShare(null, profilingTypes)).ShouldThrow<ArgumentNullException>();
 }