Beispiel #1
0
        /// <summary>
        /// 构造函数,单纯显示树形
        /// </summary>
        /// <param name="currentNode">当前区域</param>
        public AreaTree(area currentNode)//单纯显示树形
        {
            this.area = currentNode;

            //List<area> allNodes = IareaEx.getAllArea().Where(p => p.parentid == currentNode.id).ToList();//获取属于这个节点的子节点
            List <area> allNodes = IdalCommon.IareaEx.getAreaByParentId(currentNode.id); //获取属于这个节点的子节点

            foreach (area a in allNodes)                                                 //遍历当前节点下的所有子节点
            {
                AreaTree tn = new AreaTree(a);
                this.children.Add(tn);//递归创建子节点
            }
        }
Beispiel #2
0
 ///// <summary>
 ///// 动作数据处理接口
 ///// </summary>
 //private IareaEx _iareaEx;
 //public IareaEx IareaEx
 //{
 //    get
 //    {
 //        if (_iareaEx == null)
 //        {
 //            _iareaEx = IocModule.GetEntity<IareaEx>();
 //        }
 //        return _iareaEx;
 //    }
 //}
 /// <summary>
 /// 构造函数,返回树形区域信息并且勾选已有区域
 /// </summary>
 /// <param name="currentNode"></param>
 /// <param name="arealist">已拥有区域</param>
 public AreaTree(area currentNode, List <area> arealist)
 {
     this.area     = currentNode;
     this.arealist = arealist;
     if (currentNode != null)
     {
         List <area> allNodes = IdalCommon.IareaEx.getAreaByParentId(currentNode.id); //获取属于这个节点的子节点
         foreach (area an in allNodes)                                                //遍历当前节点下的所有子节点
         {
             AreaTree at = new AreaTree(an, arealist);
             at.@checked = false;
             if (arealist.Where(p => p.id == an.id).Count() > 0)
             {
                 at.@checked = true;
             }
             this.children.Add(at);//递归创建子节点
         }
     }
 }