private PersonalizationDictionary MergeCustomProperties(PersonalizationInfo sharedInfo, PersonalizationInfo userInfo, bool isWebPartManager, WebPart hasDataWebPart, ref PersonalizationDictionary customInitialProperties) { PersonalizationDictionary dictionary = null; bool flag = (sharedInfo != null) && (sharedInfo._customProperties != null); bool flag2 = (userInfo != null) && (userInfo._customProperties != null); if (flag && flag2) { dictionary = new PersonalizationDictionary(); foreach (DictionaryEntry entry in sharedInfo._customProperties) { dictionary[(string)entry.Key] = (PersonalizationEntry)entry.Value; } foreach (DictionaryEntry entry2 in userInfo._customProperties) { dictionary[(string)entry2.Key] = (PersonalizationEntry)entry2.Value; } } else if (flag) { dictionary = sharedInfo._customProperties; } else if (flag2) { dictionary = userInfo._customProperties; } if ((this.PersonalizationScope == System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared) && flag) { customInitialProperties = sharedInfo._customProperties; } else if ((this.PersonalizationScope == System.Web.UI.WebControls.WebParts.PersonalizationScope.User) && flag2) { customInitialProperties = userInfo._customProperties; } if (flag && !isWebPartManager) { hasDataWebPart.SetHasSharedData(true); } if (flag2 && !isWebPartManager) { hasDataWebPart.SetHasUserData(true); } return(dictionary); }
public void SetHasUserData(WebPart webPart, bool hasUserData) { webPart.SetHasUserData(hasUserData); }
// Returns a PersonalizationDictionary containing a merged view of the custom properties // in both the sharedInfo and the userInfo. private PersonalizationDictionary MergeCustomProperties(PersonalizationInfo sharedInfo, PersonalizationInfo userInfo, bool isWebPartManager, WebPart hasDataWebPart, ref PersonalizationDictionary customInitialProperties) { PersonalizationDictionary customProperties = null; bool hasSharedCustomProperties = (sharedInfo != null && sharedInfo._customProperties != null); bool hasUserCustomProperties = (userInfo != null && userInfo._customProperties != null); // Fill or set the customProperties dictionary if (hasSharedCustomProperties && hasUserCustomProperties) { customProperties = new PersonalizationDictionary(); foreach (DictionaryEntry entry in sharedInfo._customProperties) { customProperties[(string)entry.Key] = (PersonalizationEntry)entry.Value; } foreach (DictionaryEntry entry in userInfo._customProperties) { customProperties[(string)entry.Key] = (PersonalizationEntry)entry.Value; } } else if (hasSharedCustomProperties) { customProperties = sharedInfo._customProperties; } else if (hasUserCustomProperties) { customProperties = userInfo._customProperties; } // Set the customInitialProperties dictionary if (PersonalizationScope == PersonalizationScope.Shared && hasSharedCustomProperties) { customInitialProperties = sharedInfo._customProperties; } else if (PersonalizationScope == PersonalizationScope.User && hasUserCustomProperties) { customInitialProperties = userInfo._customProperties; } // Set the HasSharedData and HasUserData flags if (hasSharedCustomProperties && !isWebPartManager) { hasDataWebPart.SetHasSharedData(true); } if (hasUserCustomProperties && !isWebPartManager) { hasDataWebPart.SetHasUserData(true); } return customProperties; }
public void SetHasUserData(WebPart webPart, bool hasUserData) { webPart.SetHasUserData(hasUserData); }