Exemplo n.º 1
0
        /// <summary>
        /// 获取里程碑树形列表
        /// </summary>
        /// <returns></returns>
        public Result <List <MilepostView> > GetMilepostViewList()
        {
            List <MilepostView>           list   = new List <MilepostView>();
            Result <List <MilepostView> > result = new Result <List <MilepostView> >();

            try
            {
                var temp = DataOperateBusiness <Epm_Milepost> .Get().GetList(t => t.ParentId == 0).OrderBy(t => t.Sort).ToList();

                if (temp.Count > 0)
                {
                    foreach (var item in temp)
                    {
                        MilepostView rootTree = new MilepostView();
                        rootTree = GetMilepostTree(item.Id);
                        list.Add(rootTree);
                    }
                }
                result.Data = list;
                result.Flag = EResultFlag.Success;
            }
            catch (Exception ex)
            {
                result.Data      = null;
                result.Flag      = EResultFlag.Failure;
                result.Exception = new ExceptionEx(ex, "GetMilepostViewList");
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取权限树
        /// </summary>
        /// <param name="belong"></param>
        /// <param name="pId"></param>
        /// <returns></returns>
        public MilepostView GetMilepostTree(long pId)
        {
            List <Epm_Milepost> result = new List <Epm_Milepost>();

            result = DataOperateBusiness <Epm_Milepost> .Get().GetList().OrderBy(t => t.Sort).ToList();

            MilepostView rootTree = new MilepostView();

            //var first = result.FirstOrDefault(i => i.Id == pId);

            //rootTree.checkboxValue = first.Id.ToString();
            //rootTree.Code = first.Code;
            //rootTree.Name = first.Name;
            //rootTree.Sort = first.Sort;
            //rootTree.State = first.State;
            //rootTree.parentId = first.ParentId.ToString();

            //var tree = createTree(first.Id, result);

            //rootTree.children = tree;
            return(rootTree);;
        }