public void GetCategoryListings() { GetCategoryListingsCall api = new GetCategoryListingsCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); //api.CategoryID = "37906"; api.CategoryID = "279"; api.ItemTypeFilter = ItemTypeFilterCodeType.AllItems; api.Currency = CurrencyCodeType.USD; api.OrderBy = CategoryListingsOrderCodeType.SortByPriceAsc; // Pagination PaginationType pt = new PaginationType(); pt.EntriesPerPage = 50; pt.EntriesPerPageSpecified = true; pt.PageNumber = 1; pt.PageNumberSpecified = true; api.Pagination = pt; // Make API call. ItemTypeCollection items = api.GetCategoryListings(api.CategoryID); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!"); Assert.IsNotNull(items); Assert.IsTrue(items.Count > 0); TestData.CategoryListings = items; }
private void BtnGetCategoryListings_Click(object sender, System.EventArgs e) { try { LstSearchResults.Items.Clear(); GetCategoryListingsCall apicall = new GetCategoryListingsCall(Context); if (TxtRegion.Text.Length > 0 || CboSiteFilter.SelectedIndex > 0) { apicall.SearchLocation = new SearchLocationType(); apicall.SearchLocation.RegionID = TxtRegion.Text; if (CboSiteFilter.SelectedIndex > 0) { apicall.SearchLocation.SiteLocation = new SiteLocationType(); apicall.SearchLocation.SiteLocation.SiteID = (SiteIDFilterCodeType)Enum.Parse(typeof(SiteIDFilterCodeType), CboSiteFilter.SelectedItem.ToString()); } } if (CboItemFilter.SelectedIndex > 0) { apicall.ItemTypeFilter = (ItemTypeFilterCodeType)Enum.Parse(typeof(ItemTypeFilterCodeType), CboItemFilter.SelectedItem.ToString()); } if (CboSearchType.SelectedIndex > 0) { apicall.SearchType = (CategoryListingsSearchCodeType)Enum.Parse(typeof(CategoryListingsSearchCodeType), CboSearchType.SelectedItem.ToString()); } if (CboSort.SelectedIndex > 0) { apicall.OrderBy = (CategoryListingsOrderCodeType)Enum.Parse(typeof(CategoryListingsOrderCodeType), CboSort.SelectedItem.ToString()); } ItemTypeCollection fnditems = apicall.GetCategoryListings(TxtCategory.Text); foreach (ItemType fnditem in fnditems) { string[] listparams = new string[5]; listparams[0] = fnditem.ItemID; listparams[1] = fnditem.Title; listparams[2] = fnditem.SellingStatus.CurrentPrice.Value.ToString(); listparams[3] = fnditem.SellingStatus.BidCount.ToString(); listparams[4] = DateTime.Now.ToString(); ListViewItem vi = new ListViewItem(listparams); LstSearchResults.Items.Add(vi); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }