Пример #1
0
        private void BtnGetBestOffers_Click(object sender, System.EventArgs e)
        {
            try
            {
                LstBestOffers.Items.Clear();

                GetBestOffersCall apicall = new GetBestOffersCall(Context);

                if (TxtBestOfferID.Text.Length > 0)
                {
                    apicall.BestOfferID = TxtBestOfferID.Text;
                }

                apicall.BestOfferStatus = (BestOfferStatusCodeType)Enum.Parse(typeof(BestOfferStatusCodeType), CboFilter.SelectedItem.ToString());

                apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
                string ItemID = TxtItemID.Text;
                BestOfferTypeCollection bestoffers = apicall.GetBestOffers(ItemID);

                TxtTitle.Text         = apicall.Item.Title;
                TxtLocation.Text      = apicall.Item.Location;
                TxtEndTime.Text       = apicall.Item.ListingDetails.EndTime.ToString();
                TxtBuyItNowPrice.Text = apicall.Item.BuyItNowPrice.Value.ToString();
                TxtCurrency.Text      = apicall.Item.BuyItNowPrice.currencyID.ToString();

                foreach (BestOfferType bestoffer in bestoffers)
                {
                    string[] listparams = new string[11];
                    listparams[0]  = bestoffer.BestOfferID;
                    listparams[1]  = bestoffer.ExpirationTime.ToString();
                    listparams[2]  = bestoffer.Price != null ?(bestoffer.Price.Value.ToString()):"";
                    listparams[3]  = bestoffer.Status.ToString();
                    listparams[4]  = bestoffer.Quantity.ToString();
                    listparams[5]  = bestoffer.Buyer.FeedbackScore.ToString();
                    listparams[6]  = bestoffer.Buyer.RegistrationDate.ToString();
                    listparams[7]  = bestoffer.Buyer.UserID;
                    listparams[8]  = bestoffer.Buyer.Email;
                    listparams[9]  = bestoffer.BuyerMessage;
                    listparams[10] = bestoffer.SellerMessage;


                    ListViewItem vi = new ListViewItem(listparams);
                    this.LstBestOffers.Items.Add(vi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void GetBestOffers()
        {
            Assert.IsNotNull(TestData.NewItem, "Failed because no item available -- requires successful AddItem test");
            //
            GetBestOffersCall api = new GetBestOffersCall(this.apiContext);

            api.ItemID          = TestData.NewItem.ItemID;
            api.BestOfferStatus = BestOfferStatusCodeType.All;
            // Make API call.
            ApiException gotException = null;

            try
            {
                /* BestOfferTypeCollection offers =*/ api.Execute();
            }
            catch (ApiException ex)
            {
                gotException = ex;
            }
            Assert.IsNotNull(gotException);
        }
Пример #3
0
        public IHttpActionResult GetSellerItems()
        {
            //[Step 1] Initialize eBay ApiContext object
            apiContext = GetApiContext();

            GetSellerListCall call = new GetSellerListCall(apiContext);

            call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            call.Pagination = new PaginationType()
            {
                EntriesPerPage = 200
            };
            call.EndTimeFrom = DateTime.UtcNow.AddDays(-1);
            call.EndTimeTo   = DateTime.UtcNow.AddDays(30);

            call.IncludeWatchCount = true;

            ItemTypeCollection items = call.GetSellerList();

            foreach (ItemType item in items)
            {
                try
                {
                    List <ZohoLead> leads = new List <ZohoLead>();

                    GetMemberMessagesCall messages = new GetMemberMessagesCall(apiContext);
                    messages.GetMemberMessages(item.ItemID, MessageTypeCodeType.AskSellerQuestion, MessageStatusTypeCodeType.Unanswered);

                    foreach (MemberMessageExchangeType message in messages.MemberMessageList)
                    {
                        leads = GetMemberMessageLead(leads, item, message);
                    }

                    if (item.BestOfferEnabled)
                    {
                        GetBestOffersCall boCall = new GetBestOffersCall(apiContext);
                        boCall.GetBestOffers(item.ItemID, null, BestOfferStatusCodeType.All, new PaginationType()
                        {
                            EntriesPerPage = 200
                        });
                        foreach (BestOfferType offer in boCall.BestOfferList)
                        {
                            leads = GetBestOfferLead(leads, item, offer);
                        }
                    }

                    GetAllBiddersCall bidderCall = new GetAllBiddersCall(apiContext);
                    var bidders = bidderCall.GetAllBidders(item.ItemID, GetAllBiddersModeCodeType.ViewAll);
                    foreach (OfferType bidder in bidders)
                    {
                        leads = GetBidderLead(leads, item, bidder);
                    }

                    if (leads.Count > 0)
                    {
                        leads = GetLeadInformation(leads);
                        InsertZohoLeads(leads);
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceError(ex.Message);
                }
            }

            return(Ok());
        }