Created
May 28, 2017 16:46
-
-
Save hishaamn/b72c5e73a4a3b08ecea0fa1849742faf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void SetProfileKeys(ContentProfile profile, ProfileItem profileItem) | |
{ | |
foreach (ProfileKeyItem profileKeyItem in profileItem.Keys.ToList()) | |
{ | |
ProfileKeyItem keyItem = profileKeyItem; | |
if (profile.Keys.FirstOrDefault(k => string.Compare(k.Key, keyItem.Name, StringComparison.InvariantCultureIgnoreCase) == 0) == null) | |
{ | |
ContentProfileKeyData key = new ContentProfileKeyData(keyItem) | |
{ | |
Value = keyItem.GetDefaultValue() | |
}; | |
profile.AddKey(key); | |
} | |
} | |
foreach (ContentProfileKeyData key in profile.Keys.Where(key => key.ProfileDefinitionId == Guid.Empty)) | |
{ | |
profile.RemoveKey(key); | |
} | |
TrackingField.UpdateKeyValues(profile); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment