Beispiel #1
0
        public IEnumerable <PhaseProjectsModel> Resolve(Team source, ProjectSummaryModel destination, IEnumerable <PhaseProjectsModel> destMember, ResolutionContext context)
        {
            var portfolioConfiguration = context.Items[nameof(PortfolioConfiguration)] as PortfolioConfiguration;
            var summaryType            = context.Items[PortfolioSummaryResolver.SummaryTypeKey] as string;
            IEnumerable <PhaseProjectsModel> result;

            switch (summaryType)
            {
            case PortfolioSummaryModel.NewProjectsByTeam:
                var newCutoff = DateTime.Now.AddDays(-PortfolioSettings.NewProjectLimitDays);
                result = SummaryLinqQuery.GetQuery(portfolioConfiguration, p =>
                                                   (
                                                       (p.Lead?.Team != null && p.Lead.Team.ViewKey == source.ViewKey) ||
                                                       (p.Lead?.Team == null && source.Id == 0)) && // No team set
                                                   p.FirstUpdate.Timestamp > newCutoff, context);
                break;

            case PortfolioSummaryModel.ByTeam:
            default:
                result = SummaryLinqQuery.GetQuery(portfolioConfiguration, p =>
                                                   (p.Lead?.Team != null && p.Lead.Team.ViewKey == source.ViewKey) ||
                                                   (p.Lead?.Team == null && source.Id == 0) // No team set
                                                   , context);
                break;
            }

            return(result);
        }
Beispiel #2
0
        public IEnumerable <PhaseProjectsModel> Resolve(ProjectUserCategory source, ProjectSummaryModel destination, IEnumerable <PhaseProjectsModel> destMember, ResolutionContext context)
        {
            var config = context.Items[nameof(PortfolioConfiguration)] as PortfolioConfiguration;
            var user   = context.Items[PortfolioPersonResolver.PersonKey] as string;

            return(SummaryLinqQuery.GetQuery(config, p => p.GetUserCategory(user) == source.CategoryType, context));
        }
Beispiel #3
0
        public IEnumerable <PhaseProjectsModel> Resolve(Person source, ProjectSummaryModel destination, IEnumerable <PhaseProjectsModel> destMember, ResolutionContext context)
        {
            var config = context.Items[nameof(PortfolioConfiguration)] as PortfolioConfiguration;

            return(SummaryLinqQuery.GetQuery(config, p => source.Id == 0 ? !p.Lead_Id.HasValue : p.Lead_Id == source.Id, context));
        }
Beispiel #4
0
 public IEnumerable <PhaseProjectsModel> Resolve(ProjectPhase source, ProjectSummaryModel destination, IEnumerable <PhaseProjectsModel> destMember, ResolutionContext context)
 {
     return(SummaryLinqQuery.GetQuery(source.Configuration, p => p.LatestUpdate.Phase.Id == source.Id, context));
 }
Beispiel #5
0
 public IEnumerable <PhaseProjectsModel> Resolve(PriorityGroup source, ProjectSummaryModel destination, IEnumerable <PhaseProjectsModel> destMember, ResolutionContext context)
 {
     return(SummaryLinqQuery.GetQuery(source.Configuration, p => p.PriorityGroup.ViewKey == source.ViewKey, context));
 }