Beispiel #1
0
        /// <summary>
        /// 保存当前用户权限列表到Cookie
        /// </summary>
        public static void SetUserRightToCache(T_User user)
        {
            string          rightKey  = user.LoginName + "_right";
            List <T_Rights> rightList = CacheHelp.GetCache <List <T_Rights> >(rightKey);

            if (rightList == null)
            {
                rightList = new T_UserBLL().GetUserRights(user);
                //CacheHelp.AddAbsoluteExpireCache(rightKey, rightList, 24 * 6);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 从Cookie中获取当前用户权限列表
 /// </summary>
 /// <returns></returns>
 public static List <T_Rights> GetUserRightForCache(T_User user)
 {
     try
     {
         string          rightKey  = user.LoginName + "_right";
         List <T_Rights> rightList = CacheHelp.GetCache <List <T_Rights> >(rightKey);
         if (rightList == null)
         {
             rightList = new T_UserBLL().GetUserRights(user);
             //CacheHelp.AddAbsoluteExpireCache(rightKey, rightList, 24 * 6);
         }
         return(rightList);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }