public ValidateForRun(IRepositoryFactory repositoryFactory, IISRSettingsRepository isrSettingsRepository, IRSSettingsRepository rsSettingsRepository, IOutputFileRepository outputFileRepository, IUniverseRepository universeRepository, ISpotRepository spotRepository, IScheduleRepository scheduleRepository, IRatingsScheduleRepository ratingsScheduleRepository, IProductRepository productRepository, IClashRepository clashRepository, ISystemMessageRepository systemMessageRepository, IAutoBooks autoBooks, ITenantSettingsRepository tenantSettingsRepository, IClearanceRepository clearanceRepository, IFeatureManager featureManager, ISystemLogicalDateService systemLogicalDateService) { _repositoryFactory = repositoryFactory; _isrSettingsRepository = isrSettingsRepository; _rsSettingsRepository = rsSettingsRepository; _outputFileRepository = outputFileRepository; _universeRepository = universeRepository; _spotRepository = spotRepository; _scheduleRepository = scheduleRepository; _ratingsScheduleRepository = ratingsScheduleRepository; _productRepository = productRepository; _clashRepository = clashRepository; _systemMessageRepository = systemMessageRepository; _autoBooks = autoBooks; _tenantSettingsRepository = tenantSettingsRepository; _clearanceRepository = clearanceRepository; _featureManager = featureManager; _systemLogicalDateService = systemLogicalDateService; }
public CreateSponsorshipsModelValidation(ISponsorshipRepository sponsorshipRepository, ISalesAreaRepository salesAreaRepository, IProgrammeRepository programmeRepository, IProductRepository productRepository, IClashRepository clashRepository, IValidator <SponsoredDayPartModelBase> sponsoredDayPartModelValidation) { RuleFor(model => model).NotNull() .WithMessage("A valid createSponsorshipModels is required"); When(model => model != null, () => { RuleFor(model => model).Must(ContainValidCreateSponsorshipModelItems) .WithMessage("createSponsorshipModels is required and should contain a valid CreateSponsorshipModel for each item"); When(ContainsValidCreateSponsorshipModelItems, () => { RuleFor(model => model) .Must(ContainUniqueExternalReferenceIds) .WithMessage("createSponsorshipModels should contain unique ExternalReferenceId for each item") .DependentRules((model) => { model.RuleFor(createSponsorshipModels => createSponsorshipModels) .SetCollectionValidator( new CreateSponsorshipModelValidation(sponsorshipRepository, salesAreaRepository, programmeRepository, productRepository, clashRepository, sponsoredDayPartModelValidation)); }); }); }); }
public CampaignsController( ICampaignRepository campaignRepository, IRecommendationRepository recommendationRepository, IDataChangeValidator dataChangeValidator, IMapper mapper, IDemographicRepository demographicRepository, ISalesAreaRepository salesAreaRepository, IProductRepository productRepository, ICampaignExcelReportGenerator campaignsReportGenerator, IReportColumnFormatter reportColumnFormatter, IProgrammeRepository programmeRepository, IClashRepository clashRepository, IProgrammeCategoryHierarchyRepository programmeCategoryRepository, IFeatureManager featureManager, ICampaignFlattener campaignFlattener, ICampaignCleaner campaignCleaner, ICampaignPassPrioritiesService campaignPassPrioritiesService) { _campaignRepository = campaignRepository; _dataChangeValidator = dataChangeValidator; _recommendationRepository = recommendationRepository; _mapper = mapper; _demographicRepository = demographicRepository; _clashRepository = clashRepository; _salesAreaRepository = salesAreaRepository; _productRepository = productRepository; _campaignsReportGenerator = campaignsReportGenerator; _reportColumnFormatter = reportColumnFormatter; _programmeCategoryRepository = programmeCategoryRepository; _featureManager = featureManager; _campaignFlattener = campaignFlattener; _campaignCleaner = campaignCleaner; _programmeRepository = programmeRepository; _campaignPassPrioritiesService = campaignPassPrioritiesService; }
public UpdateSponsorshipModelValidation(ISponsorshipRepository sponsorshipRepository, ISalesAreaRepository salesAreaRepository, IProgrammeRepository programmeRepository, IProductRepository productRepository, IClashRepository clashRepository, IValidator <SponsoredDayPartModelBase> sponsoredDayPartModelValidation) { _sponsorshipRepository = sponsorshipRepository; RuleFor(model => model).NotNull() .WithMessage("A valid SponsorshipModel is required"); When(model => model != null, () => { RuleFor(model => model.ExternalReferenceId) .Must(ContainAnExistingExternalReferenceId) .When(model => !String.IsNullOrWhiteSpace(model.ExternalReferenceId)) .WithMessage(model => $"ExternalReferenceId: {model.ExternalReferenceId} doesn't exists, An existing ExternalReferenceId is required to update the Sponsorship"); RuleFor(model => model.SponsoredItems) .Must(ContainSponsoredItems) .WithMessage("SponsoredItems is required and should contain a valid SponsoredItem for each item"); When(ContainsSponsoredItems, () => { RuleFor(model => model.SponsoredItems) .SetCollectionValidator(model => new CreateSponsoredItemModelValidation(salesAreaRepository, programmeRepository, productRepository, clashRepository, sponsoredDayPartModelValidation, model)); }); }); }
public ScenarioResultsController(ISalesAreaRepository salesAreaRepository, IRunRepository runRepository, IFailuresRepository failuresRepository, IScenarioResultRepository scenarioResultRepository, IResultsFileRepository resultsFileRepository, IOutputFileRepository outputFileRepository, IRecommendationRepository recommendationRepository, ICampaignRepository campaignRepository, IProductRepository productRepository, IMapper mapper, IClashRepository clashRepository, IScenarioRepository scenarioRepository, IScenarioCampaignResultRepository scenarioCampaignResultRepository, IScenarioCampaignFailureRepository scenarioCampaignFailureRepository, IFunctionalAreaRepository functionalAreaRepository, ITenantSettingsRepository tenantSettingsRepository, IFactory storageClientFactory, AWSSettings awsSettings, IRecommendationAggregator recommendationAggregator, IScenarioCampaignResultReportCreator scenarioCampaignResultReportCreator, IKPICalculationScopeFactory kpiCalculationScopeFactory) { _salesAreaRepository = salesAreaRepository; _runRepository = runRepository; _scenarioResultRepository = scenarioResultRepository; _resultsFileRepository = resultsFileRepository; _outputFileRepository = outputFileRepository; _failuresRepository = failuresRepository; _recommendationRepository = recommendationRepository; _campaignRepository = campaignRepository; _productRepository = productRepository; _clashRepository = clashRepository; _scenarioRepository = scenarioRepository; _scenarioCampaignResultRepository = scenarioCampaignResultRepository; _mapper = mapper; _tenantSettingsRepository = tenantSettingsRepository; _scenarioCampaignFailureRepository = scenarioCampaignFailureRepository; _functionalAreaRepository = functionalAreaRepository; _storageClientFactory = storageClientFactory; _awsSettings = awsSettings; _recommendationAggregator = recommendationAggregator; _scenarioCampaignResultReportCreator = scenarioCampaignResultReportCreator; _kpiCalculationScopeFactory = kpiCalculationScopeFactory; }
public CompareController(IBreakRepository breakRepository, ISpotRepository spotRepository, IProgrammeRepository programmeRepository, ICampaignRepository campaignRepository, IProductRepository productRepository, IClashRepository clashRepository) { _breakrepo = breakRepository; _spotrepo = spotRepository; _programmerepo = programmeRepository; _campaignrepo = campaignRepository; _productRepository = productRepository; _clashRepository = clashRepository; }
public CampaignFlattener( IProductRepository productRepository, IDemographicRepository demographicRepository, IClashRepository clashRepository, IMapper mapper) : base(mapper) { _productRepository = productRepository; _demographicRepository = demographicRepository; _clashRepository = clashRepository; }
public LandmarkSpotModelCreator( ICampaignRepository campaignRepository, IClashRepository clashRepository, ISqlServerTenantDbContext dbContext, IMapper mapper) { _campaignRepository = campaignRepository; _clashRepository = clashRepository; _dbContext = dbContext; _mapper = mapper; }
public SpotModelCreator( ICampaignRepository campaignRepository, IProductRepository productRepository, IClashRepository clashRepository, IMapper mapper) { _campaignRepository = campaignRepository; _productRepository = productRepository; _clashRepository = clashRepository; _mapper = mapper; }
public ClashController( IClashRepository clashRepository, IDataChangeValidator dataChangeValidator, IMapper mapper, IClashValidator clashValidator ) { _clashRepository = clashRepository; _dataChangeValidator = dataChangeValidator; _mapper = mapper; _clashValidator = clashValidator; }
/// <summary>Initializes a new instance of the <see cref="CampaignSerializer" /> class.</summary> /// <param name="auditEventRepository">The audit event repository.</param> /// <param name="productRepository">The product repository.</param> /// <param name="clashRepository">The clash repository.</param> /// <param name="featureManager">The feature manager.</param> /// <param name="clock">The clock.</param> /// <param name="mapper">The mapper.</param> public CampaignSerializer( IAuditEventRepository auditEventRepository, IProductRepository productRepository, IClashRepository clashRepository, IFeatureManager featureManager, IClock clock, IMapper mapper) : base(auditEventRepository, featureManager, clock, mapper) { _productRepository = productRepository; _clashRepository = clashRepository; }
public BulkClashExceptionCreatedEventHandler(IMapper mapper, IClashExceptionRepository clashExceptionRepository, IClashExceptionValidations clashExceptionValidations, IClashRepository clashRepository, IProductRepository productRepository) { _clashRepository = clashRepository; _productRepository = productRepository; _mapper = mapper; _clashExceptionValidations = clashExceptionValidations; _clashExceptionRepository = clashExceptionRepository; }
public ClashExceptionController(IClashExceptionRepository clashExceptionRepository, IClashRepository clashRepository, IProductRepository productRepository, IMapper mapper, IClashExceptionValidations clashExceptionValidations, IProductAdvertiserValidator productAdvertiserValidator) { _clashExceptionRepository = clashExceptionRepository; _clashRepository = clashRepository; _productRepository = productRepository; _mapper = mapper; _clashExceptionValidations = clashExceptionValidations; _productAdvertiserValidator = productAdvertiserValidator; }
public static AnalysisGroupModel MapToAnalysisGroupModel(AnalysisGroup analysisGroup, ICampaignRepository campaignRepository, IClashRepository clashRepository, IProductRepository productRepository, IUsersRepository usersRepository, IMapper mapper) { var filterWithLabels = MapToAnalysisGroupFilterSearchModel(analysisGroup.Filter, campaignRepository, clashRepository, productRepository); var users = mapper.Map <List <UserReducedModel> >(usersRepository.GetByIds(new List <int> { analysisGroup.CreatedBy, analysisGroup.ModifiedBy })); return(mapper.Map <AnalysisGroupModel>((analysisGroup, filterWithLabels, users.ToDictionary(x => x.Id)))); }
public CreateSponsoredItemModelValidation(ISalesAreaRepository salesAreaRepository, IProgrammeRepository programmeRepository, IProductRepository productRepository, IClashRepository clashRepository, IValidator <SponsoredDayPartModelBase> sponsoredDayPartModelValidation, SponsorshipModelBase sponsorshipModelBase = null) : base(productRepository) { RuleFor(model => model).NotNull() .WithMessage("A valid SponsoredItem is required"); When(model => model != null, () => { RuleFor(model => model.SponsorshipItems) .Must(ContainSponsorshipItems) .WithMessage("SponsorshipItems is required and should contain a valid SponsorshipItem for each item"); When(ContainsSponsorshipItems, () => { RuleFor(model => model.SponsorshipItems) .SetCollectionValidator(model => new CreateSponsorshipItemModelValidation(salesAreaRepository, programmeRepository, sponsoredDayPartModelValidation, sponsorshipModelBase)); }); RuleFor(model => model).Must(ContainAdvertiserOrClashExclusivities) .WithName(model => nameof(model.AdvertiserExclusivities)) .WithMessage("SponsoredItem must contain AdvertiserExclusivities And/Or ClashExclusivities"); When(ContainsAdvertiserExclusivities, () => { RuleFor(model => model.AdvertiserExclusivities) .SetCollectionValidator(model => new CreateAdvertiserExclusivityModelValidation(productRepository, model)); }); When(ContainsClashExclusivities, () => { RuleFor(model => model.ClashExclusivities) .SetCollectionValidator(model => new CreateClashExclusivityModelValidation(clashRepository, model)); }); When(ContainsBothClashAndAdvertiserExclusivities, () => { RuleFor(model => model).Must(ContainSameRestrictionTypeForBothClashAndAdvertiserExclusivities) .WithName(model => nameof(model.AdvertiserExclusivities)) .WithMessage("RestrictionType must be same for both AdvertiserExclusivities And ClashExclusivities"); }); }); }
public ClashExclusivityModelBaseValidation(IClashRepository clashRepository, SponsoredItemModelBase sponsoredItemModelBase = null) : base(sponsoredItemModelBase) { _clashRepository = clashRepository; RuleFor(model => model).NotNull() .WithMessage("A valid ClashExclusivity is required"); When(model => model != null, () => { RuleFor(model => model.ClashExternalRef) .Must(ContainClashExternalRef) .WithMessage("ClashExternalRef is required"); }); }
public static Clash CheckClashByExternalRef(this IClashRepository repository, string externalRef) { if (repository is null) { throw new ArgumentNullException(nameof(repository)); } var clash = repository.FindByExternal(externalRef) .SingleOrDefault(); if (clash is null) { throw new DataSyncException(DataSyncErrorCode.ExternalReferenceNotFound, "Clash can't be found with specified external reference."); } return(clash); }
public AnalysisGroupsController(IAnalysisGroupRepository analysisGroupRepository, ICampaignRepository campaignRepository, IClashRepository clashRepository, IProductRepository productRepository, IUsersRepository usersRepository, IModelDataValidator <CreateAnalysisGroupModel> validator, IAnalysisGroupCampaignQuery groupCampaignQuery, IMapper mapper) { _analysisGroupRepository = analysisGroupRepository; _campaignRepository = campaignRepository; _clashRepository = clashRepository; _productRepository = productRepository; _usersRepository = usersRepository; _validator = validator; _groupCampaignQuery = groupCampaignQuery; _mapper = mapper; }
public static List <AnalysisGroupModel> MapToAnalysisGroupModels(List <AnalysisGroup> analysisGroups, ICampaignRepository campaignRepository, IClashRepository clashRepository, IProductRepository productRepository, IUsersRepository usersRepository, IMapper mapper) { var filterWithLabels = MapToAnalysisGroupFilterSearchModel(AnalysisGroupFilter.BuildFrom(analysisGroups), campaignRepository, clashRepository, productRepository); var userIds = new HashSet <int>(); foreach (var analysisGroup in analysisGroups) { userIds.Add(analysisGroup.CreatedBy); userIds.Add(analysisGroup.ModifiedBy); } var users = mapper.Map <List <UserReducedModel> >(usersRepository.GetByIds(userIds.ToList())); return(mapper.Map <List <AnalysisGroupModel> >((analysisGroups, filterWithLabels, users.ToDictionary(x => x.Id)))); }
/// <summary> /// Validate Clash codes /// </summary> /// <param name="clashCodes"></param> public static void ValidateClashCodes(this IClashRepository repository, List <string> clashCodes) { if (clashCodes == null || !clashCodes.Any()) { throw new Exception("Empty clash code"); } var ids = clashCodes.Distinct(StringComparer.CurrentCultureIgnoreCase).Trim().ToList(); var clashes = (repository ?? throw new ArgumentNullException(nameof(repository))).FindByExternal(clashCodes) ?.ToList(); var invalidClashCodes = ids.Except( clashes?.Select(p => p.Externalref)?.Distinct() ?? Enumerable.Empty <string>(), StringComparer.CurrentCultureIgnoreCase).ToList(); if (!invalidClashCodes.Any()) { return; } var msg = "Invalid clash code: " + string.Join(",", invalidClashCodes.ToList()); throw new InvalidDataException(msg); }
public CreateSponsorshipModelValidation(ISponsorshipRepository sponsorshipRepository, ISalesAreaRepository salesAreaRepository, IProgrammeRepository programmeRepository, IProductRepository productRepository, IClashRepository clashRepository, IValidator <SponsoredDayPartModelBase> sponsoredDayPartModelValidation) { _sponsorshipRepository = sponsorshipRepository; RuleFor(model => model).NotNull() .WithMessage("A valid SponsorshipModel is required"); When(model => model != null, () => { RuleFor(model => model.ExternalReferenceId) .Must(ContainUniqueExternalReferenceId) .When(model => !String.IsNullOrWhiteSpace(model.ExternalReferenceId)) .WithMessage(model => $"ExternalReferenceId: {model.ExternalReferenceId} already exists, A unique ExternalReferenceId is required"); //RuleFor(model => model.RestrictionLevel) // .Must(ContainValidRestrictionLevel) // .WithMessage(model => CreateInvalidRestrictionLevelErrorMessage(model.RestrictionLevel)); RuleFor(model => model.SponsoredItems) .Must(ContainSponsoredItems) .WithMessage("SponsoredItems is required and should contain a valid SponsoredItem for each item"); When(ContainsSponsoredItems, () => { RuleFor(model => model.SponsoredItems) .SetCollectionValidator(model => new CreateSponsoredItemModelValidation(salesAreaRepository, programmeRepository, productRepository, clashRepository, sponsoredDayPartModelValidation, model)); }); }); }
public ClashValidator(IClashRepository clashRepository, IProductRepository productRepository) { _clashRepository = clashRepository; _productRepository = productRepository; }
public BulkClashTruncatedEventHandler(IClashRepository clashRepository, ILoggerService logger) { _clashRepository = clashRepository; _logger = logger; }
public ClashResultChecker(ITestDataImporter dataImporter, IClashRepository clashRepository) : base(dataImporter) { _clashRepository = clashRepository; }
public CreateClashExclusivityModelValidation(IClashRepository clashRepository, SponsoredItemModelBase sponsoredItemModelBase = null) : base(clashRepository, sponsoredItemModelBase) { }
public ClashExceptionValidations(IClashRepository clashRepository) { _clashRepository = clashRepository; }
public BulkClashCreatedOrUpdatedEventHandler(IMapper mapper, IClashRepository clashRepository) { _mapper = mapper; _clashRepository = clashRepository; }
public static AnalysisGroupFilterSearchModel MapToAnalysisGroupFilterSearchModel(AnalysisGroupFilter filter, ICampaignRepository campaignRepository, IClashRepository clashRepository, IProductRepository productRepository) { if (filter is null) { throw new InvalidOperationException("AnalysisGroup filter can not be null"); } return(new AnalysisGroupFilterSearchModel { Advertisers = productRepository.GetAdvertisers(filter.AdvertiserExternalIds) .ToDictionary(x => x.AdvertiserIdentifier, x => x.AdvertiserName), Agencies = productRepository.GetAgencies(filter.AgencyExternalIds) .ToDictionary(x => x.AgencyIdentifier, x => x.AgencyName), AgencyGroups = productRepository.GetAgencyGroups(filter.AgencyGroupCodes) .ToDictionary(x => x.Code, x => x.ShortName), BusinessTypes = filter.BusinessTypes.Any() ? new HashSet <string>(campaignRepository.GetBusinessTypes()) : filter.BusinessTypes, Campaigns = campaignRepository.FindNameByRefs(filter.CampaignExternalIds) .ToDictionary(x => x.ExternalId, x => x.Name), ClashCodes = clashRepository.GetDescriptionByExternalRefs(filter.ClashExternalRefs) .ToDictionary(x => x.Externalref, x => x.Description), Products = productRepository.GetByExternalIds(filter.ProductExternalIds) .ToDictionary(x => x.Externalidentifier, x => x.Name), ReportingCategories = filter.ReportingCategories.Any() ? new HashSet <string>(productRepository.GetReportingCategories()) : filter.ReportingCategories, SalesExecs = productRepository.GetSalesExecutives(filter.SalesExecExternalIds) .ToDictionary(x => x.Identifier, x => x.Name) }); }
public static void CheckClashParents(this IClashRepository repository, IReadOnlyCollection <Clash> newClashes) { if (repository is null) { throw new ArgumentNullException(nameof(repository)); } var parentDoesNotExistMessages = new List <string>(); var exposureCountGreaterThanParentsMessages = new List <string>(); var existingClashes = repository.GetAll(); newClashes = newClashes.OrderBy(c => c.ParentExternalidentifier).ThenBy(c => c.Externalref).ToList(); newClashes.Where(c => c.Externalref.Equals(c.ParentExternalidentifier, StringComparison.OrdinalIgnoreCase)) .ToList().ForEach( c => parentDoesNotExistMessages.Add($"Clash code {c.Externalref} has invalid parent clash code {c.ParentExternalidentifier}")); var allClashes = newClashes.Union(existingClashes ?? Enumerable.Empty <Clash>()); newClashes.Where(c => !string.IsNullOrWhiteSpace(c.ParentExternalidentifier)).ToList().ForEach(c => { var parentClash = allClashes.FirstOrDefault(e => e.Externalref.Equals(c.ParentExternalidentifier, StringComparison.OrdinalIgnoreCase)); if (parentClash != null) { if (parentClash.DefaultPeakExposureCount < c.DefaultPeakExposureCount) { exposureCountGreaterThanParentsMessages.Add("Clash code " + c.Externalref + " default peak exposure count should be less than or equal to " + parentClash.DefaultPeakExposureCount); } if (parentClash.DefaultOffPeakExposureCount < c.DefaultOffPeakExposureCount) { exposureCountGreaterThanParentsMessages.Add("Clash code " + c.Externalref + " default non-peak exposure count should be less than or equal to " + parentClash.DefaultOffPeakExposureCount); } } else { parentDoesNotExistMessages.Add("Clash code " + c.Externalref + " has invalid parent clash code " + c.ParentExternalidentifier); } }); newClashes.Where(c => allClashes.Any(ch => ch.ParentExternalidentifier == c.Externalref)).ToList().ForEach(c => { var childClashes = allClashes.Where(ch => ch.ParentExternalidentifier == c.Externalref); foreach (var childClash in childClashes) { if (c.DefaultPeakExposureCount < childClash.DefaultPeakExposureCount) { exposureCountGreaterThanParentsMessages.Add("Clash code " + c.Externalref + " default peak exposure count should be higher than or equal to " + childClash.DefaultPeakExposureCount); } if (c.DefaultOffPeakExposureCount < childClash.DefaultOffPeakExposureCount) { exposureCountGreaterThanParentsMessages.Add("Clash code " + c.Externalref + " default non-peak exposure count should be higher than or equal to " + childClash.DefaultOffPeakExposureCount); } } }); if (parentDoesNotExistMessages.Any()) { throw new DataSyncException(DataSyncErrorCode.Clash_ParentDoesNotExist, string.Join(", ", parentDoesNotExistMessages)); } if (exposureCountGreaterThanParentsMessages.Any()) { throw new DataSyncException(DataSyncErrorCode.Clash_ExposureCountGreaterThenParents, string.Join(", ", exposureCountGreaterThanParentsMessages)); } }
public CreateAnalysisGroupModelValidation(IAnalysisGroupRepository analysisGroupRepository, ICampaignRepository campaignRepository, IClashRepository clashRepository, IProductRepository productRepository, IMapper mapper) { RuleFor(x => x.Name).NotEmpty().WithMessage("Analysis group name must not be empty"); RuleFor(x => x).Must(x => { var entity = analysisGroupRepository.GetByName(x.Name); return(entity is null || entity.Id == x.Id); }).WithMessage("Analysis group name must be unique"); RuleFor(x => x.Filter) .Custom((filter, context) => { if (filter is null) { context.AddFailure(nameof(AnalysisGroup.Filter), "Analysis group filter must not be null"); return; } if (!ValidateCriteriaPresence(filter)) { context.AddFailure(nameof(AnalysisGroup.Filter), "At least one analysis group filter criteria must be specified"); return; } var filterLabels = Mappings.MapToAnalysisGroupFilterSearchModel(mapper.Map <AnalysisGroupFilter>(filter), campaignRepository, clashRepository, productRepository); var invalidFilterValues = new Dictionary <string, List <string> > { { nameof(filter.AdvertiserExternalIds), filter.AdvertiserExternalIds?.Where(id => !filterLabels.Advertisers.ContainsKey(id)).ToList() }, { nameof(filter.AgencyExternalIds), filter.AgencyExternalIds?.Where(id => !filterLabels.Agencies.ContainsKey(id)).ToList() }, { nameof(filter.AgencyGroupCodes), filter.AgencyGroupCodes?.Where(id => !filterLabels.AgencyGroups.ContainsKey(id)).ToList() }, { nameof(filter.BusinessTypes), filter.BusinessTypes?.Where(id => !filterLabels.BusinessTypes.Contains(id)).ToList() }, { nameof(filter.CampaignExternalIds), filter.CampaignExternalIds?.Where(id => !filterLabels.Campaigns.ContainsKey(id)).ToList() }, { nameof(filter.ClashExternalRefs), filter.ClashExternalRefs?.Where(id => !filterLabels.ClashCodes.ContainsKey(id)).ToList() }, { nameof(filter.ProductExternalIds), filter.ProductExternalIds?.Where(id => !filterLabels.Products.ContainsKey(id)).ToList() }, { nameof(filter.ReportingCategories), filter.ReportingCategories?.Where(id => !filterLabels.ReportingCategories.Contains(id)).ToList() }, { nameof(filter.SalesExecExternalIds), filter.SalesExecExternalIds?.Where(id => !filterLabels.SalesExecs.ContainsKey(id)).Select(x => x.ToString()).ToList() } }; foreach (var invalidFilterValue in invalidFilterValues) { if (invalidFilterValue.Value?.Count > 0) { context.AddFailure(nameof(AnalysisGroup.Filter), $"Invalid {invalidFilterValue.Key}: {string.Join(",", invalidFilterValue.Value)}"); } } }); }