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) => { }); } }
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); }
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; }
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; }); } }
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); }