Exemplo n.º 1
0
        protected void gvCombinations_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateProductVariantAttributeCombination")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvCombinations.Rows[index];

                HiddenField    hfProductVariantAttributeCombinationId = row.FindControl("hfProductVariantAttributeCombinationId") as HiddenField;
                Label          lblAttributes           = row.FindControl("lblAttributes") as Label;
                Label          lblWarnings             = row.FindControl("lblWarnings") as Label;
                NumericTextBox txtStockQuantity        = row.FindControl("txtStockQuantity") as NumericTextBox;
                CheckBox       cbAllowOutOfStockOrders = row.FindControl("cbAllowOutOfStockOrders") as CheckBox;

                int  productVariantAttributeCombinationId = int.Parse(hfProductVariantAttributeCombinationId.Value);
                int  stockQuantity         = txtStockQuantity.Value;
                bool allowOutOfStockOrders = cbAllowOutOfStockOrders.Checked;

                var combination = ProductAttributeManager.GetProductVariantAttributeCombinationById(productVariantAttributeCombinationId);

                if (combination != null)
                {
                    ProductAttributeManager.UpdateProductVariantAttributeCombination(combination.ProductVariantAttributeCombinationId,
                                                                                     combination.ProductVariantId, combination.AttributesXml,
                                                                                     stockQuantity, allowOutOfStockOrders);
                }

                BindCombinations();
            }
        }