Beispiel #1
0
 public Task <PackedList <T> > GetProjects <T>(IOrganizationContractor co, ProjectFilters filters) where T : ContractorProjectOutput, new()
 {
     return(Repository.Queryable()
            .ForOrganizationContractor(co)
            .ApplyWhereFilters(filters)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Project, T>(filters, ProjectionMapping));
 }
Beispiel #2
0
 public Task <PackedList <T> > GetProjects <T>(IProviderAgencyOwner ao, ProjectFilters filters)
     where T : AgencyOwnerProjectOutput, new()
 {
     return(Repository.Queryable()
            .ForAgencyOwner(ao)
            .ApplyWhereFilters(filters)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Project, T>(filters, ProjectionMapping));
 }
Beispiel #3
0
 public Task <PackedList <T> > GetProjects <T>(IOrganizationCustomer cu, ProjectFilters filters)
     where T : CustomerProjectOutput, new()
 {
     return(Repository.Queryable()
            .ForOrganizationCustomer(cu)
            .Where(x => x.Proposal != null && x.Proposal.Status == ProposalStatus.Accepted)
            .ApplyWhereFilters(filters)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Project, T>(filters, ProjectionMapping));
 }
        public async Task <IActionResult> GetProjectsForAgencyOwner(
            [FromRoute] Guid organizationId,
            [FromQuery] ProjectFilters filters
            )
        {
            var projects = await _projectService
                           .GetProjects <AgencyOwnerProjectOutput>(_agencyOwner, filters);

            AddPagination(filters, projects.Total);
            return(Ok(projects.Data));
        }
Beispiel #5
0
        public Config WithPathsRelativeTo(string baseDirectory)
        {
            return(new Config
            {
                SolutionFilePath = SolutionFilePath != null
                    ? Path.Combine(baseDirectory, SolutionFilePath)
                    : null,

                TestAssemblyFilePaths = TestAssemblyFilePaths?
                                        .Select(x => x != null ? Path.Combine(baseDirectory, x) : null)
                                        .ToArray(),

                ProjectFilters = ProjectFilters?.ToArray(),
                SourceFileFilters = SourceFileFilters?.ToArray()
            });
        }
Beispiel #6
0
        public async Task <PagedResult <ProjectUpdateDto> > SearchProjectsAsync(ProjectFilters filters)
        {
            if (filters == null)
            {
                return(new PagedResult <ProjectUpdateDto>(0, 0));
            }

            var query = _context.Projects.AsQueryable();

            if (filters.keywords.IsNotBlank())
            {
                query = query.Where(item => item.FromCustomQQ.Contains(filters.keywords) || item.FromCustomServiceQQ.Contains(filters.keywords) || item.FromQQGroup.Contains(filters.keywords) || item.ProjectTitle.Contains(filters.keywords));
            }
            if (filters.CreateUserId.IsNotBlank())
            {
                query = query.Where(item => item.CreateUserId == filters.CreateUserId);
            }
            if (filters.ChargePersonId.IsNotBlank())
            {
                query = query.Where(item => item.ChargePersonId == filters.ChargePersonId);
            }
            var users = _context.Users.AsQueryable();

            return(await query.OrderByDescending(item => item.CreateDateTime)
                   .Select(item => new ProjectUpdateDto
            {
                Id = item.Id,
                FromCustomQQ = item.FromCustomQQ,
                FromCustomServiceQQ = item.FromCustomServiceQQ,
                FromQQGroup = item.FromQQGroup,
                ProjectStartTime = item.ProjectStartTime,

                ProjectEndTime = item.ProjectEndTime,
                ProjectQQGroup = item.ProjectQQGroup,
                ProjectTitle = item.ProjectTitle,
                Remarks = item.Remarks,
                SettleInterval = item.SettleInterval,
                SettleTime = item.SettleTime,
                ChargePersonId = item.ChargePersonId,
                ChargePersonName = users.FirstOrDefault(c => c.Id == item.ChargePersonId).RealName ?? string.Empty,
                ProjectAgreementWorth = item.ProjectAgreementWorth,
                ProjectWorth = item.ProjectWorth,
                ProjectType = item.ProjectType
            }).PagingAsync(filters.page, filters.rows));
        }
        /// <summary>
        /// 登录日志
        /// </summary>
        /// <param name="filters"></param>
        /// <returns></returns>
        public async Task <IActionResult> ProjectList(ProjectFilters filters)
        {
            #region 客服权限控制,客服只能看到自己发出的
            //var fromCustomServiceQq = string.Empty;
            //if (User.Identity.HaveServiceRight())
            //{
            //    fromCustomServiceQq = User.Identity.GetLoginUserQQ();
            //}
            //filters.FromCustomServiceQQ = fromCustomServiceQq;
            #endregion

            if (User.Identity.HaveServiceRight())
            {
                filters.CreateUserId = User.Identity.GetLoginUserId();
            }
            if (User.Identity.HaveDeveloperRight())
            {
                filters.ChargePersonId = User.Identity.GetLoginUserId();
            }

            var result = await _ProjectService.SearchProjectsAsync(filters);

            return(Json(result));
        }
        public static Expression <Func <Project, bool> > WhereFilter(ProjectFilters filters)
        {
            var expr = PredicateBuilder.True <Project>();

            if (filters.CustomerId.HasValue)
            {
                expr = expr.And(x => x.CustomerId == filters.CustomerId);
            }

            if (filters.CustomerOrganizationId.HasValue)
            {
                expr = expr.And(x => x.CustomerOrganizationId == filters.CustomerOrganizationId);
            }

            if (filters.ProjectManagerId.HasValue)
            {
                expr = expr.And(x => x.ProjectManagerId == filters.ProjectManagerId);
            }

            if (filters.ProjectManagerOrganizationId.HasValue)
            {
                expr = expr.And(x => x.ProjectManagerOrganizationId == filters.ProjectManagerOrganizationId);
            }

            if (filters.AccountManagerId.HasValue)
            {
                expr = expr.And(x => x.AccountManagerId == filters.AccountManagerId);
            }

            if (filters.AccountManagerOrganizationId.HasValue)
            {
                expr = expr.And(x => x.AccountManagerOrganizationId == filters.AccountManagerOrganizationId);
            }

            return(expr);
        }
 public static IQueryable <Project> ApplyWhereFilters(this IQueryable <Project> entities,
                                                      ProjectFilters filters)
 {
     return(entities.Where(WhereFilter(filters)));
 }