Ejemplo n.º 1
0
        protected void gvShippingByWeights_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateShippingByWeight")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvShippingByWeights.Rows[index];

                HiddenField    hfShippingByWeightID = row.FindControl("hfShippingByWeightID") 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 shippingByWeightID            = int.Parse(hfShippingByWeightID.Value);
                int shippingMethodID              = int.Parse(ddlShippingMethod.SelectedItem.Value);
                ShippingByWeight shippingByWeight = ShippingByWeightManager.GetByID(shippingByWeightID);

                if (shippingByWeight != null)
                {
                    ShippingByWeightManager.UpdateShippingByWeight(shippingByWeight.ShippingByWeightID,
                                                                   shippingMethodID, txtFrom.Value, txtTo.Value, cbUsePercentage.Checked,
                                                                   txtShippingChargePercentage.Value, txtShippingChargeAmount.Value);
                }

                BindData();
            }
        }
Ejemplo n.º 2
0
        protected void gvShippingByWeights_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int shippingByWeightID            = (int)gvShippingByWeights.DataKeys[e.RowIndex]["ShippingByWeightID"];
            ShippingByWeight shippingByWeight = ShippingByWeightManager.GetByID(shippingByWeightID);

            if (shippingByWeight != null)
            {
                ShippingByWeightManager.DeleteShippingByWeight(shippingByWeight.ShippingByWeightID);
                BindData();
            }
        }