Example #1
0
File: Roles.cs Project: pcstx/OA
        public static UserSet UsersInRole(int pageIndex, int pageSize, SortUsersBy sortBy, SortOrder sortOrder, Guid roleID, bool cacheable, UserAccountStatus accountStatus, bool returnRecordCount)
        {
            UserSet u = null;

            // build a unique cache key
            StringBuilder s = new StringBuilder();
            s.Append("UsersInRole-");
            s.Append(pageIndex.ToString());
            s.Append(pageSize.ToString());
            s.Append(sortBy.ToString());
            s.Append(sortOrder.ToString());
            s.Append(roleID.ToString());
            s.Append(accountStatus.ToString());
            s.Append(returnRecordCount.ToString());

            string cacheKey =  s.ToString();

            // Get the data from the data provider if not in the cache
            //
            u = CSCache.Get(cacheKey) as UserSet;
            if (u == null || !cacheable) {
                CommonDataProvider dp = CommonDataProvider.Instance();
                u = dp.UsersInRole(pageIndex, pageSize, sortBy, sortOrder, roleID, accountStatus, returnRecordCount);

                if (cacheable)
                    CSCache.Insert(cacheKey,u,12 * CSCache.HourFactor);
            }
            return u;
        }