Exemple #1
0
        void cmdResetPersonalization_Click(object sender, ImageClickEventArgs e)
        {
            WebPartManager1.Personalization.ResetPersonalizationState();
            if (WebPartManager1.Personalization.Scope == PersonalizationScope.User)
            {
                PersonalizationHelper.ResetPersonalizationBlob(
                    siteSettings,
                    WebPartManager1,
                    CurrentUserPageId.ToString(),
                    Context.User.Identity.Name);
            }

            WebUtils.SetupRedirect(this, SiteRoot + "/MyPage.aspx");
        }
        protected override void ResetPersonalizationBlob(
            WebPartManager webPartManager,
            string path,
            string userName)
        {
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return;
            }

            PersonalizationHelper.ResetPersonalizationBlob(
                siteSettings,
                webPartManager,
                GetUserPagePath(path),
                userName);
        }
        public override int ResetState(
            PersonalizationScope scope,
            string[] paths,
            string[] usernames)
        {
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                return(0);
            }
            if (paths.Length != usernames.Length)
            {
                return(0);
            }
            if (paths.Length == 0)
            {
                return(0);
            }
            if (usernames.Length == 0)
            {
                return(0);
            }
            int i = 0;

            while (i < paths.Length)
            {
                PersonalizationHelper.ResetPersonalizationBlob(
                    siteSettings,
                    paths[i],
                    usernames[i]);

                i += 1;
            }

            return(i + 1);
        }