Exemplo n.º 1
0
        // Checks whether the current user belongs to the specified persona
        // Called when the visibility condition is evaluated by the server
        public override bool IsVisible()
        {
            ContactInfo currentContact = ContactManagementContext.GetCurrentContact();

            string currentPersonaName = currentContact?.GetPersona()?.PersonaName;

            return(String.Equals(currentPersonaName, RequiredPersona, StringComparison.InvariantCultureIgnoreCase));
        }
Exemplo n.º 2
0
        public CurrentContactViewModel(ContactInfo currentContact)
        {
            PersonaInfo contactPersona = currentContact.GetPersona();

            if (contactPersona != null)
            {
                ContactPersonaName        = contactPersona.PersonaName;
                ContactPersonaDisplayName = contactPersona.PersonaDisplayName;
            }
        }
Exemplo n.º 3
0
        private void DummyPersonalizationMethod()
        {
            //DocSection:PersonaPersonalization
            // Gets the current contact
            ContactInfo currentContact = ContactManagementContext.GetCurrentContact();

            // Gets the code name of the current contact's persona
            string currentPersonaName = currentContact?.GetPersona()?.PersonaName;

            // Checks whether the current contact is assigned to the "EarlyAdopter" persona
            if (String.Equals(currentPersonaName, "EarlyAdopter", StringComparison.InvariantCultureIgnoreCase))
            {
                // Serve personalized content for the "EarlyAdopter" persona
            }
            //EndDocSection:PersonaPersonalization
        }
Exemplo n.º 4
0
        private void DummyPersonalizationMethod()
        {
            //DocSection:PersonaPersonalization
            // Gets the current contact
            IContactTrackingService contactService = new ContactTrackingService();
            ContactInfo             currentContact = contactService.GetCurrentContactAsync(User.Identity.Name).Result;

            // Gets the code name of the current contact's persona
            string currentPersonaName = currentContact.GetPersona()?.PersonaName;

            // Checks whether the current contact is assigned to the "EarlyAdopter" persona
            if (String.Equals(currentPersonaName, "EarlyAdopter", StringComparison.InvariantCultureIgnoreCase))
            {
                // Serve personalized content for the "EarlyAdopter" persona
            }
            //EndDocSection:PersonaPersonalization
        }