public void InsertGoogleProductRecord(GoogleProductRecord record)
        {
            if (record == null)
                throw new ArgumentNullException("googleProductRecord");

            _gpRepository.Insert(record);
        }
Example #2
0
        private string Size(GoogleProductRecord googleProduct)
        {
            if (googleProduct != null && googleProduct.Size.HasValue())
                return googleProduct.Size;

            return Settings.Size;
        }
Example #3
0
        private string ProductCategory(GoogleProductRecord googleProduct)
        {
            string productCategory = "";

            if (googleProduct != null)
                productCategory = googleProduct.Taxonomy;

            if (productCategory.IsEmpty())
                productCategory = Settings.DefaultGoogleCategory;

            return productCategory;
        }
Example #4
0
        private string Pattern(GoogleProductRecord googleProduct)
        {
            if (googleProduct != null && googleProduct.Pattern.HasValue())
                return googleProduct.Pattern;

            return Settings.Pattern;
        }
Example #5
0
        private string Material(GoogleProductRecord googleProduct)
        {
            if (googleProduct != null && googleProduct.Material.HasValue())
                return googleProduct.Material;

            return Settings.Material;
        }
Example #6
0
        private string ItemGroupId(GoogleProductRecord googleProduct)
        {
            if (googleProduct != null && googleProduct.ItemGroupId.HasValue())
                return googleProduct.ItemGroupId;

            return "";
        }
Example #7
0
        private string Gender(GoogleProductRecord googleProduct)
        {
            if (Settings.Gender.IsCaseInsensitiveEqual(PluginHelper.NotSpecified))
                return "";

            if (googleProduct != null && googleProduct.Gender.HasValue())
                return googleProduct.Gender;

            return Settings.Gender;
        }
Example #8
0
        private string Color(GoogleProductRecord googleProduct)
        {
            if (googleProduct != null && googleProduct.Color.HasValue())
                return googleProduct.Color;

            return Settings.Color;
        }
Example #9
0
        private string AgeGroup(GoogleProductRecord googleProduct)
        {
            if (Settings.AgeGroup.IsCaseInsensitiveEqual(PluginHelper.NotSpecified))
                return "";

            if (googleProduct != null && googleProduct.AgeGroup.HasValue())
                return googleProduct.AgeGroup;

            return Settings.AgeGroup;
        }
Example #10
0
        public void UpdateInsert(int pk, string name, string value)
        {
            if (pk == 0 || name.IsEmpty())
                return;

            var product = GetGoogleProductRecord(pk);
            bool insert = (product == null);
            var utcNow = DateTime.UtcNow;

            if (product == null)
            {
                product = new GoogleProductRecord
                {
                    ProductId = pk,
                    CreatedOnUtc = utcNow
                };
            }

            switch (name)
            {
                case "Taxonomy":
                    product.Taxonomy = value;
                    break;
                case "Gender":
                    product.Gender = value;
                    break;
                case "AgeGroup":
                    product.AgeGroup = value;
                    break;
                case "Color":
                    product.Color = value;
                    break;
                case "Size":
                    product.Size = value;
                    break;
                case "Material":
                    product.Material = value;
                    break;
                case "Pattern":
                    product.Pattern = value;
                    break;
                case "Exporting":
                    product.Export = value.ToBool(true);
                    break;
            }

            product.UpdatedOnUtc = utcNow;
            product.IsTouched = product.IsTouched();

            if (!insert && !product.IsTouched)
            {
                _gpRepository.Delete(product);
                return;
            }

            if (insert)
            {
                _gpRepository.Insert(product);
            }
            else
            {
                _gpRepository.Update(product);
            }
        }
Example #11
0
        public void UpdateGoogleProductRecord(GoogleProductRecord record)
        {
            if (record == null)
                throw new ArgumentNullException("record");

            _gpRepository.Update(record);
        }