Exemplo n.º 1
0
 public int GetCategoryTopId(GgcmsCategories info)
 {
     if (info.ParentId == 0)
     {
         return(info.Id);
     }
     else
     {
         return(GetCategoryTopId(Categories(info.ParentId)));
     }
 }
Exemplo n.º 2
0
        public static int[] GetCategoryIds(GgcmsCategories category)
        {
            List <int> ids = new List <int>();

            ids.Add(category.Id);
            if (category.subCategory.Count > 0)
            {
                foreach (var item in category.subCategory)
                {
                    int[] tmps = GetCategoryIds(item);
                    ids.AddRange(tmps);
                }
            }
            return(ids.ToArray());
        }
Exemplo n.º 3
0
        //获取分类列表
        public List <GgcmsCategories> Categories(params int[] values)
        {
            List <GgcmsCategories> all = Categories();

            List <GgcmsCategories> list = new List <GgcmsCategories>();

            foreach (int cid in values)
            {
                var item = GgcmsCategories.GetCategoryById(cid, all);
                if (item != null)
                {
                    list.Add(item);
                }
            }
            return(list);
        }
Exemplo n.º 4
0
        //获取单个分类
        public GgcmsCategories Categories(string id)
        {
            List <GgcmsCategories> list = Categories();

            return(GgcmsCategories.GetCategoryByKey(id, list));
        }
Exemplo n.º 5
0
        //获取单个分类
        public GgcmsCategories Categories(int id)
        {
            List <GgcmsCategories> list = Categories();

            return(GgcmsCategories.GetCategoryById(id, list));
        }