/// <summary> /// Get the profile value for the property name. /// </summary> /// <param name="profileID">The profile id.</param> /// <param name="propertyName">The property name to serach for.</param> /// <returns>The profile value; else null.</returns> private Nequeo.DataAccess.CloudInteraction.Data.ProfileValue GetSpecificPropertyValue(long profileID, string propertyName) { // Get the user data. Nequeo.DataAccess.CloudInteraction.Data.Extension.ProfileValue profileExt = new Nequeo.DataAccess.CloudInteraction.Data.Extension.ProfileValue(); Nequeo.DataAccess.CloudInteraction.Data.ProfileValue profile = profileExt.Select.SelectDataEntity( u => (u.ProfileID == profileID) && (u.PropertyName == propertyName) ); // Return the profile. return(profile); }
/// <summary> /// Get the current property value. /// </summary> /// <param name="profile">The profile.</param> /// <param name="isAuthenticated">Is the user authenticated or anonymous.</param> /// <param name="propertyName">The name of the property to search for.</param> /// <param name="propertyFound">Has the property been found.</param> /// <returns>The property value.</returns> private object GetProfilePropertyValue(Nequeo.DataAccess.CloudInteraction.Data.Profile profile, bool isAuthenticated, string propertyName, out bool propertyFound) { propertyFound = false; // Is opposite; is anonymous then not authenticated. bool isAnonymous = !isAuthenticated; bool isAnonymousProfile = false; // Attempt to find the property value for the property name // within the current profile id. Nequeo.DataAccess.CloudInteraction.Data.ProfileValue profileValue = GetSpecificPropertyValue(profile.ProfileID, propertyName); if (profileValue != null) { propertyFound = true; } else { return(null); } // If an anonymous value has been set. if (profile.IsAnonymous != null) { // Get the current is anonymous value. isAnonymousProfile = profile.IsAnonymous.Value; // If anonymous values match then return the property value if (isAnonymousProfile == isAnonymous) { return(profileValue.PropertyValue); } else { return(null); } } else { return(profileValue.PropertyValue); } }