public SessionUser GetSessionUser(Guid userId)
        {
            using (var db = base.NewDB())
            {
                var user = db.Users.FirstOrDefault(x => x.Id == userId);
                if (user == null)
                {
                    return null;
                }
                var roleNames = db.Roles.GetUserRoleNames(user.Id);
                var session = new SessionUser(user, roleNames);

                return session;
            }
        }
        public SessionUser GetSessionUser(Guid userId)
        {
            using (var db = base.NewDB())
            {
                var user = db.Users.FirstOrDefault(x => x.Id == userId);
                if (user == null)
                {
                    return(null);
                }
                var roleNames = db.Roles.GetUserRoleNames(user.Id);
                var session   = new SessionUser(user, roleNames);

                return(session);
            }
        }
 public void Logout()
 {
     _user = null;
 }
 private void ReloadAll(Guid userId)
 {
     var service = Ioc.Get<IUserService>();
     _user = service.GetSessionUser(userId);
     this.WeixinUserId = userId;
 }
 private void ReloadAll(string username)
 {
     _user = Ioc.GetService<IUserService>().GetSessionUser(username);
 }