protected void btnNewTierPrice_Click(object sender, EventArgs e)
        {
            try
            {
                ProductVariant productVariant = this.ProductService.GetProductVariantById(this.ProductVariantId);
                if (productVariant != null)
                {
                    decimal price = txtNewPrice.Value;
                    int quantity = txtNewQuantity.Value;
                    var tierPrice = new TierPrice()
                    {
                        ProductVariantId = productVariant.ProductVariantId,
                        Quantity = quantity,
                        Price = price
                    };
                    this.ProductService.InsertTierPrice(tierPrice);

                    BindData();
                }
            }
            catch (Exception exc)
            {
                processAjaxError(exc);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the tier price
        /// </summary>
        /// <param name="tierPrice">Tier price</param>
        public void UpdateTierPrice(TierPrice tierPrice)
        {
            if (tierPrice == null)
                throw new ArgumentNullException("tierPrice");

            if (!_context.IsAttached(tierPrice))
                _context.TierPrices.Attach(tierPrice);

            _context.SaveChanges();

            if (this.CacheEnabled)
            {
                _cacheManager.RemoveByPattern(PRODUCTS_PATTERN_KEY);
                _cacheManager.RemoveByPattern(PRODUCTVARIANTS_PATTERN_KEY);
                _cacheManager.RemoveByPattern(TIERPRICES_PATTERN_KEY);
                _cacheManager.RemoveByPattern(CUSTOMERROLEPRICES_PATTERN_KEY);
            }
        }
Esempio n. 3
0
        private static TierPrice DBMapping(DBTierPrice dbItem)
        {
            if (dbItem == null)
                return null;

            TierPrice item = new TierPrice();
            item.TierPriceID = dbItem.TierPriceID;
            item.ProductVariantID = dbItem.ProductVariantID;
            item.Quantity = dbItem.Quantity;
            item.Price = dbItem.Price;

            return item;
        }