Пример #1
0
 /// <summary>
 /// TOP API: taobao.itemcats.get
 /// </summary>
 public PageList<ItemCat> ItemcatsGet(ItemcatsGetRequest request, string session)
 {
     return client.Execute(request, new ListXmlParser<ItemCat>(new ParseData(request.GetApiName(), "item_cats", "item_cat")), session);
 }
Пример #2
0
 /// <summary>
 /// 获取相关父类下子类别的数量
 /// </summary>
 /// <param name="parentid"></param>
 /// <returns></returns>
 public static long GetItemCatCount(long parentid)
 {
     ItemcatsGetRequest igr = new ItemcatsGetRequest();
     igr.Fields = "cid,parent_cid,name,is_parent,status,sort_order";
     igr.ParentCid = parentid;
     PageList<ItemCat> pageitems = client.ItemcatsGet(igr);
     return pageitems.TotalResults;
 }
Пример #3
0
 /// <summary>
 /// 根据类别获取同级类别集合
 /// </summary>
 public static ItemCat GetItemCatInfo(long cid)
 {
     ItemcatsGetRequest igr = new ItemcatsGetRequest();
     igr.Fields = "cid,parent_cid,name,is_parent,status,sort_order";
     igr.Cids = cid.ToString();
     PageList<ItemCat> pageitems = client.ItemcatsGet(igr);
     ItemCat icinfo = new ItemCat();
     if (pageitems.Content.Count > 0) icinfo = pageitems.Content[0];
     return icinfo;
 }
Пример #4
0
 /// <summary>
 /// 获取类目列表
 /// </summary>
 public static List<ItemCat> GetItemCatCache(long cid)
 {
     SAS.Cache.SASCache cache = SAS.Cache.SASCache.GetCacheService();
     List<ItemCat> itemcatlist = cache.RetrieveObject("/SAS/Taobao/ItemCats_" + cid) as List<ItemCat>;
     //List<ItemCat> itemcatlist = SAS.Cache.WebCacheFactory.GetWebCache().Get("/SAS/Taobao/ItemCats_" + cid) as List<ItemCat>;
     if (itemcatlist == null)
     {
         ItemcatsGetRequest igr = new ItemcatsGetRequest();
         igr.Fields = "cid,parent_cid,name,is_parent,status,sort_order";
         igr.ParentCid = cid;
         try
         {
             PageList<ItemCat> pageitems = client.ItemcatsGet(igr);
             itemcatlist = pageitems.Content;
             cache.AddObject("/SAS/Taobao/ItemCats_" + cid, itemcatlist);
             //SAS.Cache.WebCacheFactory.GetWebCache().Add("/SAS/Taobao/ItemCats_" + cid, itemcatlist);
         }
         catch (NTWException e)
         {
             return null;
         }
     }
     return itemcatlist;
 }