예제 #1
0
 private static SponsoredItem CreateSponsoredItemApplicabiltiyEach(
     SponsorshipCalculationType calculationType,
     SponsorshipRestrictionType restrictionType,
     int advertiserRestrictionValue,
     int clashRestrictionValue)
 {
     return(new SponsoredItem()
     {
         Applicability = SponsorshipApplicability.EachCompetitor,
         AdvertiserExclusivities = new List <AdvertiserExclusivity>()
         {
             new AdvertiserExclusivity()
             {
                 AdvertiserIdentifier = "advertiser",
                 RestrictionType = restrictionType,
                 RestrictionValue = advertiserRestrictionValue
             }
         },
         ClashExclusivities = new List <ClashExclusivity>()
         {
             new ClashExclusivity()
             {
                 ClashExternalRef = "clash",
                 RestrictionType = restrictionType,
                 RestrictionValue = clashRestrictionValue
             }
         },
         Products = null,
         RestrictionType = null,
         RestrictionValue = null,
         CalculationType = calculationType,
         SponsorshipItems = null
     });
 }
예제 #2
0
        public static SmoothSponsorshipRestrictionLimits CalculateRestrictionLimits(
            SmoothSponsorshipRunningTotals input,
            SponsorshipCalculationType calculationType,
            SponsorshipApplicability applicability
            )
        {
            switch (calculationType)
            {
            case SponsorshipCalculationType.Flat:
                switch (applicability)
                {
                case SponsorshipApplicability.AllCompetitors:
                    return(CalculateRestrictionLimitsForAllCompetitorsWhenCalculationTypeIsFlat(input));

                case SponsorshipApplicability.EachCompetitor:
                    return(CalculateRestrictionLimitsForEachCompetitorWhenCalculationTypeIsFlat(input));
                }
                break;

            case SponsorshipCalculationType.Percentage:
                switch (applicability)
                {
                case SponsorshipApplicability.AllCompetitors:
                    return(CalculateRestrictionLimitsForAllCompetitorsWhenCalculationTypeIsPercentage(input));

                case SponsorshipApplicability.EachCompetitor:
                    return(CalculateRestrictionLimitsForEachCompetitorWhenCalculationTypeIsPercentage(input));
                }
                break;
            }
            return(null);
        }
예제 #3
0
 protected RemovedSpotFromBreakEventArgs(
     BreakExternalReference breakExternalReference,
     string advertiserIdentifier,
     string clashExternalReference,
     ProductExternalReference productExternalReference,
     bool isSponsor,
     SponsorshipApplicability applicability,
     SponsorshipCalculationType calculationType,
     (SponsorshipRestrictionType type, Duration duration) restrictionType
예제 #4
0
 /// <summary>
 /// Construct an event argument object for when a spot is added to a break.
 /// </summary>
 /// <param name="productExternalReference">   </param>
 /// <param name="isSponsor">                  </param>
 /// <param name="productAdvertiserIdentifier"></param>
 /// <param name="productClashCode">           </param>
 /// <param name="competitorType">             </param>
 /// <param name="sponsorshipApplicability">
 /// Will be <see langword="null"/> if the spot is for a sponsor.
 /// </param>
 /// <param name="restrictionType">            </param>
 protected AddedSpotToBreakEventArgs(
     BreakExternalReference breakExternalReference,
     ProductExternalReference productExternalReference,
     bool isSponsor,
     string productAdvertiserIdentifier,
     string productClashCode,
     SponsorshipCompetitorType competitorType,
     SponsorshipApplicability sponsorshipApplicability,
     SponsorshipCalculationType calculationType,
     (SponsorshipRestrictionType type, Duration duration) restrictionType)
예제 #5
0
 public SpotToSponsorshipRelationship(
     bool isSponsorSpot,
     SponsorshipApplicability applicability,
     SponsorshipCompetitorType competitorType,
     SponsorshipRestrictionType restrictionType,
     SponsorshipCalculationType calculationType)
 {
     IsSponsorSpot   = isSponsorSpot;
     Applicability   = applicability;
     CompetitorType  = competitorType;
     RestrictionType = restrictionType;
     CalculationType = calculationType;
 }
예제 #6
0
 public RemovedSponsoredSpotCountFromBreakEventArgs(
     BreakExternalReference breakExternalReference,
     ProductExternalReference productExternalReference,
     SponsorshipApplicability applicability,
     SponsorshipCalculationType calculationType)
     : base(
         breakExternalReference,
         advertiserIdentifier: string.Empty,
         clashExternalReference: string.Empty,
         productExternalReference,
         true,
         applicability,
         calculationType,
         (SponsorshipRestrictionType.SpotCount, Duration.Zero)
 public AddedSponsoredSpotCountToBreakEventArgs(
     BreakExternalReference breakExternalReference,
     ProductExternalReference productExternalReference,
     SponsorshipApplicability applicability,
     SponsorshipCalculationType calculationType)
     : base(
         breakExternalReference,
         productExternalReference,
         isSponsor: true,
         productAdvertiserIdentifier: string.Empty,
         productClashCode: string.Empty,
         competitorType: SponsorshipCompetitorType.Neither,
         applicability,
         calculationType,
         (SponsorshipRestrictionType.SpotCount, Duration.Zero)
 public RemovedCompetitorSpotCountFromBreakEventArgs(
     BreakExternalReference breakExternalReference,
     string advertiserIdentifier,
     string clashExternalReference,
     ProductExternalReference productExternalReference,
     SponsorshipApplicability applicability,
     SponsorshipCalculationType calculationType)
     : base(
         breakExternalReference,
         advertiserIdentifier,
         clashExternalReference,
         productExternalReference,
         false,
         applicability,
         calculationType,
         (SponsorshipRestrictionType.SpotCount, Duration.Zero)
예제 #9
0
 public AddedCompetitorSpotCountToBreakEventArgs(
     BreakExternalReference breakExternalReference,
     ProductExternalReference productExternalReference,
     string productAdvertiserIdentifier,
     string productClashCode,
     SponsorshipCompetitorType competitorType,
     SponsorshipApplicability sponsorshipApplicability,
     SponsorshipCalculationType calculationType)
     : base(
         breakExternalReference,
         productExternalReference,
         isSponsor: false,
         productAdvertiserIdentifier,
         productClashCode,
         competitorType,
         sponsorshipApplicability,
         calculationType,
         (SponsorshipRestrictionType.SpotCount, Duration.Zero))
예제 #10
0
 public void Deconstruct(out bool isSponsorSpot, out SponsorshipApplicability applicability, out SponsorshipCompetitorType competitorType, out SponsorshipRestrictionType restrictionType, out SponsorshipCalculationType calculationType)
 {
     isSponsorSpot   = IsSponsorSpot;
     applicability   = Applicability;
     competitorType  = CompetitorType;
     restrictionType = RestrictionType;
     calculationType = CalculationType;
 }
예제 #11
0
 private string CreateInvalidCalculationTypeErrorMessage(SponsorshipCalculationType calculationType)
 {
     return($"CalculationType: {calculationType} is invalid. Allowed values: {String.Join(",", Enum.GetNames(typeof(SponsorshipCalculationType)))}");
 }