Пример #1
0
 private void AddChild(CompanyNode child)
 {
     if (childs == null)
         childs = new List<CompanyNode>();
     childs.Add(child);
     if (child.company.Earning != null)
         AddValueToEarning((int)child.company.Earning);
 }
Пример #2
0
        public CompanyNode(CompanyNode parent, CompanyEntity company, TreeViewModel db)
        {
            this.parent = parent;
            this.company = company;
            if (this.company.Earning == null)
                totallEarning = 0;
            else
                totallEarning = (int)this.company.Earning;

            List<CompanyEntity> childCompanies = db.CompaniesTreeViewTable.Where(c => c.ParentId == company.Id).OrderBy(c => c.Name).ToList();
            foreach (CompanyEntity c in childCompanies)
                AddChild(new CompanyNode(this, c, db));
        }