public void GetMyeBayBuying() { GetMyeBayBuyingCall api = new GetMyeBayBuyingCall(this.apiContext); if (this.apiContext.SoapApiServerUrl.IndexOf("sandbox") != -1) return; GetMyeBayBuyingRequestType req = new GetMyeBayBuyingRequestType(); api.ApiRequest = req; ItemListCustomizationType lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.BestOfferList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.BidCount; req.BidList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.EndTime; req.LostList = lc; lc = new ItemListCustomizationType(); lc.Include = true; lc.IncludeSpecified = true; lc.IncludeNotes = true; lc.IncludeNotesSpecified = true; lc.Sort = ItemSortTypeCodeType.Price; req.WonList = lc; MyeBaySelectionType selection = new MyeBaySelectionType(); selection.Include = true; selection.IncludeSpecified = true; selection.Sort = SortOrderCodeType.Ascending; req.FavoriteSearches = selection; MyeBaySelectionType sellerSel = new MyeBaySelectionType(); sellerSel.Include = true; sellerSel.IncludeSpecified = true; sellerSel.Sort = SortOrderCodeType.Ascending; req.FavoriteSellers = sellerSel; // Make API call. api.GetMyeBayBuying(); GetMyeBayBuyingResponseType resp = api.ApiResponse; }
private void BtnGetMyeBayBuyingCall_Click(object sender, System.EventArgs e) { try { LstBid.Items.Clear(); LstWatchItems.Items.Clear(); LstWonItems.Items.Clear(); LstLostItems.Items.Clear(); GetMyeBayBuyingCall apicall = new GetMyeBayBuyingCall(Context); PaginationType pageInfo = null; if (TxtMaxItems.Text !=null && TxtMaxItems.Text.Length >0) { pageInfo = new PaginationType(); pageInfo.EntriesPerPage = Int32.Parse(TxtMaxItems.Text); } apicall.BidList = new ItemListCustomizationType(); apicall.BidList.Sort = (ItemSortTypeCodeType) Enum.Parse(typeof(ItemSortTypeCodeType), CboBidItemSort.SelectedItem.ToString()); apicall.WatchList = new ItemListCustomizationType(); apicall.WatchList.Sort = (ItemSortTypeCodeType) Enum.Parse(typeof(ItemSortTypeCodeType), CboWatchSort.SelectedItem.ToString()); apicall.WonList = new ItemListCustomizationType(); apicall.WonList.Sort = (ItemSortTypeCodeType) Enum.Parse(typeof(ItemSortTypeCodeType), CboWonSort.SelectedItem.ToString()); apicall.LostList = new ItemListCustomizationType(); apicall.LostList.Sort = (ItemSortTypeCodeType) Enum.Parse(typeof(ItemSortTypeCodeType), CboLostSort.SelectedItem.ToString()); if (pageInfo != null) { apicall.BidList.Pagination = pageInfo; apicall.WatchList.Pagination = pageInfo; apicall.WonList.Pagination = pageInfo; apicall.LostList.Pagination = pageInfo; } apicall.GetMyeBayBuying(); if (apicall.BidListReturn != null) { if (apicall.BidListReturn.ItemArray.Count > 0) { foreach (ItemType bidItem in apicall.BidListReturn.ItemArray) { string[] listparams = new string[5]; listparams[0] = bidItem.ItemID; listparams[1] = bidItem.Title; if (bidItem.SellingStatus != null ) { listparams[2] = bidItem.SellingStatus.CurrentPrice.Value.ToString(); listparams[3] = bidItem.SellingStatus.BidCount.ToString(); listparams[4] = bidItem.ListingDetails.EndTime.ToString(); } ListViewItem vi = new ListViewItem(listparams); LstBid.Items.Add(vi); } } } if (apicall.WatchListReturn != null && apicall.WatchListReturn.ItemArray != null && apicall.WatchListReturn.ItemArray.Count > 0) { foreach (ItemType watchItem in apicall.WatchListReturn.ItemArray) { string[] listparams = new string[5]; listparams[0] = watchItem.ItemID; listparams[1] = watchItem.Title; if (watchItem.SellingStatus != null ) { listparams[2] = watchItem.SellingStatus.CurrentPrice.Value.ToString(); listparams[3] = watchItem.SellingStatus.BidCount.ToString(); listparams[4] = watchItem.ListingDetails.EndTime.ToString(); } ListViewItem vi = new ListViewItem(listparams); LstWatchItems.Items.Add(vi); } } if (apicall.WonListReturn != null && apicall.WonListReturn.OrderTransactionArray != null && apicall.WonListReturn.OrderTransactionArray.Count > 0) { foreach (OrderTransactionType wonitem in apicall.WonListReturn.OrderTransactionArray) { string[] listparams = new string[5]; if (wonitem.Transaction != null ) { listparams[0] = wonitem.Transaction.Item.ItemID; listparams[1] = wonitem.Transaction.Item.Title; if (wonitem.Transaction.Item.SellingStatus != null ) { listparams[2] = wonitem.Transaction.Item.SellingStatus.CurrentPrice.Value.ToString(); if (wonitem.Transaction.Item.SellingStatus.BidCount >0 ) listparams[3] = wonitem.Transaction.Item.SellingStatus.BidCount.ToString(); if (wonitem.Transaction.Item.ListingDetails != null) listparams[4] = wonitem.Transaction.Item.ListingDetails.EndTime.ToString(); } ListViewItem vi = new ListViewItem(listparams); LstWonItems.Items.Add(vi); } else if (wonitem.Order != null) { foreach (TransactionType transaction in wonitem.Order.TransactionArray) { listparams[0] = transaction.Item.ItemID; listparams[1] = transaction.Item.Title; if (transaction.Item.SellingStatus != null ) { listparams[2] = transaction.Item.SellingStatus.CurrentPrice.Value.ToString(); if (transaction.Item.SellingStatus.BidCount >0 ) listparams[3] = transaction.Item.SellingStatus.BidCount.ToString(); if (transaction.Item.ListingDetails != null) listparams[4] = transaction.Item.ListingDetails.EndTime.ToString(); } ListViewItem vi = new ListViewItem(listparams); LstWonItems.Items.Add(vi); } } } } if (apicall.LostListReturn != null && apicall.LostListReturn.ItemArray != null && apicall.LostListReturn.ItemArray.Count > 0) { foreach (ItemType lostitem in apicall.LostListReturn.ItemArray) { string[] listparams = new string[5]; listparams[0] = lostitem.ItemID; listparams[1] = lostitem.Title; if (lostitem.SellingStatus != null ) { listparams[2] = lostitem.SellingStatus.CurrentPrice.Value.ToString(); listparams[3] = lostitem.SellingStatus.BidCount.ToString(); listparams[4] = lostitem.ListingDetails.EndTime.ToString(); } ListViewItem vi = new ListViewItem(listparams); LstLostItems.Items.Add(vi); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { //get request parameter StringCollection itemIds = new StringCollection(); String itemId = Request.QueryString["itemId"]; itemIds.Add(itemId); //create AddToWatchListCall object AddToWatchListCall addToWatchListCall = new AddToWatchListCall(apiContext); try { //call AddToWatchList service addToWatchListCall.AddToWatchList(itemIds, null); //create GetMyeBayBuyingCall object GetMyeBayBuyingCall getMyeBayBuyingCall = new GetMyeBayBuyingCall(apiContext); //configure call parameters DetailLevelCodeTypeCollection level = new DetailLevelCodeTypeCollection(); level.Add(DetailLevelCodeType.ReturnAll); getMyeBayBuyingCall.DetailLevelList = level; //call GetMyeBayBuying service getMyeBayBuyingCall.GetMyeBayBuying(); //show result if (getMyeBayBuyingCall.WatchListReturn != null) { ItemTypeCollection items = getMyeBayBuyingCall.WatchListReturn.ItemArray; if (items != null) { // watching count watchCount.Text = "Total number of watching items : " + items.Count; //title TableRow titlerow = new TableRow(); TableHeaderCell titlecell0 = new TableHeaderCell(); titlecell0.Text = "Item ID"; titlecell0.BorderWidth = 1; titlerow.Cells.Add(titlecell0); TableHeaderCell titlecell1 = new TableHeaderCell(); titlecell1.Text = "Garrlery"; titlecell1.BorderWidth = 1; titlerow.Cells.Add(titlecell1); TableHeaderCell titlecell2 = new TableHeaderCell(); titlecell2.Text = "Title(Click to view item on eBay)"; titlecell2.BorderWidth = 1; titlerow.Cells.Add(titlecell2); TableHeaderCell titlecell3 = new TableHeaderCell(); titlecell3.Text = "Current Price"; titlecell3.BorderWidth = 1; titlerow.Cells.Add(titlecell3); watchList.Rows.Add(titlerow); //data for (int i = 0; i < items.Count; i++) { TableRow tblrow = new TableRow(); for (int j = 0; j < 1; j++) { TableCell tblcell0 = new TableCell(); tblcell0.Text = items[i].ItemID; tblcell0.BorderWidth = 1; tblrow.Cells.Add(tblcell0); TableCell tblcell1 = new TableCell(); if (items[i].PictureDetails != null) { tblcell1.Text = "<img src=" + items[i].PictureDetails.GalleryURL + ">"; } tblcell1.BorderWidth = 1; tblrow.Cells.Add(tblcell1); TableCell tblcell2 = new TableCell(); tblcell2.Text = "<a href=" + items[i].ListingDetails.ViewItemURL + ">" + items[i].Title + "</a>"; tblcell2.BorderWidth = 1; tblrow.Cells.Add(tblcell2); TableCell tblcell3 = new TableCell(); tblcell3.Text = "$" + items[i].SellingStatus.CurrentPrice.Value.ToString(); tblcell3.BorderWidth = 1; tblrow.Cells.Add(tblcell3); } watchList.Rows.Add(tblrow); } } } } catch (Exception exc) { errorMsg.Text = exc.Message; } }