protected void btnSave_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(ViewState["ID"]);

            SecRoleInvoiceApprovalPermission rule = null;

            if (id == 0)
            {
                rule = new SecRoleInvoiceApprovalPermission();

                rule.RoleID = Convert.ToInt32(ddlRole.SelectedValue);

                rule.ClientID = clientID;
            }
            else
            {
                rule = InvoiceApprovalRuleManager.Get(id);
            }

            if (rule != null)
            {
                rule.AmountFrom = txtAmountFrom.Value == null ? 0 : Convert.ToDecimal(txtAmountFrom.Value);

                rule.AmountTo = txtAmountTo.Value == null ? 0 : Convert.ToDecimal(txtAmountTo.Value);

                InvoiceApprovalRuleManager.Save(rule);

                showGridPanel();

                bindPermissions(Convert.ToInt32(ddlRole.SelectedValue));
            }
        }
        protected void gvInvoiceApprovalRules_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);
            SecRoleInvoiceApprovalPermission rule = null;

            if (e.CommandName == "DoEdit")
            {
                rule = InvoiceApprovalRuleManager.Get(id);

                if (rule != null)
                {
                    showEditPanel();

                    ViewState["ID"] = id.ToString();

                    txtAmountFrom.Text = rule.AmountFrom.ToString("N2");

                    txtAmountTo.Text = rule.AmountTo.ToString("N2");

                    SetFocus(txtAmountFrom);
                }
            }
            else if (e.CommandName == "DoDelete")
            {
                InvoiceApprovalRuleManager.Delete(id);

                showGridPanel();

                bindPermissions(Convert.ToInt32(ddlRole.SelectedValue));
            }
        }