Ejemplo n.º 1
0
        public virtual quoteDto.QuoteItem ToQuoteItemDto(QuoteItem quoteItem)
        {
            var result = new quoteDto.QuoteItem
            {
                CatalogId    = quoteItem.CatalogId,
                CategoryId   = quoteItem.CategoryId,
                Comment      = quoteItem.Comment,
                CreatedBy    = quoteItem.CreatedBy,
                CreatedDate  = quoteItem.CreatedDate,
                Id           = quoteItem.Id,
                ImageUrl     = quoteItem.ImageUrl,
                ModifiedBy   = quoteItem.ModifiedBy,
                ModifiedDate = quoteItem.ModifiedDate,
                Name         = quoteItem.Name,
                ProductId    = quoteItem.ProductId,
                Sku          = quoteItem.Sku,
                TaxType      = quoteItem.TaxType,

                Currency       = quoteItem.Currency.Code,
                ListPrice      = (double)quoteItem.ListPrice.Amount,
                ProposalPrices = quoteItem.ProposalPrices.Select(ToQuoteTierPriceDto).ToList(),
                SalePrice      = (double)quoteItem.SalePrice.Amount
            };

            if (quoteItem.SelectedTierPrice != null)
            {
                result.SelectedTierPrice = ToQuoteTierPriceDto(quoteItem.SelectedTierPrice);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public virtual QuoteItem ToQuoteItem(quoteDto.QuoteItem quoteItemDto, Currency currency)
        {
            var result = new QuoteItem
            {
                CatalogId    = quoteItemDto.CatalogId,
                CategoryId   = quoteItemDto.CategoryId,
                Comment      = quoteItemDto.Comment,
                CreatedBy    = quoteItemDto.CreatedBy,
                CreatedDate  = quoteItemDto.CreatedDate,
                Id           = quoteItemDto.Id,
                ImageUrl     = quoteItemDto.ImageUrl,
                ModifiedBy   = quoteItemDto.ModifiedBy,
                ModifiedDate = quoteItemDto.ModifiedDate,
                Name         = quoteItemDto.Name,
                ProductId    = quoteItemDto.ProductId,
                Sku          = quoteItemDto.Sku,
                TaxType      = quoteItemDto.TaxType,

                Currency  = currency,
                ListPrice = new Money(quoteItemDto.ListPrice ?? 0, currency),
                SalePrice = new Money(quoteItemDto.SalePrice ?? 0, currency)
            };

            if (quoteItemDto.ProposalPrices != null)
            {
                result.ProposalPrices = quoteItemDto.ProposalPrices.Select(pp => ToTierPrice(pp, currency)).ToList();
            }

            if (quoteItemDto.SelectedTierPrice != null)
            {
                result.SelectedTierPrice = ToTierPrice(quoteItemDto.SelectedTierPrice, currency);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public virtual quoteDto.QuoteItem ToQuoteItemDto(QuoteItem quoteItem)
        {
            var serviceModel = new quoteDto.QuoteItem();

            serviceModel.InjectFrom <NullableAndEnumValueInjecter>(quoteItem);

            serviceModel.Currency       = quoteItem.Currency.Code;
            serviceModel.ListPrice      = (double)quoteItem.ListPrice.Amount;
            serviceModel.ProposalPrices = quoteItem.ProposalPrices.Select(ToQuoteTierPriceDto).ToList();
            serviceModel.SalePrice      = (double)quoteItem.SalePrice.Amount;

            if (quoteItem.SelectedTierPrice != null)
            {
                serviceModel.SelectedTierPrice = ToQuoteTierPriceDto(quoteItem.SelectedTierPrice);
            }

            return(serviceModel);
        }
Ejemplo n.º 4
0
        public virtual QuoteItem ToQuoteItem(quoteDto.QuoteItem quoteItemDto, Currency currency)
        {
            var result = ServiceLocator.Current.GetInstance <QuoteFactory>().CreateQuoteItem();

            result.InjectFrom <NullableAndEnumValueInjecter>(quoteItemDto);

            result.Currency  = currency;
            result.ListPrice = new Money(quoteItemDto.ListPrice ?? 0, currency);
            result.SalePrice = new Money(quoteItemDto.SalePrice ?? 0, currency);

            if (quoteItemDto.ProposalPrices != null)
            {
                result.ProposalPrices = quoteItemDto.ProposalPrices.Select(pp => ToTierPrice(pp, currency)).ToList();
            }

            if (quoteItemDto.SelectedTierPrice != null)
            {
                result.SelectedTierPrice = ToTierPrice(quoteItemDto.SelectedTierPrice, currency);
            }

            return(result);
        }
Ejemplo n.º 5
0
 public static QuoteItem ToQuoteItem(this quoteDto.QuoteItem quoteItemDto, Currency currency)
 {
     return(QuoteConverterInstance.ToQuoteItem(quoteItemDto, currency));
 }