protected void btnAction_Command(object sender, CommandEventArgs e) { if (e.CommandName == "Save") { if (Page.IsValid) { decimal totalAmount = 0, percentage = 0, itemDiscount = 0, minAmount = 0; int skuId = 0, relatedskuId = 0, itemDiscountType = 0; if (txttotalAmount.Text.Length > 0) { itemDiscount = Convert.ToDecimal(txttotalAmount.Text); totalAmount = itemDiscount; } if (txtPercentage.Text.Length > 0) { percentage = Math.Round(Convert.ToDecimal(txtPercentage.Text), 2); } if (txtItemDiscount.Text.Length > 0) { itemDiscount = Math.Round(Convert.ToDecimal(txtItemDiscount.Text), 2); } if (txtMinAmount.Text.Length > 0) { minAmount = Math.Round(Convert.ToDecimal(txtMinAmount.Text), 2); } if (Convert.ToInt32(ddlDiscountType.SelectedValue) == (int)CouponTypeEnum.ItemType) { skuId = Convert.ToInt32(ddlSkuList.SelectedItem.Value); relatedskuId = 0; itemDiscountType = Convert.ToInt32(ddlItemDiscountType.SelectedValue); itemDiscount = Math.Round(Convert.ToDecimal(txtItemDiscount.Text), 2); } CSFactory.UpdateCoupon(cId, CommonHelper.fixquotesAccents(txtDiscountTitle.Text.Trim()), percentage, totalAmount, Convert.ToInt32(ddlDiscountType.SelectedValue), skuId, relatedskuId, itemDiscountType, itemDiscount, true, cbIncludeShipping.Checked, minAmount); //CSFactory.ResetCouponCache(); } } Response.Redirect("CouponList.aspx"); }