public void GetSellerList()
 {
     Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test");
     //
     GetSellerListCall gsl = new GetSellerListCall(this.apiContext);
     DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                                                                        DetailLevelCodeType.ReturnAll
                                                                    };
     gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
     // Time filter
     System.DateTime calTo = System.DateTime.Now.AddHours(1);
     System.DateTime calFrom = System.DateTime.Now.AddHours(-2);
     TimeFilter tf = new TimeFilter(calFrom, calTo);
     gsl.EndTimeFilter = tf;
     // Pagination
     PaginationType pt = new PaginationType();
     pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true;
     pt.PageNumber = 1; pt.PageNumberSpecified = true;
     gsl.Pagination = pt;
     //
     gsl.Execute();
     ItemTypeCollection items = gsl.ApiResponse.ItemArray;
     Assert.IsNotNull(items);
     Assert.IsTrue(items.Count > 0);
     ItemType foundItem = findItem(items, TestData.NewItem.ItemID);
     Assert.IsNotNull(foundItem, "item not found");
 }
        public void GetSellerListFull()
        {
            Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test");
            GetSellerListCall gsl = new GetSellerListCall(this.apiContext);
            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                                                                               DetailLevelCodeType.ReturnAll
                                                                           };

            //specify information
            gsl.AdminEndedItemsOnly=false;
            gsl.CategoryID=int.Parse(TestData.NewItem2.PrimaryCategory.CategoryID);
            gsl.StartTimeFrom=DateTime.Now.AddDays(-2);
            gsl.StartTimeTo=DateTime.Now.AddDays(1);
            //gsl.GranularityLevel=GranularityLevelCodeType.Fine;//if specify GranularityLevel, the DetailLevelList is ignored.
            gsl.IncludeWatchCount=true;
            gsl.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            // Pagination
            PaginationType pt = new PaginationType();
            pt.EntriesPerPage = 100;
            pt.EntriesPerPageSpecified = true;
            pt.PageNumber = 1;
            pt.PageNumberSpecified = true;
            gsl.Pagination = pt;
            gsl.Sort=1;//descending sort
            //
            gsl.Execute();

            //check whether the call is success.
            Assert.IsTrue(gsl.AbstractResponse.Ack==AckCodeType.Success || gsl.AbstractResponse.Ack==AckCodeType.Warning,"do not success!");
            ItemTypeCollection items = gsl.ApiResponse.ItemArray;
            Assert.IsNotNull(items);
            Assert.IsTrue(items.Count > 0);

            ItemType foundItem = findItem(items, TestData.NewItem2.ItemID);
            Assert.IsNotNull(foundItem, "item not found");

            ItemType item=items[0];
            Assert.IsNotNull(item.HitCount);
            Assert.IsNotNull(gsl.ApiResponse.PaginationResult);
            Assert.IsNotNull(gsl.ApiResponse.Seller);
        }
Beispiel #3
0
        private void BtnGetSellerList_Click(object sender, System.EventArgs e)
        {
            try
            {
                LstItems.Items.Clear();

                GetSellerListCall apicall = new GetSellerListCall(Context);
                apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

                //Pagination is required
                apicall.Pagination = new PaginationType();
                apicall.Pagination.PageNumber = 1;
                apicall.Pagination.EntriesPerPage = 200;

                if (TxtUserId.Text.Length > 0)
                    apicall.UserID = TxtUserId.Text;

                if (OptStartTime.Checked == true)
                {
                    apicall.StartTimeFilter = new TimeFilter(DatePickStartFrom.Value, DatePickStartTo.Value);
                }
                else if (OptEndTime.Checked == true)
                {
                    apicall.EndTimeFilter = new TimeFilter(DatePickEndFrom.Value, DatePickEndTo.Value);
                }

                ItemTypeCollection sellerlist = apicall.GetSellerList();

                foreach (ItemType item in sellerlist)
                {
                    string[] listparams = new string[6];
                    listparams[0] = item.ItemID;
                    listparams[1] = item.Title;
                    listparams[2] = item.SellingStatus.CurrentPrice.Value.ToString();
                    listparams[3] = item.SellingStatus.QuantitySold.ToString();
                    listparams[4] = item.SellingStatus.BidCount.ToString();

                    if (item.BestOfferDetails != null)
                        listparams[5] = item.BestOfferDetails.BestOfferEnabled.ToString();
                    else
                        listparams[5] = "False";

                    ListViewItem vi = new ListViewItem(listparams);
                    LstItems.Items.Add(vi);

                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }