/// <summary>
 /// Loads the given UserPersonalization object from the given database data reader.
 /// </summary>
 /// <param name="userPersonalization">The UserPersonalization object to load.</param>
 /// <param name="dr">The database data reader to read data from.</param>
 public static void LoadDataReader(UserPersonalization userPersonalization, IDataReader dr)
 {
     //SET FIELDS FROM ROW DATA
     userPersonalization.PersonalizationPathId = dr.GetInt32(0);
     userPersonalization.UserId          = dr.GetInt32(1);
     userPersonalization.PageSettings    = NullableData.GetBytes(dr, 2);
     userPersonalization.Theme           = NullableData.GetString(dr, 3);
     userPersonalization.MasterPageFile  = NullableData.GetString(dr, 4);
     userPersonalization.LastUpdatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(5));
     userPersonalization.IsDirty         = false;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Saves raw personalization data to the underlying data store.
 /// </summary>
 /// <param name="webPartManager">The WebPartManager managing the personalization data.</param>
 /// <param name="path">The path for personalization information to be used as the data store key.</param>
 /// <param name="userName">The user name for personalization information to be used as the key.</param>
 /// <param name="dataBlob">The byte array of data to be saved.</param>
 protected override void SavePersonalizationBlob(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
 {
     if (userName == null)
     {
         SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, true);
         sharedPersonalization.PageSettings = dataBlob;
         sharedPersonalization.Save();
     }
     else
     {
         UserPersonalization userPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, true);
         userPersonalization.PageSettings = dataBlob;
         userPersonalization.Save();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Loads raw personalization data from the underlying data store.
        /// </summary>
        /// <param name="webPartManager">The WebPartManager managing the personalization data.</param>
        /// <param name="path">The path for personalization information to be used as the retrieval key.</param>
        /// <param name="userName">The user name for personalization information to be used as the retrieval key.</param>
        /// <param name="sharedDataBlob">The returned data for the Shared scope.</param>
        /// <param name="userDataBlob">The returned data for the User scope.</param>
        protected override void LoadPersonalizationBlobs(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
        {
            sharedDataBlob = null;
            userDataBlob   = null;
            SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, false);

            if (sharedPersonalization != null)
            {
                sharedDataBlob = sharedPersonalization.PageSettings;
            }
            UserPersonalization UserPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, false);

            if (UserPersonalization != null)
            {
                userDataBlob = UserPersonalization.PageSettings;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Deletes raw personalization data from the underlying data store.
 /// </summary>
 /// <param name="webPartManager">The WebPartManager managing the personalization data.</param>
 /// <param name="path">The path for personalization information to be used as the data store key.</param>
 /// <param name="userName">The user name for personalization information to be used as the data store key.</param>
 protected override void ResetPersonalizationBlob(System.Web.UI.WebControls.WebParts.WebPartManager webPartManager, string path, string userName)
 {
     if (string.IsNullOrEmpty(userName))
     {
         SharedPersonalization sharedPersonalization = SharedPersonalizationDataSource.LoadForPath(path, false);
         if (sharedPersonalization != null)
         {
             sharedPersonalization.Delete();
         }
     }
     else
     {
         UserPersonalization userPersonalization = UserPersonalizationDataSource.LoadForPath(path, userName, false);
         if (userPersonalization != null)
         {
             userPersonalization.Delete();
         }
     }
 }