/// <summary>
        /// 新增用户账号信息
        /// </summary>
        public virtual UserAccountEditDto CreateUserAccount(UserAccountEditDto input)
        {
            //TODO:新增前的逻辑判断,是否允许新增

            var entity = input.MapTo <UserAccount>();

            entity = _userAccountRepository.Insert(entity);
            return(entity.MapTo <UserAccountEditDto>());
        }
 public ActionResult UpdataUser(UserAccountEditDto input)
 {
     try
     {
         _userAccountService.UpdateUserAccount(input);
         return(RedirectToAction("/Index"));
     }
     catch (Exception) { }
     return(RedirectToAction("/UpdateAccountUser", input));
 }
        public void UpdateUserAccountByNo(UserAccountEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新
            var entity = _userAccountRepository.FirstOrDefault(c => c.SysNO == input.SysNO);
            var id     = entity.Id;

            input.MapTo(entity);
            entity.Id = id;
            _userAccountRepository.Update(entity);
        }
        /// <summary>
        /// 编辑用户账号信息
        /// </summary>
        public virtual void UpdateUserAccount(UserAccountEditDto input)
        {
            //TODO:更新前的逻辑判断,是否允许更新

            var entity = _userAccountRepository.Get(input.Id.Value);

            input.MapTo(entity);

            _userAccountRepository.Update(entity);
        }
        /// <summary>
        /// 通过Id获取用户账号信息信息进行编辑或修改
        /// </summary>
        public GetUserAccountForEditOutput GetUserAccountForEdit(NullableIdDto <long> input)
        {
            var output = new GetUserAccountForEditOutput();

            UserAccountEditDto userAccountEditDto;

            if (input.Id.HasValue)
            {
                var entity = _userAccountRepository.Get(input.Id.Value);
                userAccountEditDto = entity.MapTo <UserAccountEditDto>();
            }
            else
            {
                userAccountEditDto = new UserAccountEditDto();
            }

            output.UserAccount = userAccountEditDto;
            return(output);
        }
        public ActionResult UserYynchronization()
        {
            var resultstr = "-1";

            try
            {
                //获取服务端所有用户
                AuthServiceSoapClient authServiceSoapClient = new AuthServiceSoapClient();
                ColleageInnerTraining.Web.AuthServiceProxy.SystemUser[] AuthSystemUserList = authServiceSoapClient.GetSystemUserByApplicationID(SystemDataConst.ApplicationID);
                //获取用户端所有用户
                var systemUserList = _userAccountService.GetAccountData();
                if (AuthSystemUserList != null && AuthSystemUserList.Any())
                {
                    foreach (var item in AuthSystemUserList)
                    {
                        UserAccountEditDto userAccount = new UserAccountEditDto();
                        var currentUser = systemUserList.FirstOrDefault(c => c.SysNO == item.SysNO);
                        if (currentUser != null)
                        {   //修改
                            userAccount.LoginName       = item.LoginName;
                            userAccount.DisplayName     = item.DisplayName;
                            userAccount.PhoneNumber     = item.PhoneNumber;
                            userAccount.Email           = item.Email;
                            userAccount.SysNO           = currentUser.SysNO;
                            userAccount.DepartmentID    = currentUser.DepartmentID;
                            userAccount.DepartmentName  = currentUser.DepartmentName;
                            userAccount.Password        = currentUser.Password;
                            userAccount.Status          = Convert.ToBoolean(item.Status);
                            userAccount.province        = currentUser.province;
                            userAccount.ProvinceID      = currentUser.ProvinceID;
                            userAccount.City            = currentUser.City;
                            userAccount.CityID          = currentUser.CityID;
                            userAccount.Area            = currentUser.Area;
                            userAccount.AreaID          = currentUser.AreaID;
                            userAccount.DetailedAddress = currentUser.DetailedAddress;
                            userAccount.PostID          = currentUser.PostID;
                            userAccount.PostName        = currentUser.PostName;
                            _userAccountService.UpdateUserAccountByNo(userAccount);
                        }
                        else
                        {   //增加
                            userAccount.SysNO          = item.SysNO;
                            userAccount.LoginName      = item.LoginName;
                            userAccount.DisplayName    = item.DisplayName;
                            userAccount.DepartmentName = item.DepartmentName;
                            userAccount.PhoneNumber    = item.PhoneNumber;
                            userAccount.Email          = item.Email;
                            userAccount.Password       = item.Password;
                            userAccount.Status         = Convert.ToBoolean(item.Status);
                            _userAccountService.CreateUserAccount(userAccount);
                        }
                    }
                    resultstr = "0";
                }
            }
            catch (Exception ex)
            {
                resultstr = "-1";
            }
            return(Json(resultstr, JsonRequestBehavior.AllowGet));
        }