public List <DataTable> AccountLedgerViewAllByLedgerName(decimal decaccountGroupId) { List <DataTable> ListObj = new List <DataTable>(); try { ListObj = spAccountLedger.AccountLedgerViewAllByLedgerName(decaccountGroupId); } catch (Exception ex) { MessageBox.Show("AL29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(ListObj); }
/// <summary> /// Function to fill ledgers as TreeMode /// </summary> /// <param name="tn"></param> public void FillTree(TreeNode tn) { try { DataTable dtb = new DataTable(); AccountGroupSP spAccountGroup = new AccountGroupSP(); dtb = spAccountGroup.AccountGroupViewAllByGroupUnder(Convert.ToDecimal(tn.Name)); AccountLedgerSP ledgerSP = new AccountLedgerSP(); if (dtb.Rows.Count > 0) { foreach (DataRow dr in dtb.Rows) { tn.Nodes.Add(dr["accountGroupId"].ToString(), dr["accountGroupName"].ToString()); tn.ExpandAll(); if (tn.LastNode != null) { tn.LastNode.ForeColor = Color.Red; } else { tn.LastNode.ForeColor = Color.Blue; } } foreach (TreeNode tn1 in tn.Nodes) { FillTree(tn1); DataTable dtb1 = ledgerSP.AccountLedgerViewAllByLedgerName(Convert.ToDecimal(tn1.Name)); foreach (DataRow dr in dtb1.Rows) { tn1.Nodes.Add(dr["ledgerId"].ToString(), dr["ledgerName"].ToString()); tn1.ExpandAll(); if (tn1.LastNode != null) { tn1.LastNode.ForeColor = Color.Blue; } else { tn.LastNode.ForeColor = Color.Red; } } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "COA1:" + ex.Message; } }