예제 #1
0
 public static coreModel.Price ToCoreModel(this googleModel.Price price)
 {
     var retVal = new coreModel.Price();
     retVal.InjectFrom(price);
     retVal.Currency = price.Currency;
     return retVal;
 }
예제 #2
0
 public static coreModel.Price ToCoreModel(this googleModel.Price price)
 {
     var retVal = new coreModel.Price();
     retVal.InjectFrom(price);
     retVal.Currency = (CurrencyCodes) Enum.Parse(typeof(CurrencyCodes), price.Currency);
     return retVal;
 }
예제 #3
0
        public static webModel.Price ToWebModel(this coreModel.Price price)
        {
            var retVal = new webModel.Price();

            retVal.InjectFrom(price);
            retVal.Currency = price.Currency;
            return(retVal);
        }
예제 #4
0
        public static coreModel.Price ToCoreModel(this googleModel.Price price)
        {
            var retVal = new coreModel.Price();

            retVal.InjectFrom(price);
            retVal.Currency = price.Currency;
            return(retVal);
        }
        public static webModel.Price ToWebModel(this coreModel.Price price)
        {
            var retVal = new webModel.Price();

            retVal.InjectFrom(price);
            retVal.ProductId = price.ProductId;
            return(retVal);
        }
        public static coreModel.Price ToCoreModel(this googleModel.Price price)
        {
            var retVal = new coreModel.Price();

            retVal.InjectFrom(price);
            retVal.Currency = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), price.Currency);
            return(retVal);
        }
예제 #7
0
        public static googleModel.Price ToGoogleModel(this coreModel.Price price)
        {
            var retVal = new googleModel.Price();

            retVal.InjectFrom(price);
            retVal.Value    = price.List.ToString(CultureInfo.InvariantCulture);
            retVal.Currency = price.Currency.ToString();
            return(retVal);
        }
예제 #8
0
        public static dataModel.Price ToDataModel(this coreModel.Price price)
        {
            if (price == null)
            {
                throw new ArgumentNullException("price");
            }

            var retVal = new dataModel.Price();

            retVal.InjectFrom(price);
            retVal.ProductId   = price.ProductId;
            retVal.MinQuantity = price.MinQuantity;
            return(retVal);
        }
예제 #9
0
        public virtual coreModel.Price GetPriceById(string id)
        {
            coreModel.Price retVal = null;

            using (var repository = _repositoryFactory())
            {
                var entity = repository.GetPriceById(id);
                if (entity != null)
                {
                    retVal = entity.ToCoreModel();
                }
            }

            return(retVal);
        }
예제 #10
0
		public CsvProduct()
		{
			SeoInfos = new List<SeoInfo>();
			Reviews = new List<EditorialReview>();
			PropertyValues = new List<PropertyValue>();
			Images = new List<Image>();
			Assets = new List<Asset>();


			Price = new Price() { Currency = CurrencyCodes.USD };
			Inventory = new InventoryInfo();
			EditorialReview = new EditorialReview();
			Reviews = new List<EditorialReview>();
			Reviews.Add(EditorialReview);
			SeoInfo = new SeoInfo();
			SeoInfos = new List<SeoInfo>();
			SeoInfos.Add(SeoInfo);
		}
예제 #11
0
		public CsvProduct()
		{
			SeoInfos = new List<SeoInfo>();
			Reviews = new List<EditorialReview>();
			PropertyValues = new List<PropertyValue>();
			Images = new List<Image>();
			Assets = new List<Asset>();


			Price = new Price() { Currency = "USD" };
			Inventory = new InventoryInfo();
			EditorialReview = new EditorialReview();
			Reviews = new List<EditorialReview>();
			Reviews.Add(EditorialReview);
			SeoInfo = new SeoInfo() { ObjectType = typeof(CatalogProduct).Name };
			SeoInfos = new List<SeoInfo>();
			SeoInfos.Add(SeoInfo);
		}
예제 #12
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbEntity"></param>
        /// <returns></returns>
        public static coreModel.Price ToCoreModel(this dataModel.Price dbEntity)
        {
            if (dbEntity == null)
                throw new ArgumentNullException("dbEntity");

            var retVal = new coreModel.Price();

            retVal.InjectFrom(dbEntity);

            retVal.ProductId = dbEntity.ProductId;
            retVal.MinQuantity = (int)dbEntity.MinQuantity;

            if (dbEntity.Pricelist != null)
            {
                retVal.Currency = dbEntity.Pricelist.Currency;
            }

            return retVal;

        }
예제 #13
0
        /// <summary>
        /// Converting to model type
        /// </summary>
        /// <param name="dbEntity"></param>
        /// <returns></returns>
        public static coreModel.Price ToCoreModel(this dataModel.Price dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.Price();

            retVal.InjectFrom(dbEntity);

            retVal.ProductId   = dbEntity.ProductId;
            retVal.MinQuantity = (int)dbEntity.MinQuantity;

            if (dbEntity.Pricelist != null)
            {
                retVal.Currency = dbEntity.Pricelist.Currency;
            }

            return(retVal);
        }
예제 #14
0
        public virtual coreModel.Price CreatePrice(coreModel.Price price)
        {
            var entity = price.ToDataModel();

            using (var repository = _repositoryFactory())
            {
                //Need assign price to default pricelist with same currency or create it if not exist
                if (price.PricelistId == null)
                {
                    var defaultPriceListId = GetDefaultPriceListName(price.Currency);
                    var dbDefaultPriceList = repository.GetPricelistById(defaultPriceListId);

                    if (dbDefaultPriceList == null)
                    {
                        var defaultPriceList = new coreModel.Pricelist
                        {
                            Id          = defaultPriceListId,
                            Currency    = price.Currency,
                            Name        = defaultPriceListId,
                            Description = defaultPriceListId
                        };
                        dbDefaultPriceList = defaultPriceList.ToDataModel();
                    }
                    entity.PricelistId = dbDefaultPriceList.Id;
                    entity.Pricelist   = dbDefaultPriceList;

                    repository.Add(entity);

                    CommitChanges(repository);
                    //Automatically create catalog assignment
                    TryToCreateCatalogAssignment(entity, repository);
                    ResetCache();
                }
            }
            price.Id = entity.Id;
            var retVal = GetPriceById(entity.Id);

            return(retVal);
        }
예제 #15
0
		public CsvProduct(CatalogProduct product, IBlobUrlResolver blobUrlResolver, Price price, InventoryInfo inventory)
			: this()
		{
			_blobUrlResolver = blobUrlResolver;

			this.InjectFrom(product);
			PropertyValues = product.PropertyValues;
			Images = product.Images;
			Assets = product.Assets;
			Links = product.Links;
			Variations = product.Variations;
			SeoInfos = product.SeoInfos;
			Reviews = product.Reviews;
			Associations = product.Associations;
			if (price != null)
			{
				Price = price;
			}
			if (inventory != null)
			{
				Inventory = inventory;
			}
		
		}