Пример #1
0
        public void Patch(QuoteItemEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var _ = this;

            target.ListPrice  = _.ListPrice;
            target.SalePrice  = _.SalePrice;
            target.TaxType    = _.TaxType;
            target.ImageUrl   = _.ImageUrl;
            target.ProductId  = _.ProductId;
            target.Comment    = _.Comment;
            target.CatalogId  = _.CatalogId;
            target.CategoryId = _.CategoryId;
            target.Currency   = _.Currency;
            target.Name       = _.Name;
            target.Sku        = _.Sku;

            if (!ProposalPrices.IsNullCollection())
            {
                var tierPriceComparer = AnonymousComparer.Create((TierPriceEntity x) => x.Quantity + "-" + x.Price);
                ProposalPrices.Patch(target.ProposalPrices, tierPriceComparer, (sourceTierPrice, targetTierPrice) => { });
            }
        }
Пример #2
0
        public static coreModel.QuoteItem ToCoreModel(this dataModel.QuoteItemEntity dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.QuoteItem();

            retVal.InjectFrom(dbEntity);
            retVal.Currency       = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), dbEntity.Currency);
            retVal.ProposalPrices = dbEntity.ProposalPrices.Select(x => x.ToCoreModel()).ToList();

            return(retVal);
        }
Пример #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;
		}
Пример #4
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; });
            }
        }
Пример #5
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);
        }