Exemplo n.º 1
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void uniGrid_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "edit")
        {
            URLHelper.Redirect("Customer_Edit_Address_Edit.aspx?customerId=" + customerId + "&addressId=" + Convert.ToString(actionArgument));
        }
        else if (actionName == "delete")
        {
            if (customerObj == null)
            {
                return;
            }

            if (!ECommerceContext.IsUserAuthorizedToModifyCustomer())
            {
                RedirectToAccessDenied("CMS.Ecommerce", "EcommerceModify OR ModifyCustomers");
            }

            int addressId = ValidationHelper.GetInteger(actionArgument, 0);
            // Check for the address dependences
            if (AddressInfoProvider.CheckDependencies(addressId))
            {
                lblError.Visible = true;
                lblError.Text    = GetString("Ecommerce.DeleteDisabled");
                return;
            }

            // Delete AddressInfo object from database
            AddressInfoProvider.DeleteAddressInfo(addressId);
        }
    }
Exemplo n.º 2
0
    protected void btnHiddenDelete_Click(object sender, EventArgs e)
    {
        // Get AddressId from the row
        AddressId = ValidationHelper.GetInteger(hdnID.Value, 0);

        // Check for the address dependences
        if (AddressInfoProvider.CheckDependencies(AddressId))
        {
            lblError.Visible = true;
            lblError.Text    = GetString("Ecommerce.DeleteDisabled");
            return;
        }

        // Delete AddressInfo object from database
        AddressInfoProvider.DeleteAddressInfo(AddressId);

        gridAddresses.ReBind();
    }