protected void btnDeleteAccoutingPlan_Command(object sender, CommandEventArgs e)
    {

        if (treAccountingPlan.SelectedNode == null)
        {
            ShowError("Selecione um plano de contas!");
            return;
        }


        if (e.CommandName == "Select")
        {
            var node = treAccountingPlan.FindNodeByValue(e.CommandArgument.ToString());

            cboTreeAccountingPlan.SelectedValue = String.Empty;

            if (node.ParentNode != null)
                cboTreeAccountingPlan.SelectedValue = node.ParentNode.Value;

            txtName.Text = node.Text;
        }
        else if (e.CommandName == "Delete")
        {
            accountingPlan = new AccountManager(this).GetAccountingPlan(Company.CompanyId, Convert.ToInt32(treAccountingPlan.SelectedNode.Value));
            accountManager = new AccountManager(this);
            switch (accountManager.DeleteAccountingPlan(accountingPlan))
            {
                case AccountManager.AccountPlanDeleteStatus.DeletingRegisterWithForeignKey:
                    ShowError(Resources.Exception.DeletingRegisterWithForeignKey);
                    break;
                case AccountManager.AccountPlanDeleteStatus.ExistsAssociatedAccountPlan:
                    ShowError(Resources.Exception.ExistsChildCategories);
                    break;
                default:
                    accountManager.DeleteAccountingPlan(accountingPlan);
                    BindTree();
                    break;
            }



        }

    }