Account GetEquivalentAccout(XMLBookAccount bookAccount) { Account account = new Account(); account.Name = bookAccount.name; account.GUID = bookAccount.id.Value; account.AnsestorList = bookAccount.AnsestorList; return(account); }
void AddParentInfo(XMLBookAccount account) { var parent = GnuCashRecordRoot.Book.Account.Where(x => x.id.Value == account.parent.Value).FirstOrDefault(); Tuple <string, string> ancestor = Tuple.Create(account.id.Value, account.name); ancestorList.Add(ancestor); if (parent != null) { AddParentInfo(parent); } }
void VisitChildren(XMLBookAccount account, bool isRoot) { ancestorList = new List <Tuple <string, string> >(); AddParentInfo(account); account.AnsestorList = this.ancestorList; var children = GnuCashRecordRoot.Book.Account.Where(x => x.parent.Value == account.id.Value).ToList(); foreach (var child in children) { VisitChildren(child, false); } }