Example #1
0
        //跟新增类型没区别,只是父节点和级数有变化
        private void barButtonItem_CreateSonType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            g_relationType = new MyRelationType();
            TreeListNode node = this.TreeList_Relation.FocusedNode;

            this.DBOperType = "I";
            //this.addflage = "0";
            //无数据
            if (node == null)
            {
                MessageBox.Show("请先选择类型");
            }
            //一级节点
            if (node != null && node.ParentNode == null)
            {
                g_relationType.RELATIONTYPE_ID       = Guid.NewGuid().ToString();
                g_relationType.RELATIONTYPE_PARENTID = node.GetValue("RELATIONTYPE_ID").ToString();
                g_relationType.RELATIONTYPE_IFDETAIL = "F";
                g_relationType.RELATIONTYPE_GRADE    = 2;
            }
            //非一级节点
            if (node != null && node.ParentNode != null)
            {
                g_relationType.RELATIONTYPE_ID       = Guid.NewGuid().ToString();
                g_relationType.RELATIONTYPE_PARENTID = node.GetValue("RELATIONTYPE_ID").ToString();
                g_relationType.RELATIONTYPE_IFDETAIL = "F";
                g_relationType.RELATIONTYPE_GRADE    = Convert.ToInt32(node.GetValue("RELATIONTYPE_GRADE")) + 1;
            }

            //状态修改
            ChangeCardState(true);
        }
Example #2
0
        /// <summary>
        /// 循环绑定类型树
        /// </summary>
        /// <param name="treeList"></param>
        /// <param name="treeNode"></param>
        /// <param name="relationType"></param>
        /// <param name="relationTypeList"></param>
        private void LoadRelationTypeTreeNode(DevExpress.XtraTreeList.TreeList treeList, TreeListNode treeNode, MyRelationType relationType, List <MyRelationType> relationTypeList)
        {
            int    grade    = relationType.RELATIONTYPE_GRADE;
            string parentid = relationType.RELATIONTYPE_PARENTID;

            foreach (MyRelationType item in relationTypeList)
            {
                if (item.RELATIONTYPE_PARENTID == parentid && item.RELATIONTYPE_GRADE - grade == 1)
                {
                    TreeListNode typeNode = treeList.AppendNode(new Object[] { item.RELATIONTYPE_ID, item.RELATIONTYPE_CODE, item.RELATIONTYPE_NAME, item.RELATIONTYPE_PARENTID, item.RELATIONTYPE_IFDETAIL, item.RELATIONTYPE_GRADE, item.RELATIONTYPE_IFINVALID, item.RELATIONTYPE_NOTE, item.RELATIONTYPE_CREATETIME, item.RELATIONTYPE_LASTMODIFIEDTIME, item.RELATIONTYPE_MODIFICATIONTIMES, "RelationType" }, null);
                    typeNode.StateImageIndex = 0;
                    //循环绑定子类型
                    LoadRelationTypeTreeNode(treeList, typeNode, item, relationTypeList);
                    LoadRelationInfoTreeNode(treeList, typeNode, item.RELATIONTYPE_RELATIONINFO);
                }
            }
        }