Example #1
0
    protected void uxGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridViewRow rowGrid = uxGrid.Rows[e.RowIndex];

            if (IsCorrectFormatForShippingByWeight(rowGrid) == false)
            {
                uxStatusHidden.Value = "Error";
                uxMessage.DisplayError(Resources.ShippingWeightRateMessage.TofewError);
                return;
            }

            string shippingWeightRateID = uxGrid.DataKeys[e.RowIndex]["ShippingWeightRateID"].ToString();

            ShippingWeightRate shippingWeightRate = DataAccessContext.ShippingWeightRateRepository.GetOne(shippingWeightRateID);
            shippingWeightRate = GetDetailsFromGrid(rowGrid, shippingWeightRate);

            DataAccessContext.ShippingWeightRateRepository.Save(shippingWeightRate);

            uxGrid.EditIndex = -1;
            RefreshGrid();

            uxStatusHidden.Value = "Updated";

            uxMessage.DisplayMessage(Resources.ShippingWeightRateMessage.ItemUpdateSuccess);
        }
        finally
        {
            e.Cancel = true;
        }
    }
Example #2
0
    private void CreateDummyRow(IList <ShippingWeightRate> list)
    {
        ShippingWeightRate shippingWeightRate = new ShippingWeightRate();

        shippingWeightRate.ShippingWeightRateID = "-1";
        shippingWeightRate.ShippingID           = ShippingID;
        shippingWeightRate.ToWeight             = 0;
        shippingWeightRate.WeightRate           = 0;
        list.Add(shippingWeightRate);
    }
 private void AddUnlimitedNumberShippingWeightRate(ShippingOption shippingOption)
 {
     if (shippingOption.ShippingOptionType.TypeName == ByWeightShippingMethod.ShippingOptionTypeName)
     {
         ShippingWeightRate shippingWeightRate = new ShippingWeightRate();
         shippingWeightRate.ShippingID = shippingOption.ShippingID;
         shippingWeightRate.ToWeight   = SystemConst.UnlimitedNumber;
         shippingWeightRate.WeightRate = 0;
         DataAccessContext.ShippingWeightRateRepository.Save(shippingWeightRate);
     }
 }
Example #4
0
    private ShippingWeightRate GetDetailsFromGrid(GridViewRow row, ShippingWeightRate shippingWeightRate)
    {
        shippingWeightRate.ShippingID = ShippingID;
        string toWeightText = ((TextBox)row.FindControl("uxToWeightText")).Text;

        shippingWeightRate.ToWeight = ConvertUtilities.ToDouble(toWeightText);

        string shippingWeightRateText = ((TextBox)row.FindControl("uxShippingWeightRate")).Text;

        shippingWeightRate.WeightRate = ConvertUtilities.ToDecimal(shippingWeightRateText);

        return(shippingWeightRate);
    }
Example #5
0
    protected void uxGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Add")
        {
            GridViewRow rowAdd = uxGrid.FooterRow;

            if (IsCorrectFormatForShippingByWeight(rowAdd) == false)
            {
                uxStatusHidden.Value = "Error";
                uxMessage.DisplayError(Resources.ShippingWeightRateMessage.TofewError);
                return;
            }

            ShippingWeightRate shippingWeightRate = new ShippingWeightRate();
            shippingWeightRate = GetDetailsFromGrid(rowAdd, shippingWeightRate);

            if (!IsExisted(shippingWeightRate.ToWeight))
            {
                if (shippingWeightRate.ToWeight <= SystemConst.UnlimitedNumber)
                {
                    DataAccessContext.ShippingWeightRateRepository.Save(shippingWeightRate);
                    ClearData(rowAdd);
                    RefreshGrid();

                    uxStatusHidden.Value = "Added";
                    uxMessage.DisplayMessage(Resources.ShippingWeightRateMessage.ItemAddSuccess);
                }
                else
                {
                    uxMessage.DisplayError(Resources.ShippingWeightRateMessage.TomuchItemError);
                }
            }
            else
            {
                uxStatusHidden.Value = "Error";
                uxMessage.DisplayError(Resources.ShippingWeightRateMessage.ToWeightError);
            }
        }
        else if (e.CommandName == "Edit")
        {
            uxGrid.ShowFooter   = false;
            uxAddButton.Visible = true;
        }
    }