示例#1
0
        public SmoothDateRange(
            Guid runId,
            Guid firstScenarioId,
            DateTime processorDateTime,
            SalesArea salesArea,
            ISmoothConfiguration smoothConfiguration,
            ISmoothDiagnostics smoothDiagnostics,
            ImmutableSmoothData threadSafeCollections,
            IClashExposureCountService clashExposureCountService,
            SaveSmoothChanges saveSmoothChanges,
            IRepositoryFactory repositoryFactory,
            Action <string> raiseInfo,
            Action <string> raiseWarning,
            Action <string, Exception> raiseException)
        {
            RaiseInfo                  = raiseInfo;
            RaiseWarning               = raiseWarning;
            RaiseException             = raiseException;
            _threadSafeCollections     = threadSafeCollections;
            _clashExposureCountService = clashExposureCountService;
            _saveSmoothChanges         = saveSmoothChanges;
            _repositoryFactory         = repositoryFactory;
            _runId                        = runId;
            _firstScenarioId              = firstScenarioId;
            _processorDateTime            = processorDateTime;
            _salesArea                    = salesArea;
            _smoothConfiguration          = smoothConfiguration;
            _smoothDiagnostics            = smoothDiagnostics;
            _smoothFailuresFactory        = new SmoothFailuresFactory(_smoothConfiguration);
            _smoothRecommendationsFactory = new SmoothRecommendationsFactory(_smoothConfiguration);

            _smoothPasses = _smoothConfiguration.SortedSmoothPasses;
        }
示例#2
0
 public SmoothScenarioExecutor(
     ISmoothDiagnostics smoothDiagnostics,
     IReadOnlyDictionary <Guid, SpotInfo> spotInfos,
     SponsorshipRestrictionService sponsorshipRestrictionService)
 {
     _smoothDiagnostics             = smoothDiagnostics;
     _spotInfos                     = spotInfos;
     _sponsorshipRestrictionService = sponsorshipRestrictionService;
 }
示例#3
0
        public BestBreakEvaluator(
            ISmoothDiagnostics smoothDiagnostics,
            SmoothResources smoothResources,
            IClashExposureCountService clashExposureCountService)
        {
            _smoothDiagnostics = smoothDiagnostics;
            _smoothResources   = smoothResources;

            _bestBreakFactorService         = new BestBreakFactorService(clashExposureCountService);
            _bestBreakFactorForGroupService = new BestBreakFactorForGroupService(_bestBreakFactorService);
        }
示例#4
0
        public SmoothPassBookedExecuter(
            ISmoothDiagnostics smoothDiagnostics,
            SmoothResources smoothResources,
            SmoothProgramme smoothProgramme,
            SponsorshipRestrictionService sponsorshipRestrictionService,
            IReadOnlyCollection <Programme> allProgrammesForPeriodAndSalesArea,
            Action <string> raiseInfo,
            Action <string, Exception> raiseException
            )
        {
            _smoothDiagnostics                  = smoothDiagnostics;
            _smoothResources                    = smoothResources;
            _sponsorshipRestrictionService      = sponsorshipRestrictionService;
            _allProgrammesForPeriodAndSalesArea = allProgrammesForPeriodAndSalesArea;
            _smoothProgramme                    = smoothProgramme;

            RaiseInfo      = raiseInfo;
            RaiseException = raiseException;
        }
 public SmoothPassUnplacedExecuter(
     ISmoothDiagnostics smoothDiagnostics,
     SmoothResources smoothResources,
     SmoothProgramme smoothProgramme,
     SponsorshipRestrictionService sponsorshipRestrictionService,
     IReadOnlyCollection <Programme> allProgrammesForPeriodAndSalesArea,
     ISmoothConfiguration smoothConfiguration,
     IClashExposureCountService clashExposureCountService,
     IImmutableDictionary <string, Clash> clashesByExternalRef,
     Action <string, Exception> raiseException
     )
 {
     _smoothDiagnostics                  = smoothDiagnostics;
     _smoothConfiguration                = smoothConfiguration;
     _smoothResources                    = smoothResources;
     _smoothProgramme                    = smoothProgramme;
     _clashExposureCountService          = clashExposureCountService;
     _sponsorshipRestrictionService      = sponsorshipRestrictionService;
     _allProgrammesForPeriodAndSalesArea = allProgrammesForPeriodAndSalesArea;
     _clashesByExternalRef               = clashesByExternalRef;
     RaiseException = raiseException;
 }
示例#6
0
        /// <summary>
        /// Create a new instance of this class for each programme to smooth.
        /// </summary>
        public SmoothOneProgramme(
            Programme programme,
            IEnumerable <Break> programmeBreaks,
            IReadOnlyCollection <Spot> programmeSpots,
            IReadOnlyDictionary <Guid, SpotInfo> spotInfos,
            Guid runId,
            SalesArea salesArea,
            DateTime processorDateTime,
            ISmoothDiagnostics smoothDiagnostics,
            IImmutableList <RatingsPredictionSchedule> ratingsPredictionSchedules,
            ImmutableSmoothData threadSafeCollections,
            IClashExposureCountService clashExposureCountService,
            SponsorshipRestrictionService sponsorshipRestrictionService,
            IReadOnlyCollection <Product> products,
            IReadOnlyCollection <Clash> clashes,
            IReadOnlyCollection <Programme> allProgrammesForPeriodAndSalesArea,
            Action <string> raiseInfo,
            Action <string, Exception> raiseException)
        {
            RaiseInfo      = raiseInfo;
            RaiseException = raiseException;

            if (programme is null)
            {
                var guruMeditation = new ArgumentNullException(nameof(programme));
                RaiseException("The programme to Smooth is null", guruMeditation);

                throw guruMeditation;
            }

            _smoothProgramme = new SmoothProgramme(salesArea, programme);
            _smoothProgramme.InitialiseSmoothBreaks(programmeBreaks);

            _processorDateTime             = processorDateTime;
            _programmeSpots                = programmeSpots;
            _spotInfos                     = spotInfos;
            _runId                         = runId;
            _threadSafeCollections         = threadSafeCollections;
            _sponsorshipRestrictionService = sponsorshipRestrictionService;
            _smoothConfiguration           = threadSafeCollections.SmoothConfigurationReader;
            _smoothDiagnostics             = smoothDiagnostics;

            _smoothPassBookedExecuter = new SmoothPassBookedExecuter(
                _smoothDiagnostics,
                _smoothResources,
                _smoothProgramme,
                sponsorshipRestrictionService,
                allProgrammesForPeriodAndSalesArea,
                RaiseInfo,
                RaiseException);

            _smoothPassDefaultExecuter = new SmoothPassDefaultExecuter(
                _smoothDiagnostics,
                _smoothResources,
                _smoothProgramme,
                sponsorshipRestrictionService,
                allProgrammesForPeriodAndSalesArea,
                _smoothConfiguration,
                clashExposureCountService,
                _threadSafeCollections.ClashesByExternalRef,
                _threadSafeCollections.ProductsByExternalRef,
                RaiseException);

            _smoothPassUnplacedExecuter = new SmoothPassUnplacedExecuter(
                _smoothDiagnostics,
                _smoothResources,
                _smoothProgramme,
                sponsorshipRestrictionService,
                allProgrammesForPeriodAndSalesArea,
                _smoothConfiguration,
                clashExposureCountService,
                _threadSafeCollections.ClashesByExternalRef,
                RaiseException);

            if (_smoothConfiguration.ClashExceptionCheckEnabled)
            {
                _smoothResources.ClashExceptionChecker = new ClashExceptionChecker(
                    threadSafeCollections.ClashExceptions,
                    products,
                    clashes
                    );
            }

            if (_smoothConfiguration.RestrictionCheckEnabled)
            {
                _smoothResources.RestrictionChecker = new RestrictionChecker(
                    threadSafeCollections.Restrictions,
                    products,
                    clashes,
                    threadSafeCollections.IndexTypes,
                    threadSafeCollections.Universes,
                    ratingsPredictionSchedules);
            }

            _smoothFailuresFactory        = new SmoothFailuresFactory(_smoothConfiguration);
            _smoothRecommendationsFactory = new SmoothRecommendationsFactory(_smoothConfiguration);
        }