예제 #1
0
        public void PriceTest03()
        {
            decimal?      price   = null;
            const decimal vatRate = 1.25M;

            var result = PriceCalulator.Price(price, vatRate);

            Assert.AreEqual(0, result);
        }
예제 #2
0
 // TODO : Duplicate code
 protected static PriceModel MapPrice(Product product)
 {
     return(new PriceModel
     {
         Display = PriceCalulator.Price(product.Price, product.VatRate),
         Catalog = PriceCalulator.Price(product.PriceCatalog ?? product.Price, product.VatRate),
         Recommended = PriceCalulator.Price(product.PriceRecommended ?? product.Price, product.VatRate),
         VatRate = product.VatRate,
         PricelistId = product.PriceListId,
         IsFromPrice = false
     });
 }
 protected override PriceModel ResolveCore(BasketItem basketItem)
 {
     return(new PriceModel
     {
         Display = PriceCalulator.Price(basketItem.Price, basketItem.VatRate),
         Catalog = PriceCalulator.Price(basketItem.PriceCatalog ?? basketItem.Price, basketItem.VatRate),
         Recommended = PriceCalulator.Price(basketItem.PriceRecommended ?? basketItem.Price, basketItem.VatRate),
         VatRate = basketItem.VatRate,
         PricelistId = basketItem.PriceListId,
         IsFromPrice = false
     });
 }
예제 #4
0
 public PriceModel Resolve(BasketItem source, BasketItemModel destination, PriceModel destMember, ResolutionContext context)
 {
     return(new PriceModel
     {
         Display = PriceCalulator.Price(source.PriceDisplay, source.VatRate),
         Catalog = PriceCalulator.Price(source.PriceCatalog ?? source.PriceOriginal, source.VatRate),
         Recommended = PriceCalulator.Price(source.PriceRecommended ?? source.PriceOriginal, source.VatRate),
         Original = PriceCalulator.Price(source.PriceOriginal, source.VatRate),
         VatRate = source.VatRate,
         PricelistId = source.PriceListId,
         IsFromPrice = false
     });
 }
예제 #5
0
 public PriceModel Resolve(ProductItem source, TDest destination, PriceModel destMember, ResolutionContext context)
 {
     return(new PriceModel
     {
         Display = PriceCalulator.Price(source.Price, source.VatRate),
         Catalog = PriceCalulator.Price(source.PriceCatalog ?? source.Price, source.VatRate),
         Recommended = PriceCalulator.Price(source.PriceRecommended ?? source.Price, source.VatRate),
         Original = PriceCalulator.Price(source.Price, source.VatRate),
         VatRate = source.VatRate,
         PricelistId = source.PriceListId.GetValueOrDefault(0),
         IsFromPrice = false
     });
 }
예제 #6
0
        protected static PriceModel MapPrice(ProductPrice price)
        {
            if (price == null)
            {
                return(new PriceModel());
            }

            return(new PriceModel
            {
                Display = PriceCalulator.Price(price.Value, price.VatRate),
                Catalog = PriceCalulator.Price(price.Catalog ?? price.Value, price.VatRate),
                Recommended = PriceCalulator.Price(price.Recommended ?? price.Value, price.VatRate),
                VatRate = price.VatRate,
                PricelistId = price.PriceListId,
                IsFromPrice = false
            });
        }
예제 #7
0
        protected static PriceModel MapPrice(ProductItem product)
        {
            if (product == null)
            {
                return(new PriceModel());
            }

            return(new PriceModel
            {
                Display = PriceCalulator.Price(product.Price, product.VatRate),
                Catalog = PriceCalulator.Price(product.PriceCatalog ?? product.Price, product.VatRate),
                Recommended = PriceCalulator.Price(product.PriceRecommended ?? product.Price, product.VatRate),
                VatRate = product.VatRate,
                PricelistId = product.PriceListId.GetValueOrDefault(0),
                IsFromPrice = false
            });
        }
예제 #8
0
        public PriceModel Resolve(VariantItem source, VariantModel destination, PriceModel destMember, ResolutionContext context)
        {
            if (source.Price == null)
            {
                return(new PriceModel());
            }

            var price = source.Price;

            return(new PriceModel
            {
                Display = PriceCalulator.Price(price.Value, price.VatRate),
                Catalog = PriceCalulator.Price(price.Catalog ?? price.Value, price.VatRate),
                Recommended = PriceCalulator.Price(price.Recommended ?? price.Value, price.VatRate),
                Original = PriceCalulator.Price(price.Value, price.VatRate),
                VatRate = price.VatRate,
                PricelistId = price.PriceListId,
                IsFromPrice = false
            });
        }