private void PopulateNodes1(TreeNodeCollection nodes, int parent)
        {
            ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
            IList<ZhuJi.Portal.Domain.Channel> list = channel.GetObjects();

            ZhuJi.Portal.Domain.ChannelCollection channels = new ZhuJi.Portal.Domain.ChannelCollection();
            DataTable dt = channels.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("ContentItem.aspx?ChannelId={0}", dr["Id"]);
                    nodes.Add(tn);
                }
            }
        }
Esempio n. 2
0
        private void PopulateNodes1(TreeNodeCollection nodes, int parent)
        {
            ZhuJi.Portal.IDAL.IChannel          channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
            IList <ZhuJi.Portal.Domain.Channel> list    = channel.GetObjects();

            ZhuJi.Portal.Domain.ChannelCollection channels = new ZhuJi.Portal.Domain.ChannelCollection();
            DataTable dt = channels.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("ContentItem.aspx?ChannelId={0}", dr["Id"]);
                    nodes.Add(tn);
                }
            }
        }
        private void PopulateNodes(TreeNodeCollection nodes, int parent)
        {
            try
            {
                ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                IList<ZhuJi.Portal.Domain.Channel> list = channel.GetObjects();

                ZhuJi.Portal.Domain.ChannelCollection channels = new ZhuJi.Portal.Domain.ChannelCollection();
                DataTable dt = channels.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);
            }
        }
Esempio n. 4
0
        private void PopulateNodes(TreeNodeCollection nodes, int parent)
        {
            try
            {
                ZhuJi.Portal.IDAL.IChannel          channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                IList <ZhuJi.Portal.Domain.Channel> list    = channel.GetObjects();

                ZhuJi.Portal.Domain.ChannelCollection channels = new ZhuJi.Portal.Domain.ChannelCollection();
                DataTable dt = channels.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);
            }
        }