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;
		}
Example #2
0
        public static cartCoreModel.LineItem ToCartModel(this coreModel.QuoteItem quoteItem)
        {
            var retVal = new cartCoreModel.LineItem();

            retVal.InjectFrom(quoteItem);
            retVal.Sku = quoteItem.Sku;
            if (quoteItem.SelectedTierPrice != null)
            {
                retVal.PlacedPrice = quoteItem.SelectedTierPrice.Price;
                retVal.Quantity    = (int)quoteItem.SelectedTierPrice.Quantity;
            }
            return(retVal);
        }
Example #3
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);
        }
        public static coreModel.QuoteItem ToCoreModel(this webModel.QuoteItem quoteItem)
        {
            var retVal = new coreModel.QuoteItem();
            retVal.InjectFrom(quoteItem);
            retVal.Currency = quoteItem.Currency;

            if (quoteItem.ProposalPrices != null)
            {
                retVal.ProposalPrices = quoteItem.ProposalPrices.Select(x => x.ToCoreModel()).ToList();
            }
            if (quoteItem.SelectedTierPrice != null)
            {
                retVal.SelectedTierPrice = quoteItem.SelectedTierPrice.ToCoreModel();
            }
            return retVal;
        }
Example #5
0
        public static coreModel.QuoteItem ToCoreModel(this webModel.QuoteItem quoteItem)
        {
            var retVal = new coreModel.QuoteItem();

            retVal.InjectFrom(quoteItem);
            retVal.Currency = quoteItem.Currency;

            if (quoteItem.ProposalPrices != null)
            {
                retVal.ProposalPrices = quoteItem.ProposalPrices.Select(x => x.ToCoreModel()).ToList();
            }
            if (quoteItem.SelectedTierPrice != null)
            {
                retVal.SelectedTierPrice = quoteItem.SelectedTierPrice.ToCoreModel();
            }
            return(retVal);
        }
Example #6
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);
        }