Esempio n. 1
0
        /// <summary>
        /// 根据CODE设定下拉树的选定值
        /// Created:20170405(Xuxb)
        /// </summary>
        /// <param name="advTree1"></param>
        /// <param name="value"></param>
        public static void SetComboxTreeSelectByValue(DevComponents.DotNetBar.Controls.ComboTree advTree1, string value)
        {
            int  currentIndex = 0;
            bool catchFlg     = false;

            for (int i = 0; i < advTree1.Nodes.Count; ++i)
            {
                DevComponents.AdvTree.Node dr = (DevComponents.AdvTree.Node)(advTree1.Nodes[i]);
                if (dr.Name.ToString().Substring(0, 36) == value.Substring(0, 36))
                {
                    advTree1.SelectedIndex = currentIndex;
                    catchFlg = true;
                    break;
                }
                else
                {
                    currentIndex = GetSubTreeData(dr, value.Substring(0, 36), currentIndex, out catchFlg);
                    if (catchFlg)
                    {
                        advTree1.SelectedIndex = currentIndex;
                        break;
                    }
                    else
                    {
                        currentIndex = currentIndex + 1;
                        continue;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 加载下拉结点列表
        /// Created:20170323(ChengMengjia)
        /// Updated:20170605(ChengMengjia) 只需要普通节点PType=0
        /// </summary>
        /// <param name="advTree1"></param>
        /// <param name="ProjectID"></param>
        public static void SetComboxTreeData(DevComponents.DotNetBar.Controls.ComboTree comboTree, string ProjectID)
        {
            comboTree.Nodes.Clear();
            List <PNode>        listNode   = new WBSBLL().GetNodes(ProjectID, 0);
            IEnumerable <PNode> parentNode = null;

            DevComponents.AdvTree.Node node = null;
            parentNode = listNode.Where(t => string.IsNullOrEmpty(t.ParentID)).OrderBy(t => t.CREATED);
            IEnumerable <PNode> children = listNode.Where(t => t.ParentID == parentNode.First().ID).OrderBy(t => t.No);

            foreach (PNode child in children)
            {
                node = new DevComponents.AdvTree.Node()
                {
                    Name = child.ID,
                    Text = child.Name,
                    Tag  = JsonHelper.EntityToString <PNode>(child)
                };
                SetSubTreeData(listNode, child, node);
                comboTree.Nodes.Add(node);
            }
            comboTree.AdvTree.ExpandAll();
        }
Esempio n. 3
0
        private Node CreateNode(ComboTree tree)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
            if (dh == null)
                return null;

            Node node = null;
            tree.AdvTree.BeginUpdate();
            try
            {
                IComponentChangeService change = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                if (change != null)
                {
                    change.OnComponentChanging(this.Component, TypeDescriptor.GetProperties(tree).Find("Nodes", true));
                }

                node = dh.CreateComponent(typeof(Node)) as Node;
                if (node != null)
                {
                    node.Text = node.Name;
                    node.Expanded = true;
                    tree.Nodes.Add(node);

                    if (change != null)
                        change.OnComponentChanged(this.Component, TypeDescriptor.GetProperties(tree).Find("Nodes", true), null, null);
                }
            }
            finally
            {
                tree.AdvTree.EndUpdate();
            }

            return node;
        }