Example #1
0
        protected void gvShippingByTotals_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateShippingByTotal")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvShippingByTotals.Rows[index];

                HiddenField    hfShippingByTotalId = row.FindControl("hfShippingByTotalId") as HiddenField;
                DropDownList   ddlShippingMethod   = row.FindControl("ddlShippingMethod") as DropDownList;
                DecimalTextBox txtFrom             = row.FindControl("txtFrom") as DecimalTextBox;
                DecimalTextBox txtTo                       = row.FindControl("txtTo") as DecimalTextBox;
                CheckBox       cbUsePercentage             = row.FindControl("cbUsePercentage") as CheckBox;
                DecimalTextBox txtShippingChargePercentage = row.FindControl("txtShippingChargePercentage") as DecimalTextBox;
                DecimalTextBox txtShippingChargeAmount     = row.FindControl("txtShippingChargeAmount") as DecimalTextBox;

                int             shippingByTotalId = int.Parse(hfShippingByTotalId.Value);
                int             shippingMethodId  = int.Parse(ddlShippingMethod.SelectedItem.Value);
                ShippingByTotal shippingByTotal   = ShippingByTotalManager.GetById(shippingByTotalId);

                if (shippingByTotal != null)
                {
                    ShippingByTotalManager.UpdateShippingByTotal(shippingByTotal.ShippingByTotalId,
                                                                 shippingMethodId, txtFrom.Value, txtTo.Value, cbUsePercentage.Checked,
                                                                 txtShippingChargePercentage.Value, txtShippingChargeAmount.Value);
                }

                BindData();
            }
        }
Example #2
0
        protected void gvShippingByTotals_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int             shippingByTotalId = (int)gvShippingByTotals.DataKeys[e.RowIndex]["ShippingByTotalId"];
            ShippingByTotal shippingByTotal   = ShippingByTotalManager.GetById(shippingByTotalId);

            if (shippingByTotal != null)
            {
                ShippingByTotalManager.DeleteShippingByTotal(shippingByTotal.ShippingByTotalId);
                BindData();
            }
        }