示例#1
0
        public SinoUser GetCurrentUser()
        {
            string           ticket = ServiceInterpector.GetCurrentTicket();
            SinoSZTicketInfo _info  = TicketLib.GetTicketInfo(ticket);

            if (_info == null)
            {
                return(null);
            }
            string   _yhid  = _info.YHID;
            SinoUser _su    = LogonUserLib.GetUserInfo(_yhid);
            string   postid = ServiceInterpector.GetCurrentPost();

            if (postid != _su.CurrentPost.PostID)
            {
                var _ps = from _c in _su.Posts
                          where _c.PostID == postid
                          select _c;
                if (_ps.Count() > 0)
                {
                    _su.CurrentPost = _ps.First();
                }
            }
            return(_su);
        }
示例#2
0
        public static bool AddUserInfo(string _yhid, SinoUser _su)
        {
            if (_users.ContainsKey(_yhid))
            {
                //如果用户已经登录
                _users[_yhid] = _su;
            }
            else
            {
                _users.Add(_yhid, _su);
            }

            return(true);
        }
示例#3
0
 public HgjsPrincipal()
 {
     UserInfo = null;
 }
示例#4
0
 /// <summary>
 /// 设置当前用户上下文的当前用户ID。
 /// </summary>
 /// <param name="userInfo">当前用户信息</param>
 public static void SetCurUser(SinoUser userInfo)
 {
     //将用户身份存放在CallContext中
     new HgjsPrincipal(userInfo).SaveToCallCtx();
 }
示例#5
0
        public SinoUser UserInfo;         //当前用户ID

        /// <summary>
        /// 构造方法。设置当前用户信息
        /// </summary>
        public HgjsPrincipal(SinoUser _userInfo)
        {
            UserInfo = _userInfo;
        }