public async Task <PagedResultDto <NameValueDto> > FindUsers(CommonLookupFindUsersInput input)
        {
            if (AbpSession.TenantId != null)
            {
                //Prevent tenants to get other tenant's users.
                input.TenantId = AbpSession.TenantId;
            }

            using (CurrentUnitOfWork.SetTenantId(input.TenantId))
            {
                var query = UserManager.Users
                            .WhereIf(
                    !input.FilterText.IsNullOrWhiteSpace(),
                    u =>
                    //u.Name.Contains(input.FilterText) ||
                    //u.Surname.Contains(input.FilterText) ||
                    u.UserName.Contains(input.FilterText) ||
                    u.EmailAddress.Contains(input.FilterText)
                    );

                var userCount = await query.CountAsync();

                var users = await query
                            .OrderBy(u => u.UserName)
                            //.OrderBy(u => u.Name)
                            //.ThenBy(u => u.Surname)
                            .PageBy(input)
                            .ToListAsync();

                return(new PagedResultDto <NameValueDto>(
                           userCount,
                           users.Select(u =>
                                        new NameValueDto(
                                            u.FullName + " (" + u.EmailAddress + ")",
                                            u.Id.ToString()
                                            )
                                        ).ToList()
                           ));
            }
        }
        public async Task <PagedResultDto <NameValueDto> > FindUsersSetUserNameToValue(CommonLookupFindUsersInput input)
        {
            if (AbpSession.TenantId != null)
            {
                // 防止租户获取其他租户的用户
                input.TenantId = AbpSession.TenantId;
            }

            using (CurrentUnitOfWork.SetTenantId(input.TenantId))
            {
                var query = UserManager.Users
                            .WhereIf(
                    !input.FilterText.IsNullOrWhiteSpace(),
                    u =>
                    u.UserName.Contains(input.FilterText) ||
                    u.EmailAddress.Contains(input.FilterText)
                    );

                var userCount = await query.CountAsync();

                var users = query.ToList()
                            .OrderBy(u => u.Name)
                            .ThenBy(u => u.Surname)
                            .Take(input.MaxResultCount)
                            .Skip(input.SkipCount)
                            .ToList();

                return(new PagedResultDto <NameValueDto>(
                           userCount,
                           users.Select(u =>
                                        new NameValueDto(
                                            u.UserName + " (" + u.EmailAddress + ")",
                                            u.UserName
                                            )
                                        ).ToList()
                           ));
            }
        }