Beispiel #1
0
        /// <summary>
        /// 删除管理员组
        /// </summary>
        /// <param name="adminGid">管理员组id</param>
        /// <returns>-2代表内置管理员不能删除,-1代表此管理员组下还有会员未删除,0代表删除失败,1代表删除成功</returns>
        public static int DeleteAdminGroupById(int adminGid)
        {
            if (adminGid < 3)
            {
                return(-2);
            }

            if (AdminUsers.GetUserCountByAdminGid(adminGid) > 0)
            {
                return(-1);
            }

            if (adminGid > 0)
            {
                BrnShop.Data.AdminGroups.DeleteAdminGroupById(adminGid);
                BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_ADMINGROUP_ACTIONHASHSET + adminGid);
                BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_ADMINGROUP_LIST);
                File.Delete(IOHelper.GetMapPath(AdminNavMeunCacheFolder + "/" + adminGid + ".js"));
                return(1);
            }
            else
            {
                return(0);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除用户等级
        /// </summary>
        /// <param name="userRid">用户等级id</param>
        /// <returns>-2代表系统等级不能删除,-1代表此等级下还有用户未删除,0代表此用户等级不存在,1代表删除成功</returns>
        public static int DeleteUserRankById(int userRid)
        {
            UserRankInfo userRankInfo = GetUserRankById(userRid);

            if (userRankInfo != null)
            {
                if (userRankInfo.System == 1)
                {
                    return(-2);
                }

                if (AdminUsers.GetUserCountByUserRid(userRid) > 0)
                {
                    return(-1);
                }

                BrnShop.Data.UserRanks.DeleteUserRankById(userRid);
                BSPCache.Remove(CacheKeys.SHOP_USERRANK_LIST);
                return(1);
            }
            return(0);
        }