【问题标题】:How do you create a vertical stack org Chart如何创建垂直堆栈组织图表
【发布时间】:2017-01-14 01:21:11
【问题描述】:

我需要构建一个从网页打印的组织结构图,第二级有 19 到 32 个实体,第三级有 3-7 个实体。

我在 Team Improvementr 尝试了一个名为 OrgChart 组件的解决方案 http://www.orgchartcomponent.com/default.aspx 但他们在英格兰,不回复他们的电子邮件。

我也尝试了一个解决方案 https://www.codeproject.com/Articles/18378/Organization-Chart-Generator 具有基本的树形组织结构图。

我通过 Ling 从数据库填充到 SQL,没问题。

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

【问题讨论】:

  • Google 图表有您可以使用的组织结构图。 developers.google.com/chart/interactive/docs/gallery/…
  • 您可以使用GetOrgChart getorgchart.com/Demos/Orientation
  • 我正在寻找 C# 解决方案。我可以在 c# 或源代码中设置属性的东西,我可以操纵它来创建垂直方向。我以前使用过 Google 组织结构图。不容易操作,GetOrgChart 也不是 c# 解决方案。
  • @arraylist,嗨,你最终解决了吗?我正在尝试做同样的事情。
  • 可以说我曾经做过。

标签: c# asp.net orgchart


【解决方案1】:
// 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)
    }

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center。
猜你喜欢
  • 2020-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-10-19
  • 2021-10-29
  • 2021-08-14
  • 1970-01-01
相关资源
最近更新 更多