Exemplo n.º 1
0
        public IHttpActionResult ResetPWD()
        {
            var users = _accountUserService.GetAllAccountUsers();

            foreach (var user in users)
            {
                user.PasswordFormat = PasswordFormat.Encrypted;
                user.Password       = _encryptionService.EncryptText(user.Password);

                _accountUserService.UpdateAccountUser(user);
            }

            return(Ok());
        }
Exemplo n.º 2
0
        public IHttpActionResult GetAll(string query = "", string sort = "", int pageSize = Int32.MaxValue, int pageIndex = 0, bool showHidden = false)
        {
            //初始化排序条件
            var sortConditions = PropertySortCondition.Instance(sort);

            //特殊字段排序调整
            if (sort.ToLower().StartsWith("governmentname"))
            {
                sortConditions[0].PropertyName = "Government";
            }


            var accounts = _accountService.GetAllAccountUsers(query, pageIndex, pageSize, showHidden, sortConditions);

            var response = new ListResponse <AccountUserModel>
            {
                Paging = new Paging
                {
                    PageIndex   = pageIndex,
                    PageSize    = pageIndex,
                    Total       = accounts.TotalCount,
                    FilterCount = string.IsNullOrEmpty(query) ? accounts.TotalCount : accounts.Count,
                },
                Data = accounts.Select(s =>
                {
                    var accountModel            = s.ToModel();
                    accountModel.GovernmentName = s.Government.Name;
                    return(accountModel);
                })
            };

            //activity log
            _accountUserActivityService.InsertActivity("GetAccountList", "获取用户列表信息");

            return(Ok(response));
        }