private void PopulateNodes2(TreeNodeCollection nodes, int parent) { ZhuJi.Portal.IDAL.IPlugin plugin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Plugin)) as ZhuJi.Portal.IDAL.IPlugin; IList <ZhuJi.Portal.Domain.Plugin> list = plugin.GetObjects(); ZhuJi.Portal.Domain.PluginCollection plugins = new ZhuJi.Portal.Domain.PluginCollection(); DataTable dt = plugins.CreateDateTable(list); DataRow[] drs = dt.Select(string.Format("[Parent] = {0}", parent)); if (drs.Length == 0) { return; } else { foreach (DataRow dr in drs) { TreeNode tn = new TreeNode(); tn.Text = dr["Title"].ToString(); tn.Value = dr["Id"].ToString(); if (dt.Select(string.Format("[Parent] = {0}", tn.Value)).Length > 0) { tn.PopulateOnDemand = true; } tn.NavigateUrl = string.Format("AddIn.aspx?PluginId={0}", dr["Id"]); nodes.Add(tn); } } }
private void PopulateNodes(TreeNodeCollection nodes, int parent) { try { ZhuJi.Portal.IDAL.IPlugin plugin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Plugin)) as ZhuJi.Portal.IDAL.IPlugin; IList <ZhuJi.Portal.Domain.Plugin> list = plugin.GetObjects(); ZhuJi.Portal.Domain.PluginCollection plugins = new ZhuJi.Portal.Domain.PluginCollection(); DataTable dt = plugins.CreateDateTable(list); DataRow[] drs = dt.Select(string.Format("[Parent] = {0}", parent)); if (drs.Length == 0) { return; } else { foreach (DataRow dr in drs) { TreeNode tn = new TreeNode(); tn.Text = string.Format("{0}({1})", dr["Title"].ToString(), dr["Id"].ToString()); tn.Value = dr["Id"].ToString(); if (dt.Select(string.Format("[Parent] = {0}", tn.Value)).Length > 0) { tn.PopulateOnDemand = true; } tn.SelectAction = TreeNodeSelectAction.Expand; nodes.Add(tn); } } } catch (Exception ex) { ShowMessage(ex); } }