コード例 #1
0
        /// <summary>
        /// 新建子节点
        /// </summary>
        /// <returns></returns>
        public EntityMultiTree DoCreateSubNode()
        {
            EntityMultiTree en = this.CreateInstance() as EntityMultiTree;

            en.No       = BP.DA.DBAccess.GenerOID(this.ToString()).ToString(); // en.GenerNewNoByKey(EntityMultiTreeAttr.No);
            en.Name     = "新建节点" + en.No;
            en.ParentNo = this.No;
            en.IsDir    = false;

            //给实体类赋值.
            en.SetValByKey(this.RefObjField, this.GetValStringByKey(this.RefObjField));

            en.TreeNo = this.GenerNewNoByKey(EntityMultiTreeAttr.TreeNo, EntityMultiTreeAttr.ParentNo, this.No);
            if (en.TreeNo.Substring(en.TreeNo.Length - 2) == "01")
            {
                en.TreeNo = this.TreeNo + "01";
            }
            en.Insert();

            // 设置此节点是目录
            if (this.IsDir == false)
            {
                this.IsDir = true;
                this.Update(EntityMultiTreeAttr.IsDir, true);
            }
            return(en);
        }
コード例 #2
0
        /// <summary>
        /// 查询他的子节点
        /// </summary>
        /// <param name="en"></param>
        /// <returns></returns>
        public int RetrieveHisChinren(EntityMultiTree en)
        {
            int i = this.Retrieve(EntityMultiTreeAttr.ParentNo, en.No);

            this.AddEntity(en);
            return(i + 1);
        }
コード例 #3
0
        /// <summary>
        /// 获取它的子节点
        /// </summary>
        /// <param name="en"></param>
        /// <returns></returns>
        public EntitiesTree GenerHisChinren(EntityMultiTree en)
        {
            EntitiesTree ens = this.CreateInstance() as EntitiesTree;

            foreach (EntityMultiTree item in ens)
            {
                if (en.ParentNo == en.No)
                {
                    ens.AddEntity(item);
                }
            }
            return(ens);
        }
コード例 #4
0
        /// <summary>
        /// 新建同级节点
        /// </summary>
        /// <returns></returns>
        public EntityMultiTree DoCreateSameLevelNode()
        {
            EntityMultiTree en = this.CreateInstance() as EntityMultiTree;

            en.No       = BP.DA.DBAccess.GenerOID(this.ToString()).ToString(); // en.GenerNewNoByKey(EntityMultiTreeAttr.No);
            en.Name     = "新建节点" + en.No;
            en.ParentNo = this.ParentNo;
            en.IsDir    = false;
            en.TreeNo   = this.GenerNewNoByKey(EntityMultiTreeAttr.TreeNo, EntityMultiTreeAttr.ParentNo, this.ParentNo);

            //给实体类赋值.
            en.SetValByKey(this.RefObjField, this.GetValStringByKey(this.RefObjField));

            en.Insert();
            return(en);
        }