Ejemplo n.º 1
0
        private decimal FullCostOfBand(PriceBand band)
        {
            var totalMessagesInBand = band.QtyTo.Value - (band.QtyFrom - 1);

            return(totalMessagesInBand * band.PricePerTextMessage);
        }
Ejemplo n.º 2
0
        private decimal PartialCostOfBand(PriceBand band, int totalMonthlyMessages)
        {
            var totalMessagesSentInBand = totalMonthlyMessages - (band.QtyFrom - 1);

            return(totalMessagesSentInBand * band.PricePerTextMessage);
        }
Ejemplo n.º 3
0
 private decimal CalculateCostOfBand(PriceBand band, int totalMonthlyMessages)
 {
     return(band.QtyTo.HasValue && totalMonthlyMessages > band.QtyTo
             ? FullCostOfBand(band)
             : PartialCostOfBand(band, totalMonthlyMessages));
 }