• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PersonalizationScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PersonalizationScope的典型用法代码示例。如果您正苦于以下问题:C# PersonalizationScope类的具体用法?C# PersonalizationScope怎么用?C# PersonalizationScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PersonalizationScope类属于命名空间,在下文中一共展示了PersonalizationScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FindState

        public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope,
                                                                     PersonalizationStateQuery query,
                                                                     int pageIndex,
                                                                     int pageSize,
                                                                     out int totalRecords)
        {
            PersonalizationProviderHelper.CheckPersonalizationScope(scope);
            PersonalizationProviderHelper.CheckPageIndexAndSize(pageIndex, pageSize);

            if (scope == PersonalizationScope.Shared)
            {
                string pathToMatch = null;
                if (query != null)
                {
                    pathToMatch = PersonalizationProviderHelper.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, MaxStringLength);
                }
                return FindSharedState(pathToMatch, pageIndex, pageSize, out totalRecords);
            }
            else
            {
                string pathToMatch = null;
                DateTime inactiveSinceDate = DateTime.MinValue;
                string usernameToMatch = null;
                if (query != null)
                {
                    pathToMatch = PersonalizationProviderHelper.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, MaxStringLength);
                    inactiveSinceDate = query.UserInactiveSinceDate;
                    usernameToMatch = PersonalizationProviderHelper.CheckAndTrimString(
                                            query.UsernameToMatch, "query.UsernameToMatch", false, MaxStringLength);
                }

                return FindUserState(pathToMatch, inactiveSinceDate, usernameToMatch,
                                     pageIndex, pageSize, out totalRecords);
            }
        }
开发者ID:akiander,项目名称:December,代码行数:35,代码来源:AccessPersonalizationProvider.cs


示例2: FindState

        public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize, out int totalRecords)
        {
            PersonalizationProviderHelper.CheckPersonalizationScope(scope);
            PersonalizationProviderHelper.CheckPageIndexAndSize(pageIndex, pageSize);

            if (scope == PersonalizationScope.Shared)
            {
                string str = null;
                if (query != null)
                    str = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, 0x100);

                return this.FindSharedState(str, pageIndex, pageSize, out totalRecords);
            }

            string path = null;
            DateTime defaultInactiveSinceDate = DateTime.MaxValue;
            string username = null;

            if (query != null)
            {
                path = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, 0x100);
                defaultInactiveSinceDate = query.UserInactiveSinceDate;
                username = StringUtil.CheckAndTrimString(query.UsernameToMatch, "query.UsernameToMatch", false, 0x100);
            }

            return this.FindUserState(path, defaultInactiveSinceDate, username, pageIndex, pageSize, out totalRecords);
        }
开发者ID:kohku,项目名称:codefactory,代码行数:27,代码来源:PersonalizationProvider.cs


示例3: WebPartChrome

 public WebPartChrome(WebPartZoneBase zone, System.Web.UI.WebControls.WebParts.WebPartManager manager)
 {
     if (zone == null)
     {
         throw new ArgumentNullException("zone");
     }
     this._zone = zone;
     this._page = zone.Page;
     this._designMode = zone.DesignMode;
     this._manager = manager;
     if (this._designMode)
     {
         this._personalizationEnabled = true;
     }
     else
     {
         this._personalizationEnabled = (manager != null) && manager.Personalization.IsModifiable;
     }
     if (manager != null)
     {
         this._personalizationScope = manager.Personalization.Scope;
     }
     else
     {
         this._personalizationScope = PersonalizationScope.Shared;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:WebPartChrome.cs


示例4: GetCountOfState

        public static int GetCountOfState(
            SiteSettings siteSettings,
            PersonalizationScope scope,
            PersonalizationStateQuery query)
        {
            int result = 0;

            if (siteSettings != null)
            {
                Guid userGuid = Guid.Empty;
                if ((query.UsernameToMatch != null) && (query.UsernameToMatch.Length > 0))
                {
                    SiteUser siteUser = new SiteUser(siteSettings, query.UsernameToMatch);
                    if (siteUser.UserId > 0)
                    {
                        userGuid = siteUser.UserGuid;
                    }

                }

                bool allUsersScope = (scope == PersonalizationScope.Shared);
                result = SitePersonalization.GetCountOfState(
                    siteSettings.SiteId,
                    query.PathToMatch,
                    allUsersScope,
                    userGuid,
                    query.UserInactiveSinceDate);

            }

            return result;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:32,代码来源:PersonalizationHelper.cs


示例5: PersonalizationEntry

 public PersonalizationEntry(object value, PersonalizationScope scope, bool isSensitive)
 {
     PersonalizationProviderHelper.CheckPersonalizationScope(scope);
     this._value = value;
     this._scope = scope;
     this._isSensitive = isSensitive;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:PersonalizationEntry.cs


示例6: WebPartChrome

        public WebPartChrome(WebPartZoneBase zone, WebPartManager manager) {
            if (zone == null) {
                throw new ArgumentNullException("zone");
            }
            _zone = zone;
            _page = zone.Page;
            _designMode = zone.DesignMode;
            _manager = manager;

            if (_designMode) {
                // Consider personalization to be enabled at design-time
                _personalizationEnabled = true;
            }
            else {
                _personalizationEnabled = (manager != null && manager.Personalization.IsModifiable);
            }

            if (manager != null) {
                _personalizationScope = manager.Personalization.Scope;
            }
            else {
                // Consider scope to be shared at design-time
                _personalizationScope = PersonalizationScope.Shared;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:WebPartChrome.cs


示例7: FindState

 /// <summary>
 /// Finds state matching given parameters
 /// </summary>
 /// <param name="scope">Scope to search</param>
 /// <param name="query">Query to action</param>
 /// <param name="pageIndex">Index of page to retrieve</param>
 /// <param name="pageSize">Size of page to retrieve</param>
 /// <returns>Matching state</returns>
 public FindStateResult FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize)
 {
     int totalRecords = 0;
     PersonalizationStateInfoCollection collection = Provider.FindState(scope, query, pageIndex, pageSize, out totalRecords);
     FindStateResult result = new FindStateResult();
     result.TotalRecords = totalRecords;
     result.StateInfoCollection = collection;
     return result;
 }
开发者ID:qwert789,项目名称:codegallery,代码行数:17,代码来源:PersonalizationService.cs


示例8: ChangeScope

 protected virtual void ChangeScope(PersonalizationScope scope)
 {
     PersonalizationProviderHelper.CheckPersonalizationScope(scope);
     if (scope != this._currentScope)
     {
         if ((scope == PersonalizationScope.Shared) && !this.CanEnterSharedScope)
         {
             throw new InvalidOperationException(System.Web.SR.GetString("WebPartPersonalization_CannotEnterSharedScope"));
         }
         this._currentScope = scope;
         this._scopeToggled = true;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:WebPartPersonalization.cs


示例9: ResetAllState

        private int ResetAllState(PersonalizationScope scope) {
            SqlConnectionHolder connectionHolder = null;
            SqlConnection connection = null;
            int count = 0;

            // Extra try-catch block to prevent elevation of privilege attack via exception filter
            try {
                try {
                    connectionHolder = GetConnectionHolder();
                    connection = connectionHolder.Connection;
                    Debug.Assert(connection != null);

                    CheckSchemaVersion( connection );

                    SqlCommand command = new SqlCommand("dbo.aspnet_PersonalizationAdministration_DeleteAllState", connection);
                    SetCommandTypeAndTimeout(command);
                    SqlParameterCollection parameters = command.Parameters;

                    SqlParameter parameter = parameters.Add(new SqlParameter("AllUsersScope", SqlDbType.Bit));
                    parameter.Value = (scope == PersonalizationScope.Shared);

                    parameters.AddWithValue("ApplicationName", ApplicationName);

                    parameter = parameters.Add(new SqlParameter("Count", SqlDbType.Int));
                    parameter.Direction = ParameterDirection.Output;

                    command.ExecuteNonQuery();
                    parameter = command.Parameters[2];
                    if (parameter != null && parameter.Value != null && parameter.Value is Int32) {
                        count = (Int32) parameter.Value;
                    }
                }
                finally {
                    if (connectionHolder != null) {
                        connectionHolder.Close();
                        connectionHolder = null;
                    }
                }
            }
            catch {
                throw;
            }

            return count;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:45,代码来源:SqlPersonalizationProvider.cs


示例10: ResetState

 public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
 {
   return default(int);
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs


示例11: GetCountOfState

 public override int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query) {
     PersonalizationProviderHelper.CheckPersonalizationScope(scope);
     if (scope == PersonalizationScope.Shared) {
         string pathToMatch = null;
         if (query != null) {
             pathToMatch = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
         }
         return GetCountOfSharedState(pathToMatch);
     }
     else {
         string pathToMatch = null;
         DateTime userInactiveSinceDate = PersonalizationAdministration.DefaultInactiveSinceDate;
         string usernameToMatch = null;
         if (query != null) {
             pathToMatch = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
             userInactiveSinceDate = query.UserInactiveSinceDate;
             usernameToMatch = StringUtil.CheckAndTrimString(query.UsernameToMatch, "query.UsernameToMatch", false, maxStringLength);
         }
         return GetCountOfUserState(pathToMatch, userInactiveSinceDate, usernameToMatch);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:21,代码来源:SqlPersonalizationProvider.cs


示例12: FindState

    public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize, out int totalRecords)
    {
      totalRecords = default(int);

      return default(PersonalizationStateInfoCollection);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:6,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs


示例13: GetCountOfState

 public override int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query)
 {
   return default(int);
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs


示例14: GetPersonalizedProperties

        /// <devdoc>
        /// Does the work of retrieving personalized properties. If the scope is User, the shared
        /// personalizable properties are not retrieved. If a non-null defaultPropertyState is
        /// handed in, only the properties that are different from the default values are retrieved.
        /// </devdoc>
        private static IDictionary GetPersonalizedProperties(Control control,
                                                             IDictionary personalizableProperties,
                                                             IDictionary defaultPropertyState,
                                                             IDictionary initialPropertyState,
                                                             PersonalizationScope scope) {
            Debug.Assert(control != null);

            if (personalizableProperties.Count == 0) {
                return null;
            }

            bool ignoreSharedProperties = (scope == PersonalizationScope.User);
            IDictionary properties = null;

            foreach (DictionaryEntry entry in personalizableProperties) {
                PersonalizablePropertyEntry property = (PersonalizablePropertyEntry)entry.Value;

                if (ignoreSharedProperties && (property.Scope == PersonalizationScope.Shared)) {
                    continue;
                }

                PropertyInfo pi = property.PropertyInfo;
                Debug.Assert(pi != null);

                // 
                string name = (string)entry.Key;
                object value = FastPropertyAccessor.GetProperty(control, name, control.DesignMode);
                bool saveProperty = true;

                // Only compare to default value if there is no initial value.
                if ((initialPropertyState == null || !initialPropertyState.Contains(name)) && defaultPropertyState != null) {
                    object defaultValue = defaultPropertyState[name];
                    if (Object.Equals(value, defaultValue)) {
                        saveProperty = false;
                    }
                }

                if (saveProperty) {
                    if (properties == null) {
                        properties = new HybridDictionary(personalizableProperties.Count, /* caseInsensitive */ false);
                    }

                    properties[name] = value;
                }
            }

            return properties;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:53,代码来源:BlobPersonalizationState.cs


示例15: ResetState

 public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
 {
     throw new NotImplementedException();
 }
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:4,代码来源:Personalization.cs


示例16: FindState

        //private PersonalizationStateInfoCollection FindSharedState(
        //    string path,
        //    int pageIndex,
        //    int pageSize,
        //    out int totalRecords)
        //{
        //    totalRecords = 0;
        //    PersonalizationStateInfoCollection sharedStateInfoCollection
        //        = new PersonalizationStateInfoCollection();
        //    if (siteSettings != null)
        //    {
        //        IDataReader reader = SitePersonalization.FindState(
        //            siteSettings.SiteID,
        //            path,
        //            true,
        //            Guid.Empty,
        //            DateTime.MaxValue,
        //            pageIndex,
        //            pageSize);
        //        if (reader != null)
        //        {
        //            while (reader.Read())
        //            {
        //                string returnedPath = reader.GetString(reader.GetOrdinal("Path"));
        //                // Data can be null if there is no data associated with the path
        //                DateTime lastUpdatedDate = (reader.IsDBNull(reader.GetOrdinal("LastActivityDate"))) ? DateTime.MinValue :
        //                                                DateTime.SpecifyKind(reader.GetDateTime(reader.GetOrdinal("LastActivityDate")),
        //                                                DateTimeKind.Utc);
        //                int size = (reader.IsDBNull(2)) ? 0 : reader.GetInt32(2);
        //                int userDataSize = (reader.IsDBNull(3)) ? 0 : reader.GetInt32(3);
        //                int userCount = (reader.IsDBNull(4)) ? 0 : reader.GetInt32(4);
        //                sharedStateInfoCollection.Add(new SharedPersonalizationStateInfo(
        //                    returnedPath, lastUpdatedDate, size, userDataSize, userCount));
        //            }
        //            // The reader needs to be closed so return value can be accessed
        //            // See MSDN doc for SqlParameter.Direction for details.
        //            reader.Close();
        //            reader = null;
        //        }
        //        // Set the total count at the end after all operations pass
        //        //if (returnValue.Value != null && returnValue.Value is int)
        //        //{
        //        //    totalRecords = (int)returnValue.Value;
        //        //}
        //    }
        //    return sharedStateInfoCollection;
        //}
        public override PersonalizationStateInfoCollection FindState(
            PersonalizationScope scope, 
            PersonalizationStateQuery query, 
            int pageIndex, 
            int pageSize, 
            out int totalRecords)
        {
            //mojoPersonalizationProviderHelper.CheckPersonalizationScope(scope);
            //mojoPersonalizationProviderHelper.CheckPageIndexAndSize(pageIndex, pageSize);

            //if (scope == PersonalizationScope.Shared)
            //{
            //    string pathToMatch = null;
            //    if (query != null)
            //    {
            //        pathToMatch = CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
            //    }
            //    return FindSharedState(pathToMatch, pageIndex, pageSize, out totalRecords);
            //}
            //else
            //{
            //    string pathToMatch = null;
            //    DateTime inactiveSinceDate = DefaultInactiveSinceDate;
            //    string usernameToMatch = null;
            //    if (query != null)
            //    {
            //        pathToMatch = CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
            //        inactiveSinceDate = query.UserInactiveSinceDate;
            //        usernameToMatch = CheckAndTrimString(query.UsernameToMatch, "query.UsernameToMatch", false, maxStringLength);
            //    }

            //    return FindUserState(pathToMatch, inactiveSinceDate, usernameToMatch,
            //                         pageIndex, pageSize, out totalRecords);
            //}

            throw new Exception("The method or operation is not implemented.");
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:84,代码来源:mojoPersonalizationProvider.cs


示例17: ResetState

 /// <summary>
 /// Resets personalization state
 /// </summary>
 /// <param name="scope">Scope to reset</param>
 /// <param name="paths">Paths to data</param>
 /// <param name="usernames">Usernames to reset</param>
 /// <returns>Count of reset users</returns>
 public int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
 {
     return Provider.ResetState(scope, paths, usernames);
 }
开发者ID:qwert789,项目名称:codegallery,代码行数:11,代码来源:PersonalizationService.cs


示例18: ResetState

        public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames) {
            PersonalizationProviderHelper.CheckPersonalizationScope(scope);
            paths = PersonalizationProviderHelper.CheckAndTrimNonEmptyStringEntries(paths, "paths", false, false, maxStringLength);
            usernames = PersonalizationProviderHelper.CheckAndTrimNonEmptyStringEntries(usernames, "usernames", false, true, maxStringLength);

            if (scope == PersonalizationScope.Shared) {
                PersonalizationProviderHelper.CheckUsernamesInSharedScope(usernames);
                return ResetSharedState(paths);
            }
            else {
                PersonalizationProviderHelper.CheckOnlyOnePathWithUsers(paths, usernames);
                return ResetUserState(paths, usernames);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:SqlPersonalizationProvider.cs


示例19: ResetState

 public virtual int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:SqlPersonalizationProvider.cs


示例20: GetCountOfState

 public virtual int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:SqlPersonalizationProvider.cs



注:本文中的PersonalizationScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PerspexProperty类代码示例发布时间:2022-05-24
下一篇:
C# PersonalCacheStruct类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap