예제 #1
0
 /// <summary>
 /// 注册,需要客户端和用户的账号密码信息 UserToken和AccountDto
 /// </summary>
 /// <param name="token"></param>
 /// <param name="accountDto"></param>
 private void Register(UserToken token, AccountDto accountDto)
 {
     ExecutorManager.Execute(() =>
     {
         accoutBiz.Create(token, accountDto);
     });
 }
예제 #2
0
 public ConsoleUI(GoalManager goalManager, ExecutorManager executorManager,
     GoalExecutorRepository goalExecutorRepository)
 {
     _goalManager = goalManager;
     _executorManager = executorManager;
     _goalExecutorRepository = goalExecutorRepository;
 }
        public UserViewModel GetUserInfo()
        {
            var user     = UserManager.FindByName(User.Identity.Name);
            var executor = ExecutorManager.GetExecutors(new List <string>(), 0, "").FirstOrDefault(e => string.Equals(e.UserId, user.Id));

            var model = new UserViewModel
            {
                UserName    = user.UserName,
                Email       = user.Email,
                FullName    = user.FullName,
                Skype       = user.Skype,
                PhoneNumber = user.PhoneNumber,
            };

            if (user.Executors != null && executor != null)
            {
                model.ExecutorId = executor.Id;
            }
            else
            {
                model.ExecutorId = 0;
            }

            if (user.PhotoId != null)
            {
                model.AvatarPath = user.Photo.Path;
            }
            else
            {
                model.AvatarPath = "";
            }

            return(model);
        }
예제 #4
0
 /// <summary>
 /// 登录,需要客户端和用户的账号密码信息 UserToken和AccountDto
 /// </summary>
 /// <param name="token"></param>
 /// <param name="accountDto"></param>
 private void Login(UserToken token, AccountDto accountDto)
 {
     ExecutorManager.Execute(() =>
     {
         ErrorCode error = accoutBiz.Login(token, accountDto.Account, accountDto.Password);
         if (error == ErrorCode.Success)
         {
             //通知用户登录成功
             token.Send(Protocol.Login, LoginProtocol.S2C_Login);
         }
         else
         {
             //把错误代码发给用户
             token.Send(error);
         }
     });
 }