コード例 #1
0
        /// <summary>
        /// Get correct price for currency and calculate with or without taxes applied.
        /// </summary>
        private decimal GetPrice(IList<ProductPrice> prices, IList<ProductTax> taxes)
        {
            var price = prices.FirstOrDefault(p => p.CurrencyCode == this.currencyCode);
            if (price == null)
            {
                throw new ArgumentException(String.Format("No prices available for currency code {0}", this.currencyCode));
            }

            var priceCalculator = new PriceCalculator(this.pricesIncludeVat, this.inclusiveTaxCalculationType);
            return priceCalculator.CalculatePrice(price.Value, taxes);
        }