Exemplo n.º 1
0
    protected void btnRemoveAll_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                int    userId      = CurrentEnvironment.LoggedUser.Id;
                string machineName = Request.ServerVariables["REMOTE_HOST"].ToString();
                int    i           = 0;
                if ((lbRoleActions.Items.Count > 0))
                {
                    int roleId = int.Parse(ddlRole.SelectedValue);
                    for (int j = 0; j <= lbRoleActions.Items.Count - 1; j++)
                    {
                        int actionId = int.Parse(lbRoleActions.Items[j].Value.ToString());
                        i = RoleAction.DeleteByActionAndRole(roleId, actionId);
                    }

                    _actions = Actions.GetLeftActionsOfRole(roleId);
                    BindLeftActionsOfRole(_actions);

                    _roleActions = Actions.GetActionsOfRole(roleId);
                    BindActionsOfRole(_roleActions);
                }
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }