public void Add([NotNull] string eventId)
        {
            var contact = ContactExtensions.GetCurrentTrackerContact();

            if (contact == null)
            {
                Log.Error("SessionEventSubscriptionsService terminates. Current contact was not resolved", this);
                return;
            }

            if (contact.Attachments.ContainsKey(attachmentKey))
            {
                var subscriptions = (List <string>)contact.Attachments[attachmentKey];
                if (!subscriptions.Contains(eventId))
                {
                    subscriptions.Add(eventId);
                }

                contact.Attachments[attachmentKey] = subscriptions;
            }
            else
            {
                contact.Attachments.Add(attachmentKey, new List <string> {
                    eventId
                });
            }
        }
Esempio n. 2
0
        public void RemoveAll([NotNull] string facetKey)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            RemoveAllFacetValues(facetKey, facets);
            trackerContact.UpdateXConnectFacets(facets);
            UpdateXConnectContact(facets);
        }
        public void UpdateFacet([NotNull] ISportPreferencesPayload data)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            UpdateSportsFacet(data, facets);

            trackerContact.UpdateXConnectFacets(facets);
            UpdateXConnectContact(facets);
        }
        public void UpdateFacet([NotNull] IDemographicsPayload data)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            UpdateAgeGroup(data, facets);
            UpdateGender(data, facets);

            trackerContact.UpdateXConnectFacets(facets);
            UpdateXConnectContact(facets);
        }
Esempio n. 5
0
        public void UpdateFacet([NotNull] IIdentificationPayload data)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            UpdateName(data, facets);
            UpdateEmail(data, facets);

            Tracker.Current.Session.IdentifyAs(Context.Site.Domain.Name, data.Email);

            trackerContact.UpdateXConnectFacets(facets);
            UpdateXConnectContact(facets);
        }
Esempio n. 6
0
        public string[] GetFacetValues([NotNull] string facetKey)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            StringValueListFacet facet;

            if (facets.ContainsKey(facetKey))
            {
                facet = (StringValueListFacet)facets[facetKey];
                return(facet.Values.ToArray());
            }

            return(new string[0]);
        }
Esempio n. 7
0
        public bool ContainsValue([NotNull] string facetKey, [NotNull] string facetValue)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");
            var facets = trackerContact.GetXConnectFacets();

            if (!facets.ContainsKey(facetKey))
            {
                return(false);
            }

            if (facets[facetKey] is StringValueListFacet facet)
            {
                return(facet.Values.Contains(facetValue));
            }

            return(false);
        }
        public List <string> GetAll(Contact contact = null)
        {
            if (contact == null)
            {
                contact = ContactExtensions.GetCurrentTrackerContact();
            }
            if (contact == null)
            {
                Log.Error("SessionEventSubscriptionsService terminates. Current contact was not resolved", this);
                return(new List <string>());
            }

            if (!contact.Attachments.ContainsKey(attachmentKey))
            {
                return(new List <string>());
            }

            return((List <string>)contact.Attachments[attachmentKey]);
        }
        protected DemographicsFacet ReadDemographicsFacet()
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            if (!facets.ContainsKey(DemographicsFacet.DefaultKey))
            {
                return(null);
            }

            if (facets[DemographicsFacet.DefaultKey] is DemographicsFacet facet)
            {
                return(facet);
            }

            return(null);
        }
        protected PersonalInformation ReadPersonalInformationFacet()
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            if (!facets.ContainsKey(PersonalInformation.DefaultFacetKey))
            {
                return(null);
            }

            if (facets[PersonalInformation.DefaultFacetKey] is PersonalInformation facet)
            {
                return(facet);
            }

            return(null);
        }
        public SportsFacet ReadFacet()
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            if (!facets.ContainsKey(SportsFacet.DefaultKey))
            {
                return(null);
            }

            if (facets[SportsFacet.DefaultKey] is SportsFacet facet)
            {
                return(facet);
            }

            return(null);
        }