首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建垂直堆栈组织结构图

如何创建垂直堆栈组织结构图
EN

Stack Overflow用户
提问于 2017-01-14 09:21:11
回答 1查看 1.1K关注 0票数 0
代码语言:javascript
复制
I need to build a Org Chart that prints from a web page and I have something like 19 to 32 entities on the second level and 3-7 entities on the third level.

我尝试了http://www.orgchartcomponent.com/default.aspx的团队改进器提供的名为OrgChart component的解决方案,但他们在英格兰,没有回复他们的电子邮件。我还尝试了https://www.codeproject.com/Articles/18378/Organization-Chart-Generator的一个解决方案,它具有基本的树组织结构图。我通过Ling从数据库填充到SQL,没有问题。

代码语言:javascript
复制
Parent Entity - Level 1
|
|
---Child Entity Level 2
|
|
---Child Entity Level 2
|
|
---Child Entity Level 2
|
|
---Child Entity Level 2
|
|
---Child Entity Level 2
|
|
---Child Entity Level 2
          |
          |
          Child Entity Level 3
          |
          |
          Child Entity Level 3
          |
          |
          Child Entity Level 3
          |
          |
          Child Entity Level 3
EN

回答 1

Stack Overflow用户

发布于 2021-10-11 19:20:49

代码语言:javascript
复制
// using recursive function.

    static void Get_Geneology(Employee manager, int Level = 0)  // find all genealogy (kid to great grandkids or employee under a manager down the pyramid)
    {
        string indentLines = new string(' ', Level * 2);
        var managedEmployees = Employees.Where(e => e.Manager_ID == manager.Emp_ID); // 1st call. look all employees under a Manager. or all kids of a father.
        Console.WriteLine($"{indentLines} {Level + 1}-{manager.FirstName}{(managedEmployees.Count() > 0 ? "*" : "")}"); // with * after name mean that person manage sombody or father have kid(s)

        foreach (var employee in managedEmployees) Get_Geneology(employee, Level + 1);   // recursive, find all under under (to the deapest of each people geneology for each manager)
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41645813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档