private void handleThisRootNode(RootNode rNode) { Boolean groupAcc = this.groupAccountsMenuItem.Checked; Boolean groupEnv = this.groupEnvelopesMenuItem.Checked; byte cat = rNode.Catagory; if (groupEnv && cat == SpclAccountCat.ENVELOPE) { // Fill with Envelope Groups foreach (var item in DBquery.getEnvelopeGroups()) { rNode.Nodes.Add(new GroupNode(item.ID, item.Name)); } } else if (!groupEnv && cat == SpclAccountCat.ENVELOPE) { // Fill with All Envelope names foreach (var item in DBquery.getAllEnvelopeNames()) { rNode.Nodes.Add(new EnvelopeNode(item.ID, item.Name)); } // Fill all Envelope balances foreach (var item in DBquery.getAllEnvelopeBalances()) { this.updateBalanceRecurse(rNode, SpclAccount.NULL, item.ID, item.Balance); } } else if (groupAcc) { // Fill with the Account Types foreach (var item in DBquery.getAccountTypes(cat)) { rNode.Nodes.Add(new TypeNode(item.ID, item.Name, cat)); } } else if (cat == SpclAccountCat.ACCOUNT) { // Fill with All Account names foreach (var item in DBquery.getAccountNamesByCatagory(cat)) { rNode.Nodes.Add(new AccountNode(cat, item.ID, item.Name, item.Envelopes)); } // Fill all Account balances foreach (var item in DBquery.getAccountBalancesByCatagory(cat)) { this.updateBalanceRecurse(rNode, item.ID, SpclEnvelope.NULL, item.Balance); } } else if (cat == SpclAccountCat.EXPENSE || cat == SpclAccountCat.INCOME) { // Fill with the Account names. No balances foreach (var item in DBquery.getAccountNamesByCatagory(cat)) { rNode.Nodes.Add(new AccountNode(cat, item.ID, item.Name, false)); } } this.setErrorFlag(rNode); }