Exemplo n.º 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
     });
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 protected RemovedSpotFromBreakEventArgs(
     BreakExternalReference breakExternalReference,
     string advertiserIdentifier,
     string clashExternalReference,
     ProductExternalReference productExternalReference,
     bool isSponsor,
     SponsorshipApplicability applicability,
     SponsorshipCalculationType calculationType,
     (SponsorshipRestrictionType type, Duration duration) restrictionType
Exemplo n.º 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)
Exemplo n.º 5
0
 public SpotToSponsorshipRelationship(
     bool isSponsorSpot,
     SponsorshipApplicability applicability,
     SponsorshipCompetitorType competitorType,
     SponsorshipRestrictionType restrictionType,
     SponsorshipCalculationType calculationType)
 {
     IsSponsorSpot   = isSponsorSpot;
     Applicability   = applicability;
     CompetitorType  = competitorType;
     RestrictionType = restrictionType;
     CalculationType = calculationType;
 }
Exemplo n.º 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)
Exemplo n.º 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))
Exemplo n.º 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;
 }
Exemplo n.º 11
0
 private string CreateInvalidCalculationTypeErrorMessage(SponsorshipCalculationType calculationType)
 {
     return($"CalculationType: {calculationType} is invalid. Allowed values: {String.Join(",", Enum.GetNames(typeof(SponsorshipCalculationType)))}");
 }