예제 #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();
            }
        }
예제 #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();
            }
        }