public async Task <PagedResultDto <TenantListDto> > GetPaged(GetTenantsInput input) { // var query = TenantManager.Tenants .Include(o => o.Edition) // 过滤名称 .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), o => o.Name.Contains(input.FilterText) || o.TenancyName.Contains(input.FilterText)) // 过滤创建时间范围 .WhereIf(input.CreationDateStart.HasValue, o => o.CreationTime >= input.CreationDateStart.Value) .WhereIf(input.CreationDateEnd.HasValue, o => o.CreationTime <= input.CreationDateEnd.Value) // 过滤订阅时间范围 .WhereIf(input.SubscriptionStart.HasValue, o => o.SubscriptionEndUtc >= input.SubscriptionStart.Value.ToUniversalTime()) .WhereIf(input.SubscriptionEnd.HasValue, o => o.SubscriptionEndUtc <= input.SubscriptionEnd.Value.ToUniversalTime()) // 过滤版本 .WhereIf(input.EditionId.HasValue, o => o.EditionId == input.EditionId); // var tenantCount = await query.CountAsync(); // var tenants = await query .OrderBy(input.Sorting) .PageBy(input) .ToListAsync(); return(new PagedResultDto <TenantListDto>( tenantCount, ObjectMapper.Map <List <TenantListDto> >(tenants) )); }
public async Task <PagedResultDto <TenantListDto> > GetTenants(GetTenantsInput input) { var query = TenantManager.Tenants .Include(t => t.Edition) .WhereIf(!input.Filter.IsNullOrWhiteSpace(), t => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter)) .WhereIf(input.CreationDateStart.HasValue, t => t.CreationTime >= input.CreationDateStart.Value) .WhereIf(input.CreationDateEnd.HasValue, t => t.CreationTime <= input.CreationDateEnd.Value) .WhereIf(input.SubscriptionEndDateStart.HasValue, t => t.SubscriptionEndDateUtc >= input.SubscriptionEndDateStart.Value.ToUniversalTime()) .WhereIf(input.SubscriptionEndDateEnd.HasValue, t => t.SubscriptionEndDateUtc <= input.SubscriptionEndDateEnd.Value.ToUniversalTime()) .WhereIf(input.EditionIdSpecified, t => t.EditionId == input.EditionId); var querylst = from s in query select new TenantListDto { TenancyName = s.TenancyName, Name = s.Name, EditionDisplayName = s.Edition.DisplayName, ConnectionString = s.ConnectionString, IsActive = s.IsActive, CreationTime = s.CreationTime, SubscriptionEndDateUtc = s.SubscriptionEndDateUtc, TenantTypeName = s.TenantTypes.Name, Id = s.Id }; var tenantCount = await querylst.CountAsync(); var tenants = await querylst.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return(new PagedResultDto <TenantListDto>(tenantCount, ObjectMapper.Map <List <TenantListDto> >(tenants))); }
public virtual async Task <PagedResultDto <TenantDto> > GetListAsync(GetTenantsInput input) { return(await RequestAsync <PagedResultDto <TenantDto> >(nameof(GetListAsync), new ClientProxyRequestTypeValue { { typeof(GetTenantsInput), input } })); }
public async Task <PagedResultDto <TenantListDto> > GetTenants(GetTenantsInput input) { var query = TenantManager.Tenants .Include(t => t.Edition) .WhereIf(!input.Filter.IsNullOrWhiteSpace(), t => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter)) .WhereIf(input.CreationDateStart.HasValue, t => t.CreationTime >= input.CreationDateStart.Value) .WhereIf(input.CreationDateEnd.HasValue, t => t.CreationTime <= input.CreationDateEnd.Value) .WhereIf(input.SubscriptionEndDateStart.HasValue, t => t.SubscriptionEndDateUtc >= input.SubscriptionEndDateStart.Value.ToUniversalTime()) .WhereIf(input.SubscriptionEndDateEnd.HasValue, t => t.SubscriptionEndDateUtc <= input.SubscriptionEndDateEnd.Value.ToUniversalTime()) .WhereIf(input.EditionIdSpecified, t => t.EditionId == input.EditionId); var tenantCount = await query.CountAsync(); var tenants = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); /* * foreach(var tenant in tenants) * { * tenant.TenantType = (tenant.TenantType == "C") ? "Customer" : tenant.TenantType; * tenant.TenantType = (tenant.TenantType == "V") ? "Vendor" : tenant.TenantType; * tenant.TenantType = (tenant.TenantType == "A") ? "Asset Owner" : tenant.TenantType; * tenant.TenantType = (tenant.TenantType == "") ? "Generic" : tenant.TenantType; * } */ return(new PagedResultDto <TenantListDto>( tenantCount, ObjectMapper.Map <List <TenantListDto> >(tenants) )); }
public async Task <ListResultDto <TenantDto> > GetTenants(GetTenantsInput input) { var tenants = await _tenantManager.Tenants .Where(x => (!input.Keyword.IsNullOrWhiteSpace())?x.TenancyName.Contains(input.Keyword) : true) .Where(x => (input.IsActive.HasValue) ? x.IsActive == input.IsActive : true) .Include(x => x.Category) .Include(x => x.SubCategories) //.Include(x => x.SubCategories) .OrderBy(x => x.TenancyName) .ToListAsync(); var items = tenants .Select(x => { var categoryDto = new TenantCategoryDto(); var subCategoriesDto = new List <TenantSubCategoryDto>(); if (x.Category != null) { categoryDto.Title = x.Category.Title; var subCategories = _tenantCategoryManager.TenantCategories .Where(y => y.Id == x.Category.Id).Include(y => y.SubCategories) .Select(y => new { subCategories = y.SubCategories.ToDictionary(z => z.Id, z => z.Title) }).FirstOrDefault().subCategories; foreach (var subCategory in x.SubCategories) { var s = new TenantSubCategoryDto(); s.Title = subCategories.GetOrDefault(subCategory.SubCategory.Id); subCategoriesDto.Add(s); } } return(new TenantDto { Id = x.Id, TenancyName = x.TenancyName, Name = x.Name, IsActive = x.IsActive, Category = categoryDto, ProfilePictureId = x.ProfilePictureId, //new TenantCategory.Dto.TenantCategoryDto //{ // Title = x.Category.Title //}, //x.SubCategories.FToList() SubCategories = subCategoriesDto //x.SubCategories.Select(y => new TenantCategory.Dto.TenantSubCategoryDto //{ // Title = y.Title //}).ToList() }); }) .ToList(); return(new ListResultDto <TenantDto>(items)); }
public virtual async Task <PagedResultDto <SaasTenantDto> > GetListAsync(GetTenantsInput input) { var list = await TenantRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); var totalCount = await TenantRepository.GetCountAsync(); return(new PagedResultDto <SaasTenantDto>( totalCount, ObjectMapper.Map <List <Tenant>, List <SaasTenantDto> >(list) )); }
public async Task <PagedResultOutput <TenantListDto> > GetTenants(GetTenantsInput input) { IQueryable <Tenant> tenants = this.TenantManager.Tenants; IQueryable <Tenant> tenants1 = System.Data.Entity.QueryableExtensions.Include <Tenant, Edition>(tenants, (Tenant t) => t.Edition); IQueryable <Tenant> tenants2 = tenants1.WhereIf <Tenant>(!input.Filter.IsNullOrWhiteSpace(), (Tenant t) => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter)); int num = await tenants2.CountAsync <Tenant>(); List <Tenant> listAsync = await tenants2.OrderBy <Tenant>(input.Sorting, new object[0]).PageBy <Tenant>(input).ToListAsync <Tenant>(); return(new PagedResultOutput <TenantListDto>(num, listAsync.MapTo <List <TenantListDto> >())); }
public async Task <PagedResultDto <TenantListDto> > GetTenants(GetTenantsInput input) { var query = _tenantManager.Tenants .Include(t => t.Edition) .WhereIf(!input.Filter.IsNullOrWhiteSpace(), t => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter)); var count = await query.CountAsync(); var tenants = await query.Sorting(input.Sorting).PageBy(input).ToListAsync(); var items = tenants.MapTo <List <TenantListDto> >(); PagedResultDto <TenantListDto> pagedResultDto = new PagedResultDto <TenantListDto>(count, input.PageIndex, input.PageSize, items); return(pagedResultDto); }
public async Task <PagedResultDto <TenantListDto> > GetPagedAsync(GetTenantsInput input) { var query = GetTenantsFilteredQuery(input); int tenantCount = await query.CountAsync(); List <Tenant> tenants = await query .AsNoTracking() .OrderBy(input.Sorting) .PageBy(input) .ToListAsync(); List <TenantListDto> tenantListDtos = _mapper.Map <List <TenantListDto> >(tenants); return(new PagedResultDto <TenantListDto>( tenantCount, tenantListDtos )); }
public async Task <PagedResultDto <TenantListDto> > GetTenants(GetTenantsInput input) { var query = TenantManager.Tenants .Include(t => t.Edition) .WhereIf( !input.Filter.IsNullOrWhiteSpace(), t => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter) ); var tenantCount = await query.CountAsync(); var tenants = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return(new PagedResultDto <TenantListDto>( tenantCount, tenants.MapTo <List <TenantListDto> >() )); }
public virtual async Task <PagedResultDto <TenantDto> > GetListAsync(GetTenantsInput input) { if (input.Sorting.IsNullOrWhiteSpace()) { input.Sorting = nameof(Tenant.Name); } var count = await TenantRepository.GetCountAsync(input.Filter); var list = await TenantRepository.GetListAsync( input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter ); return(new PagedResultDto <TenantDto>( count, ObjectMapper.Map <List <Tenant>, List <TenantDto> >(list) )); }
/// <summary> /// 获取所有租户 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <TenantListDto> > GetTenants([FromQuery] GetTenantsInput input) { var query = TenantManager.Tenants .Include(t => t.Edition) .WhereIf(!input.TenancyName.IsNullOrEmpty(), t => t.TenancyName.Contains(input.TenancyName)) .WhereIf(!input.Name.IsNullOrEmpty(), t => t.Name.Contains(input.Name)) .WhereIf(input.IsActive.HasValue, t => t.IsActive == input.IsActive.Value) .WhereIf(input.CreationDateStart.HasValue, t => t.CreationTime >= input.CreationDateStart.Value) .WhereIf(input.CreationDateEnd.HasValue, t => t.CreationTime <= input.CreationDateEnd.Value) .WhereIf(input.SubscriptionEndDateStart.HasValue, t => t.SubscriptionEndDateUtc >= input.SubscriptionEndDateStart.Value.ToUniversalTime()) .WhereIf(input.SubscriptionEndDateEnd.HasValue, t => t.SubscriptionEndDateUtc <= input.SubscriptionEndDateEnd.Value.ToUniversalTime()) .WhereIf(input.EditionIdSpecified, t => t.EditionId == input.EditionId); var tenantCount = await query.CountAsync(); var tenants = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync(); return(new PagedResultDto <TenantListDto>( tenantCount, ObjectMapper.Map <List <TenantListDto> >(tenants) )); }
public async Task <PagedResultOutput <TenantListDto> > GetTenants(GetTenantsInput input) { var query = TenantManager.Tenants .Include(t => t.Edition) .WhereIf( !input.Filter.IsNullOrWhiteSpace(), t => t.Name.Contains(input.Filter) || t.TenancyName.Contains(input.Filter) ); var tenantCount = await query.CountAsync(); var sort = input.sort.Replace("editionDisplayName", "Edition.DisplayName"); var tenants = await query.OrderBy(string.Format("{0} {1}", sort, input.order)).PageBy(input).ToListAsync(); var tem = new PagedResultOutput <TenantListDto>( tenantCount, tenants.MapTo <List <TenantListDto> >() ); return(tem); }
public async Task <PagedResultDto <TenantListDto> > GetTenants(GetTenantsInput input) { return(await ApiClient.GetAsync <PagedResultDto <TenantListDto> >(GetEndpoint(nameof(GetTenants)), input)); }
public virtual Task <PagedResultDto <TenantDto> > GetListAsync(GetTenantsInput input) { return(TenantAppService.GetListAsync(input)); }
/// <summary> /// 过滤条件 /// </summary> /// <param name="input">查询条件</param> /// <returns></returns> private IQueryable <Tenant> GetTenantsFilteredQuery(GetTenantsInput input) { return(_tenantRepository.GetAll() .WhereIf(input.IsActive.HasValue, x => x.IsActive == input.IsActive) ); }
public async Task <PagedResult <TenantDto> > GetListAsync(GetTenantsInput input) { var result = await _tenantAppService.GetListAsync(input); return(new PagedResult <TenantDto>(result.TotalCount, result.Items)); }
public virtual Task <PagedResultDto <SaasTenantDto> > GetListAsync(GetTenantsInput input) { return(this.Service.GetListAsync(input)); }