Example #1
0
        static string buildRootNode(string[] rootIDs, DataTable dtContexts)
        {
            string    result  = "";
            AdmMapDT  mapDT   = new AdmMapDT();
            string    mapCond = " ID in (" + string.Join(",", rootIDs) + ") ";
            DataTable dtMaps  = mapDT.GetByCond(mapCond, "PathLevel, OrderNum ASC");

            foreach (DataRow row in dtMaps.Select("PathLevel=1"))
            {
                result += @" <li><a href='#'>" + row["Name"].ToString() + "</a>";
                DataRow[] childRows = mapDT.GetByCond("ParentID = " + row["ID"].ToString()).Select();
                result += @"<div class='cbp-hrsub'><div class='cbp-hrsub-inner'>";

                if (childRows.Length > 0)
                {
                    foreach (DataRow childRow in childRows)
                    {
                        result += @"<div>";
                        result += " <h4>" + childRow["Name"].ToString() + "</h4><ul> ";
                        result += buildContextNode(row["Path"].ToString(), childRow["ID"].ToString(), dtContexts);
                        result += @"</ul></div>";
                    }
                }
                else
                {
                    result += @"<div>";
                    result += @" <h4></h4><ul>";
                    result += buildContextNode(row["Path"].ToString(), row["ID"].ToString(), dtContexts);
                    result += @"</ul></div>";
                }
                result += @"</div></div></li>";
            }
            return(result);
        }