Exemplo n.º 1
0
        public static dataModel.QuoteItemEntity ToDataModel(this coreModel.QuoteItem quoteItem)
		{
			if (quoteItem == null)
				throw new ArgumentNullException("quoteItem");

			var retVal = new dataModel.QuoteItemEntity();
			retVal.InjectFrom(quoteItem);
            retVal.Currency = quoteItem.Currency.ToString();
            if (quoteItem.ProposalPrices != null)
			{
				retVal.ProposalPrices = new ObservableCollection<dataModel.TierPriceEntity>(quoteItem.ProposalPrices.Select(x => x.ToDataModel()));
			}

			return retVal;
		}
Exemplo n.º 2
0
        public static void Patch(this dataModel.QuoteItemEntity source, dataModel.QuoteItemEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <dataModel.QuoteItemEntity>(x => x.Comment);

            target.InjectFrom(patchInjection, source);

            if (!source.ProposalPrices.IsNullCollection())
            {
                var tierPriceComparer = AnonymousComparer.Create((dataModel.TierPriceEntity x) => x.Quantity + "-" + x.Price);
                source.ProposalPrices.Patch(target.ProposalPrices, tierPriceComparer, (sourceTierPrice, targetTierPrice) => { return; });
            }
        }
Exemplo n.º 3
0
        public static dataModel.QuoteItemEntity ToDataModel(this coreModel.QuoteItem quoteItem)
        {
            if (quoteItem == null)
            {
                throw new ArgumentNullException("quoteItem");
            }

            var retVal = new dataModel.QuoteItemEntity();

            retVal.InjectFrom(quoteItem);
            retVal.Currency = quoteItem.Currency.ToString();
            if (quoteItem.ProposalPrices != null)
            {
                retVal.ProposalPrices = new ObservableCollection <dataModel.TierPriceEntity>(quoteItem.ProposalPrices.Select(x => x.ToDataModel()));
            }

            return(retVal);
        }