示例#1
0
        private decimal FullCostOfBand(PriceBand band)
        {
            var totalMessagesInBand = band.QtyTo.Value - (band.QtyFrom - 1);

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

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