コード例 #1
0
    protected void btnAddAccountingPlan_Click(object sender, EventArgs e)
    {
        accountManager = new AccountManager(this);
        accountingPlan = new AccountingPlan();

        if (String.IsNullOrEmpty(cboTreeAccountingPlan.SelectedValue))
        {
            ShowError("Selecione um plano de contas pai!");
            return;
        }

        if (treAccountingPlan.SelectedNode != null)
        {
            AccountingPlan original_accountingPlan = accountManager.GetAccountingPlan(Company.CompanyId,Convert.ToInt32(treAccountingPlan.SelectedValue));
            
            accountingPlan.CopyPropertiesFrom(original_accountingPlan);

            accountingPlan.Name = txtName.Text.ToUpper();

            accountingPlan.ParentId = Convert.ToInt32(cboTreeAccountingPlan.SelectedValue);

            accountManager.UpdateAccountingPlan(original_accountingPlan, accountingPlan);
        }
        else
        {
            accountingPlan.CompanyId = Company.CompanyId;
            accountingPlan.Name = txtName.Text.ToUpper();

            accountingPlan.ParentId = Convert.ToInt32(cboTreeAccountingPlan.SelectedValue);

            accountManager.InsertAccountingPlan(accountingPlan);
        }
        BindTree();
    }
コード例 #2
0
    protected override void OnDataBinding(EventArgs e)
    {
        base.OnDataBinding(e);

        AccountManager manager = new AccountManager(this);
        DataTable table = manager.GetAccountingPlan(Page.Company.CompanyId);
        treeAcountingPlan.DataSource = table;
    }
コード例 #3
0
 //This method meets the tree with the plans of accounts
 public void BindTree()
 {
     accountManager = new AccountManager(this);
     DataTable table = accountManager.GetAccountingPlan(Company.CompanyId);
     treAccountingPlan.DataSource = table;
     treAccountingPlan.DataBind();
     treAccountingPlan.ExpandAllNodes();
     cboTreeAccountingPlan.SelectedValue = "";
     txtName.Text = "";
 }