Example #1
0
        public ActionResult GetTreeListJson(string queryJson)
        {
            var data = goodstypebll.GetList(queryJson).ToList();

            if (data.Count <= 1)
            {
                return(Content(data.ToJson()));
            }
            else
            {
                var treeList = new List <TreeGridEntity>();
                foreach (GoodstypeEntity item in data)
                {
                    TreeGridEntity tree        = new TreeGridEntity();
                    bool           hasChildren = data.Count(t => t.frootid == item.ftypecode) == 0 ? false : true;
                    tree.id          = item.ftypecode;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item.fparentcode;
                    tree.expanded    = true;
                    tree.entityJson  = item.ToJson();
                    treeList.Add(tree);
                }
                return(Content(treeList.TreeJson()));
            }
        }
Example #2
0
        /// <summary>
        /// 部门列表
        /// </summary>
        /// <returns></returns>
        public IEnumerable <GoodstypeEntity> GetList()
        {
            var cacheList = CacheFactory.Cache().GetCache <IEnumerable <GoodstypeEntity> >(busines.cacheKey);

            if (cacheList == null)
            {
                var data = busines.GetList();
                CacheFactory.Cache().WriteCache(data, busines.cacheKey);
                return(data);
            }
            else
            {
                return(cacheList);
            }
        }