Beispiel #1
0
        public virtual TierPrice ToTierPrice(pricingDto.Price priceDto, Currency currency)
        {
            var listPrice = new Money(priceDto.List ?? 0, currency);

            return(new TierPrice(currency)
            {
                Quantity = priceDto.MinQuantity ?? 1,
                Price = priceDto.Sale.HasValue ? new Money(priceDto.Sale.Value, currency) : listPrice
            });
        }
Beispiel #2
0
        public virtual ProductPrice ToProductPrice(pricingDto.Price priceDto, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(priceDto.Currency)) ?? new Currency(language, priceDto.Currency);
            var result   = ServiceLocator.Current.GetInstance <PricingFactory>().CreateProductPrice(currency);

            result.InjectFrom <NullableAndEnumValueInjecter>(priceDto);
            result.Currency    = currency;
            result.ListPrice   = new Money(priceDto.List ?? 0d, currency);
            result.SalePrice   = priceDto.Sale == null ? result.ListPrice : new Money(priceDto.Sale ?? 0d, currency);
            result.MinQuantity = priceDto.MinQuantity;
            return(result);
        }
Beispiel #3
0
        public virtual ProductPrice ToProductPrice(pricingDto.Price priceDto, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(priceDto.Currency)) ?? new Currency(language, priceDto.Currency);
            var result   = new ProductPrice(currency);

            result.ProductId   = priceDto.ProductId;
            result.PricelistId = priceDto.PricelistId;

            result.Currency    = currency;
            result.ListPrice   = new Money(priceDto.List ?? 0d, currency);
            result.SalePrice   = priceDto.Sale == null ? result.ListPrice : new Money(priceDto.Sale ?? 0d, currency);
            result.MinQuantity = priceDto.MinQuantity;
            return(result);
        }
Beispiel #4
0
 public static TierPrice ToTierPrice(this pricingDto.Price priceDto, Currency currency)
 {
     return(PricingConverterInstance.ToTierPrice(priceDto, currency));
 }
Beispiel #5
0
 public static ProductPrice ToProductPrice(this pricingDto.Price priceDto, IEnumerable <Currency> availCurrencies, Language language)
 {
     return(PricingConverterInstance.ToProductPrice(priceDto, availCurrencies, language));
 }