private void generarOrganigrama(RadOrgChart control, List <SPE_OBTIENE_PLAN_VIDA_CARRERA_Result> source, bool ordenar, string tipo) { bool mostrarcheck; string css = ""; int i = 0; if (ordenar) { source = source.OrderByDescending(t => t.NO_NIVEL).ToList(); } if (source.Count > 0) { if (source[i].ID_PUESTO == vIdPuesto) { mostrarcheck = false; switch (tipo) { case "NATURAL": css = "cssNaturalActual"; break; case "ALTER": css = "cssAlternativaActual"; break; case "HOR": css = "cssHorizontalActual"; break; } } else { mostrarcheck = true; switch (tipo) { case "NATURAL": css = "cssNatural"; break; case "ALTER": css = "cssAlternativa"; break; case "HOR": css = "cssHorizontal"; break; } } var node = new OrgChartNode(); node.DataItem = source[i]; var groupItem = new OrgChartGroupItem() { Template = new SelectionTemplate(source[i].ID_PUESTO, source[i].NB_PUESTO, mostrarcheck, css) }; groupItem.CssClass = css; if (source.Count > 1) { generarOrganigrama(source, node, i + 1, tipo); } node.GroupItems.Add(groupItem); control.Nodes.Add(node); } }
private void generarOrganigrama(List <SPE_OBTIENE_PLAN_VIDA_CARRERA_Result> source, OrgChartNode nodo, int i, string tipo) { bool mostrarcheck; string css = ""; if (source[i].ID_PUESTO == vIdPuesto) { mostrarcheck = false; switch (tipo) { case "NATURAL": css = "cssNaturalActual"; break; case "ALTER": css = "cssAlternativaActual"; break; case "HOR": css = "cssHorizontalActual"; break; } } else { mostrarcheck = true; switch (tipo) { case "NATURAL": css = "cssNatural"; break; case "ALTER": css = "cssAlternativa"; break; case "HOR": css = "cssHorizontal"; break; } } var node = new OrgChartNode(); node.DataItem = source[i]; var groupItem = new OrgChartGroupItem() { Template = new SelectionTemplate(source[i].ID_PUESTO, source[i].NB_PUESTO, mostrarcheck, css) }; groupItem.CssClass = css; nodo.Nodes.Add(node); node.GroupItems.Add(groupItem); if (i < source.Count - 1) { generarOrganigrama(source, node, i + 1, tipo); } }