コード例 #1
0
        /// <summary>
        /// Resolves the preconditions: product and totals.
        /// </summary>
        /// <param name="order">The order.</param>
        /// <param name="productCode">The product code.</param>
        protected internal virtual void ResolvePreConditions([NotNull] Order order, [NotNull] string productCode)
        {
            Assert.ArgumentNotNull(order, "order");
            Assert.ArgumentNotNull(productCode, "productCode");

            this.needResolvePreConditions = false;

            this.product = this.ProductRepository.Get <Product>(productCode);
            Assert.IsNotNull(this.product, "Product cannot be resolved");
            this.currency = this.CurrencyProvider.Get(order.PricingCurrencyCode);
            Assert.IsNotNull(this.currency, "Currency cannot be resolved");
            this.totals = this.ProductPriceManager.GetProductTotals <DomainModel.Prices.Totals, Product, Currency>(this.product, this.currency);
            Assert.IsNotNull(this.totals, "Totals cannot be resolved");

            VatRegion vatRegion = this.GetVatRegion(order);

            this.vat = vatRegion != null ? ((ProductPriceManager)this.ProductPriceManager).GetVat(this.product, vatRegion) : this.totals.VAT;
        }
コード例 #2
0
    /// <summary>
    /// Resolves the preconditions: product and totals.
    /// </summary>
    /// <param name="order">The order.</param>
    /// <param name="productCode">The product code.</param>
    protected internal virtual void ResolvePreConditions([NotNull] Order order, [NotNull] string productCode)
    {
      Assert.ArgumentNotNull(order, "order");
      Assert.ArgumentNotNull(productCode, "productCode");

      this.needResolvePreConditions = false;

      this.product = this.ProductRepository.Get<Product>(productCode);
      Assert.IsNotNull(this.product, "Product cannot be resolved");
      this.currency = this.CurrencyProvider.Get(order.PricingCurrencyCode);
      Assert.IsNotNull(this.currency, "Currency cannot be resolved");
      this.totals = this.ProductPriceManager.GetProductTotals<DomainModel.Prices.Totals, Product, Currency>(this.product, this.currency);
      Assert.IsNotNull(this.totals, "Totals cannot be resolved");

      VatRegion vatRegion = this.GetVatRegion(order);
      this.vat = vatRegion != null ? ((ProductPriceManager)this.ProductPriceManager).GetVat(this.product, vatRegion) : this.totals.VAT;
    }