public List <Ware> GetWareList(Nullable <Int64> cid, Nullable <Decimal> startPrice, Nullable <Decimal> endPrice, String title, Int32 page, Int32 pageSize, out Decimal totalCount, bool recursive) { try { WaresSearchRequest request = new WaresSearchRequest(); request.Cid = cid; request.StartPrice = startPrice; request.EndPrice = endPrice; request.Page = page; request.Title = title; request.PageSize = pageSize; WaresSearchResponse response = Client.Execute(request, AppContext.AccessToken.Token); List <Ware> list = new List <Ware>(); if (!response.IsError) { if (response.Wares == null || response.Wares.Count == 0) { totalCount = 0; return(list); } list.AddRange(response.Wares); if (recursive && page * pageSize < response.Total) { list.AddRange(GetWareList(cid, startPrice, endPrice, title, ++page, pageSize, out totalCount, true)); } totalCount = response.Total; return(list); } else { throw new Exception(response.ErrCode + ":" + response.ErrMsg); } } catch (Exception ex) { throw ex; } }
public List<Ware> GetWareList(Nullable<Int64> cid, Nullable<Decimal> startPrice, Nullable<Decimal> endPrice, String title, Int32 page, Int32 pageSize, out Decimal totalCount, bool recursive) { try { WaresSearchRequest request = new WaresSearchRequest(); request.Cid = cid; request.StartPrice = startPrice; request.EndPrice = endPrice; request.Page = page; request.Title = title; request.PageSize = pageSize; WaresSearchResponse response = Client.Execute(request, AppContext.AccessToken.Token); List<Ware> list = new List<Ware>(); if (!response.IsError) { if (response.Wares == null || response.Wares.Count == 0) { totalCount = 0; return list; } list.AddRange(response.Wares); if (recursive && page * pageSize < response.Total) { list.AddRange(GetWareList(cid, startPrice, endPrice, title, ++page, pageSize, out totalCount, true)); } totalCount = response.Total; return list; } else { throw new Exception(response.ErrCode + ":" + response.ErrMsg); } } catch (Exception ex) { throw ex; } }