Пример #1
0
        public static List <GoodsClassInfo> GetRelationList(List <GoodsClassInfo> list, int intParentID)
        {
            List <GoodsClassInfo> list2 = list.FindAll((GoodsClassInfo parameterA) => parameterA.ParentID == intParentID);
            List <GoodsClassInfo> list3 = new List <GoodsClassInfo>();
            int num = 0;

            foreach (GoodsClassInfo current in list2)
            {
                if (num == list2.Count - 1)
                {
                    current.ClassName = ((current.ParentID == 0) ? "" : StringUtils.GetCatePrefix(current.Depth - 1, true)) + current.ClassName;
                }
                else
                {
                    current.ClassName = ((current.ParentID == 0) ? "" : StringUtils.GetCatePrefix(current.Depth - 1, false)) + current.ClassName;
                }
                list3.Add(current);
                if (current.ChildCount > 0)
                {
                    list3.AddRange(GoodsClass.GetRelationList(list, current.AutoID));
                }
                num++;
            }
            return(list3);
        }
Пример #2
0
        public static List <GoodsClassInfo> GetCateTreeList()
        {
            List <GoodsClassInfo> obj  = (List <GoodsClassInfo>)GoodsClass.GetAllList();
            List <GoodsClassInfo> list = JObject.DeepClone <List <GoodsClassInfo> >(obj);

            return(GoodsClass.GetRelationList(list, 0));
        }