예제 #1
0
        } // GetMyActiveListing

        public static string GetMyEbaySelling(AccountType account)
        {
            if (account.SellerApiContext == null)
            {
                return(null);
            }

            GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary };
            getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);

            getMyeBaySellingApiCall.SellingSummary         = new eBay.Service.Core.Soap.ItemListCustomizationType();
            getMyeBaySellingApiCall.SellingSummary.Include = true;

            getMyeBaySellingApiCall.ActiveList              = new eBay.Service.Core.Soap.ItemListCustomizationType();
            getMyeBaySellingApiCall.ActiveList.Include      = true;
            getMyeBaySellingApiCall.ActiveList.IncludeNotes = true;
            getMyeBaySellingApiCall.ActiveList.ListingType  = ListingTypeCodeType.FixedPriceItem;
            getMyeBaySellingApiCall.ActiveList.Pagination   = new PaginationType();
            getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 10;
            getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber     = 1;

            getMyeBaySellingApiCall.GetMyeBaySelling();

            AmountType amountLimitRemaining   = getMyeBaySellingApiCall.Summary.AmountLimitRemaining;
            long       quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining;

            PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn;

            return(null);
        }
예제 #2
0
        public void GetMyeBaySelling()
        {
            GetMyeBaySellingCall        api = new GetMyeBaySellingCall(this.apiContext);
            GetMyeBaySellingRequestType req = new GetMyeBaySellingRequestType();

            api.ApiRequest = req;
            ItemListCustomizationType lc = new ItemListCustomizationType();

            lc.Include      = true; lc.IncludeSpecified = true;
            lc.IncludeNotes = true; lc.IncludeNotesSpecified = true;
            lc.Sort         = ItemSortTypeCodeType.BidCount;
            req.ActiveList  = lc;
            lc                = new ItemListCustomizationType();
            lc.Include        = true; lc.IncludeSpecified = true;
            lc.IncludeNotes   = true; lc.IncludeNotesSpecified = true;
            lc.Sort           = ItemSortTypeCodeType.Price;
            req.SoldList      = lc;
            lc                = new ItemListCustomizationType();
            lc.Include        = true; lc.IncludeSpecified = true;
            lc.IncludeNotes   = true; lc.IncludeNotesSpecified = true;
            lc.Sort           = ItemSortTypeCodeType.EndTime;
            req.UnsoldList    = lc;
            lc                = new ItemListCustomizationType();
            lc.Include        = true; lc.IncludeSpecified = true;
            lc.IncludeNotes   = true; lc.IncludeNotesSpecified = true;
            lc.Sort           = ItemSortTypeCodeType.StartTime;
            req.ScheduledList = lc;
            // Make API call.
            api.GetMyeBaySelling();
            GetMyeBaySellingResponseType resp = api.ApiResponse;
        }
예제 #3
0
        private static void RefreshEbayData(object sender, EventArgs eventArgs)
        {
            var apicall = new GetMyeBaySellingCall(_apiContext);

            apicall.ActiveList      = new ItemListCustomizationType();
            apicall.ActiveList.Sort = ItemSortTypeCodeType.EndTime;
            apicall.SoldList        = new ItemListCustomizationType();
            apicall.SoldList.Sort   = ItemSortTypeCodeType.EndTime;

            apicall.ActiveList.Pagination = new PaginationType {
                EntriesPerPage = 100
            };
            apicall.SoldList.Pagination = new PaginationType {
                EntriesPerPage = 100
            };

            apicall.GetMyeBaySelling();

            ActiveList = apicall.ActiveListReturn.ItemArray;
            SoldList   = apicall.SoldListReturn.OrderTransactionArray;
        }
예제 #4
0
        private static void RefreshEbayData(object state)
        {
            //eBayAPIInterfaceService faf = new eBayAPIInterfaceService();
            //faf.SoapRequest
            var apicall = new GetMyeBaySellingCall(_apiContext);

            apicall.ActiveList      = new ItemListCustomizationType();
            apicall.ActiveList.Sort = ItemSortTypeCodeType.EndTime;
            apicall.SoldList        = new ItemListCustomizationType();
            apicall.SoldList.Sort   = ItemSortTypeCodeType.EndTime;

            apicall.ActiveList.Pagination = new PaginationType {
                EntriesPerPage = 500
            };
            apicall.SoldList.Pagination = new PaginationType {
                EntriesPerPage = 500
            };

            apicall.GetMyeBaySelling();

            ActiveList = apicall.ActiveListReturn.ItemArray;
            SoldList   = apicall.SoldListReturn.OrderTransactionArray;
        }
예제 #5
0
        public static void GetMyeBaySelling(AccountType sa, ISession NSession)
        {
            if (sa == null)
            {
                return;
            }
            ApiContext context = EBayUtil.GetGenericApiContext("US");

            context.ApiCredential.eBayToken = sa.ApiToken;
            GetMyeBaySellingCall apicall = new GetMyeBaySellingCall(context);

            apicall.ActiveList = new ItemListCustomizationType();
            int i = 1;

            DeleteALL(sa.AccountName, NSession);

            do
            {
                apicall.ActiveList.Pagination = new PaginationType();
                apicall.ActiveList.Pagination.EntriesPerPage = 200;
                apicall.ActiveList.Pagination.PageNumber     = i;
                apicall.GetMyeBaySelling();

                if (apicall.ActiveListReturn != null && apicall.ActiveListReturn.ItemArray != null && apicall.ActiveListReturn.ItemArray.Count > 0)
                {
                    foreach (ItemType actitem in apicall.ActiveListReturn.ItemArray)
                    {
                        try
                        {
                            if (actitem.SellingStatus != null)
                            {
                                EbayType ei = new EbayType();
                                ei.ItemId = actitem.ItemID;


                                ei.ItemTitle = actitem.Title;
                                ei.Price     = actitem.SellingStatus.CurrentPrice.Value.ToString();


                                ei.Currency   = actitem.SellingStatus.CurrentPrice.currencyID.ToString();
                                ei.StartNum   = actitem.Quantity;
                                ei.NowNum     = actitem.QuantityAvailable;
                                ei.ProductUrl = actitem.ListingDetails.ViewItemURL;
                                if (actitem.PictureDetails != null && actitem.PictureDetails.GalleryURL != null)
                                {
                                    ei.PicUrl = actitem.PictureDetails.GalleryURL;
                                }
                                ei.StartTime = actitem.ListingDetails.StartTime;
                                ei.Account   = sa.AccountName;
                                ei.Status    = "销售中";
                                ei.SKU       = "";
                                if (actitem.SKU != null)
                                {
                                    ei.SKU = actitem.SKU;
                                    if (ei.NowNum == 0)
                                    {
                                        ei.Status = "卖完";
                                    }
                                    NSession.Clear();
                                    ei.CreateOn = DateTime.Now;
                                    NSession.Save(ei);
                                    NSession.Flush();
                                }
                                else
                                {
                                    if (actitem.Variations != null)
                                    {
                                        foreach (VariationType v in actitem.Variations.Variation)
                                        {
                                            NSession.Clear();
                                            ei.SKU      = v.SKU;
                                            ei.StartNum = v.Quantity;
                                            ei.NowNum   = v.Quantity - v.SellingStatus.QuantitySold;
                                            ei.Status   = "销售中";
                                            if (ei.NowNum == 0)
                                            {
                                                ei.Status = "卖完";
                                            }
                                            ei.ItemTitle = v.VariationTitle;

                                            ei.CreateOn = DateTime.Now;
                                            NSession.Save(ei);
                                            NSession.Flush();
                                        }
                                    }
                                    else
                                    {
                                        ei.SKU = "";
                                        if (ei.NowNum == 0)
                                        {
                                            ei.Status = "卖完";
                                        }
                                        NSession.Clear();
                                        ei.CreateOn = DateTime.Now;
                                        NSession.Save(ei);
                                        NSession.Flush();
                                    }
                                }
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                    i++;
                    if (i > apicall.ActiveListReturn.PaginationResult.TotalNumberOfPages)
                    {
                        break;
                    }
                }
            } while (apicall.ActiveListReturn != null && apicall.ActiveListReturn.ItemArray != null && apicall.ActiveListReturn.ItemArray.Count == 200);
        }
예제 #6
0
        //
        // GetMyeBaySelling
        //  Use this call to return information from the All Selling section of the authenticated user's My eBay account.
        //      http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetMyeBaySelling.html
        //

        public static List <EbayActiveListingType> GetMyActiveListing(AccountType account)
        {
            if (account.SellerApiContext == null)
            {
                Logger.WriteSystemLog("Invalid API context in GetMyActiveListing.");
                return(null);
            }

            GetMyeBaySellingCall getMyeBaySellingApiCall = new GetMyeBaySellingCall(account.SellerApiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            getMyeBaySellingApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);

            getMyeBaySellingApiCall.SellingSummary         = new eBay.Service.Core.Soap.ItemListCustomizationType();
            getMyeBaySellingApiCall.SellingSummary.Include = true;

            getMyeBaySellingApiCall.ActiveList              = new eBay.Service.Core.Soap.ItemListCustomizationType();
            getMyeBaySellingApiCall.ActiveList.Include      = true;
            getMyeBaySellingApiCall.ActiveList.IncludeNotes = true;
            //getMyeBaySellingApiCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem;
            getMyeBaySellingApiCall.ActiveList.Pagination = new PaginationType();
            getMyeBaySellingApiCall.ActiveList.Pagination.EntriesPerPage = 25; // max 200 default 25
            getMyeBaySellingApiCall.ActiveList.Pagination.PageNumber     = 1;



            //getMyeBaySellingApiCall.BidList = new ItemListCustomizationType();
            //getMyeBaySellingApiCall.BidList.Include = true;
            //getMyeBaySellingApiCall.BidList.Pagination = new PaginationType();
            //getMyeBaySellingApiCall.BidList.Pagination.EntriesPerPage = 25;
            //getMyeBaySellingApiCall.BidList.Pagination.PageNumber = 1;

            getMyeBaySellingApiCall.GetMyeBaySelling();

            AmountType amountLimitRemaining   = getMyeBaySellingApiCall.Summary.AmountLimitRemaining;
            long       quantityLimitRemaining = getMyeBaySellingApiCall.Summary.QuantityLimitRemaining;

            PaginatedItemArrayType paginatedItemArray = getMyeBaySellingApiCall.ActiveListReturn;

            if (paginatedItemArray == null || paginatedItemArray.ItemArray == null)
            {
                return(null);
            }

            List <EbayActiveListingType> activeListings = new List <EbayActiveListingType>();

            foreach (ItemType item in paginatedItemArray.ItemArray)
            {
                EbayActiveListingType activeListing = new EbayActiveListingType();
                activeListing.ListId     = 0; // to be set
                activeListing.SellerName = account.ebayAccount;
                activeListing.ItemID     = StringUtil.GetSafeString(item.ItemID);
                activeListing.Title      = StringUtil.GetSafeString(item.Title);
                if (item.ListingTypeSpecified)
                {
                    if (ListingTypeCodeType.FixedPriceItem == item.ListingType)
                    {
                        activeListing.ListingType = "FixedPriceItem";
                    }
                    else if (ListingTypeCodeType.Auction == item.ListingType ||
                             ListingTypeCodeType.Chinese == item.ListingType)
                    {
                        activeListing.ListingType = "Auction";
                    }
                    else
                    {
                        activeListing.ListingType = "Unknown";
                    }
                }
                else
                {
                    activeListing.ListingType = "Unknown";
                }
                if (item.PictureDetails != null)
                {
                    activeListing.GalleryURL = StringUtil.GetSafeString(item.PictureDetails.GalleryURL);
                }
                else
                {
                    activeListing.GalleryURL = "";
                }

                if (item.BiddingDetails != null)
                {
                    activeListing.QuantityBid = StringUtil.GetSafeInt(item.BiddingDetails.QuantityBid);
                    if (item.BiddingDetails.MaxBid != null)
                    {
                        activeListing.MaxBid = StringUtil.GetSafeDouble(item.BiddingDetails.MaxBid.Value);
                    }
                    else
                    {
                        activeListing.MaxBid = 0.0;
                    }
                }
                else
                {
                    activeListing.QuantityBid = 0;
                    activeListing.MaxBid      = 0.0;
                }

                if (item.StartPrice != null)
                {
                    activeListing.StartPrice = StringUtil.GetSafeDouble(item.StartPrice.Value);
                }
                else
                {
                    activeListing.StartPrice = 0.0;
                }


                if (item.BuyItNowPrice != null)
                {
                    activeListing.BuyItNowPrice = StringUtil.GetSafeDouble(item.BuyItNowPrice.Value);
                    activeListing.CurrencyID    = StringUtil.GetSafeString(item.BuyItNowPrice.currencyID);
                }
                else
                {
                    activeListing.BuyItNowPrice = 0.0;
                    activeListing.CurrencyID    = "";
                }

                if (item.ListingDetails != null)
                {
                    activeListing.StartTime   = StringUtil.GetSafeDateTime(item.ListingDetails.StartTime);
                    activeListing.EndTime     = StringUtil.GetSafeDateTime(item.ListingDetails.EndTime);
                    activeListing.ViewItemURL = StringUtil.GetSafeString(item.ListingDetails.ViewItemURL);
                }

                activeListing.ListDuration      = StringUtil.GetSafeInt(StringUtil.GetSafeListDurationDays(item.ListingDuration));
                activeListing.PrivateListing    = StringUtil.GetSafeBool(item.PrivateListing);
                activeListing.Quantity          = StringUtil.GetSafeInt(item.Quantity);
                activeListing.QuantityAvailable = StringUtil.GetSafeInt(item.QuantityAvailable);
                if (item.SellingStatus != null)
                {
                    if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Active)
                    {
                        activeListing.SellingStatus = "Active";
                    }
                    else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Completed)
                    {
                        activeListing.SellingStatus = "Completed";
                    }
                    else if (item.SellingStatus.ListingStatus == ListingStatusCodeType.Ended)
                    {
                        activeListing.SellingStatus = "Ended";
                    }
                    else
                    {
                        activeListing.SellingStatus = "Unknown";
                    }

                    if (item.SellingStatus.BidCountSpecified)
                    {
                        activeListing.BidCount = item.SellingStatus.BidCount;
                    }
                    else
                    {
                        activeListing.BidCount = 0;
                    }

                    if (item.SellingStatus.BidderCountSpecified)
                    {
                        activeListing.BidderCount = (int)item.SellingStatus.BidderCount;
                    }
                    else
                    {
                        activeListing.BidderCount = 0;
                    }

                    if (item.SellingStatus.CurrentPrice != null)
                    {
                        activeListing.CurrentPrice = item.SellingStatus.CurrentPrice.Value;
                    }
                    else
                    {
                        activeListing.CurrentPrice = 0.0;
                    }
                }
                else
                {
                    activeListing.SellingStatus = "Unknown";
                }
                activeListing.SKU        = StringUtil.GetSafeString(item.SKU);
                activeListing.TimeLeft   = StringUtil.GetSafeString(item.TimeLeft);
                activeListing.WatchCount = StringUtil.GetSafeInt(item.WatchCount);

                activeListings.Add(activeListing);
            }

            Logger.WriteSystemLog(string.Format("Successfully called GetMyActiveListing, returns {0} entries", activeListings.Count));
            return(activeListings);
        } // GetMyActiveListing
예제 #7
0
        private void BtnGetMyeBaySellingCall_Click(object sender, System.EventArgs e)
        {
            try
            {
                LstActive.Items.Clear();
                LstScheduled.Items.Clear();
                LstSold.Items.Clear();
                LstUnSold.Items.Clear();

                GetMyeBaySellingCall apicall = new GetMyeBaySellingCall(Context);

                PaginationType pageInfo = null;
                if (TxtMaxItems.Text != null && TxtMaxItems.Text.Length > 0)
                {
                    pageInfo = new PaginationType();
                    pageInfo.EntriesPerPage = Int32.Parse(TxtMaxItems.Text);
                }

                apicall.ActiveList         = new ItemListCustomizationType();
                apicall.ActiveList.Sort    = (ItemSortTypeCodeType)Enum.Parse(typeof(ItemSortTypeCodeType), CboActiveSort.SelectedItem.ToString());
                apicall.ScheduledList      = new ItemListCustomizationType();
                apicall.ScheduledList.Sort = (ItemSortTypeCodeType)Enum.Parse(typeof(ItemSortTypeCodeType), CboScheSort.SelectedItem.ToString());
                apicall.UnsoldList         = new ItemListCustomizationType();
                apicall.UnsoldList.Sort    = (ItemSortTypeCodeType)Enum.Parse(typeof(ItemSortTypeCodeType), CboUnSoldSort.SelectedItem.ToString());
                apicall.SoldList           = new ItemListCustomizationType();
                apicall.SoldList.Sort      = (ItemSortTypeCodeType)Enum.Parse(typeof(ItemSortTypeCodeType), CboSoldSort.SelectedItem.ToString());

                if (pageInfo != null)
                {
                    apicall.ActiveList.Pagination    = pageInfo;
                    apicall.UnsoldList.Pagination    = pageInfo;
                    apicall.ScheduledList.Pagination = pageInfo;
                    apicall.SoldList.Pagination      = pageInfo;
                }

                apicall.GetMyeBaySelling();

                if (apicall.ActiveListReturn != null &&
                    apicall.ActiveListReturn.ItemArray != null &&
                    apicall.ActiveListReturn.ItemArray.Count > 0)
                {
                    foreach (ItemType actitem in apicall.ActiveListReturn.ItemArray)
                    {
                        string[] listparams = new string[5];
                        listparams[0] = actitem.ItemID;
                        listparams[1] = actitem.Title;
                        if (actitem.SellingStatus != null)
                        {
                            listparams[2] = actitem.SellingStatus.CurrentPrice.Value.ToString();
                            listparams[3] = actitem.SellingStatus.BidCount.ToString();
                            listparams[4] = actitem.ListingDetails.EndTime.ToString();
                        }
                        ListViewItem vi = new ListViewItem(listparams);
                        LstActive.Items.Add(vi);
                    }
                }
                if (apicall.ScheduledListReturn != null &&
                    apicall.ScheduledListReturn.ItemArray != null &&
                    apicall.ScheduledListReturn.ItemArray.Count > 0)
                {
                    foreach (ItemType scheItem in apicall.ScheduledListReturn.ItemArray)
                    {
                        string[] listparams = new string[5];
                        listparams[0] = scheItem.ItemID;
                        listparams[1] = scheItem.Title;
                        if (scheItem.SellingStatus != null)
                        {
                            listparams[2] = scheItem.SellingStatus.CurrentPrice.Value.ToString();
                            listparams[3] = scheItem.SellingStatus.BidCount.ToString();
                            listparams[4] = scheItem.ListingDetails.EndTime.ToString();
                        }
                        ListViewItem vi = new ListViewItem(listparams);
                        LstScheduled.Items.Add(vi);
                    }
                }
                if (apicall.SoldListReturn != null &&
                    apicall.SoldListReturn.OrderTransactionArray != null &&
                    apicall.SoldListReturn.OrderTransactionArray.Count > 0)
                {
                    foreach (OrderTransactionType solditem in apicall.SoldListReturn.OrderTransactionArray)
                    {
                        string[] listparams = new string[5];
                        if (solditem.Transaction != null)
                        {
                            listparams[0] = solditem.Transaction.Item.ItemID;
                            listparams[1] = solditem.Transaction.Item.Title;
                            if (solditem.Transaction.Item.SellingStatus != null)
                            {
                                listparams[2] = solditem.Transaction.Item.SellingStatus.CurrentPrice.Value.ToString();
                                if (solditem.Transaction.Item.SellingStatus.BidCount > 0)
                                {
                                    listparams[3] = solditem.Transaction.Item.SellingStatus.BidCount.ToString();
                                }
                                if (solditem.Transaction.Item.ListingDetails != null)
                                {
                                    listparams[4] = solditem.Transaction.Item.ListingDetails.EndTime.ToString();
                                }
                            }
                        }
                        ListViewItem vi = new ListViewItem(listparams);
                        LstSold.Items.Add(vi);
                    }
                }
                if (apicall.UnsoldListReturn != null &&
                    apicall.UnsoldListReturn.ItemArray != null &&
                    apicall.UnsoldListReturn.ItemArray.Count > 0)
                {
                    foreach (ItemType unsolditem in apicall.UnsoldListReturn.ItemArray)
                    {
                        string[] listparams = new string[5];
                        listparams[0] = unsolditem.ItemID;
                        listparams[1] = unsolditem.Title;
                        if (unsolditem.SellingStatus != null)
                        {
                            listparams[2] = unsolditem.SellingStatus.CurrentPrice.Value.ToString();
                            listparams[3] = unsolditem.SellingStatus.BidCount.ToString();
                            listparams[4] = unsolditem.ListingDetails.EndTime.ToString();
                        }

                        ListViewItem vi = new ListViewItem(listparams);
                        LstUnSold.Items.Add(vi);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #8
0
        public IEnumerable <Listing> GetMyEbaySelling(bool active, bool scheduled, bool unsold)
        {
            var  listings             = new List <Listing>();
            int  activepage           = 1;
            int  scheduledpage        = 1;
            int  unsoldpage           = 1;
            bool moreActiveEntries    = true;
            bool moreScheduledEntries = true;
            bool moreUnsoldEntries    = true;

            while (moreActiveEntries || moreScheduledEntries || moreUnsoldEntries)
            {
                var apicall = new GetMyeBaySellingCall(api)
                {
                    ActiveList    = new ItemListCustomizationType(),
                    ScheduledList = new ItemListCustomizationType(),
                    UnsoldList    = new ItemListCustomizationType()
                };

                if (moreActiveEntries)
                {
                    // active listing
                    // only return fixed price items for now
                    apicall.ActiveList.Include    = active;
                    apicall.ActiveList.Pagination = new PaginationType()
                    {
                        EntriesPerPage = EntriesPerPage, PageNumber = activepage++
                    };
                }

                if (moreScheduledEntries)
                {
                    // scheduled list (things scheduled to sell but not listed yet
                    apicall.ScheduledList.Include    = scheduled;
                    apicall.ScheduledList.Pagination = new PaginationType()
                    {
                        EntriesPerPage = EntriesPerPage, PageNumber = scheduledpage++
                    };
                }

                if (moreUnsoldEntries)
                {
                    // unsold list
                    apicall.UnsoldList.Include    = unsold;
                    apicall.UnsoldList.Pagination = new PaginationType()
                    {
                        EntriesPerPage = EntriesPerPage, PageNumber = unsoldpage++
                    };
                }

                // get data
                apicall.GetMyeBaySelling();

                // now parse results
                if (apicall.ActiveListReturn != null &&
                    apicall.ActiveListReturn.ItemArray != null &&
                    apicall.ActiveListReturn.ItemArray.Count > 0)
                {
                    if (apicall.ActiveListReturn.ItemArray.Count < EntriesPerPage)
                    {
                        moreActiveEntries = false;
                    }
                    foreach (ItemType actitem in apicall.ActiveListReturn.ItemArray)
                    {
                        var actlisting = new Listing();
                        actlisting.Populate(actitem);
                        listings.Add(actlisting);
                    }
                }
                else
                {
                    moreActiveEntries = false;
                }

                if (apicall.ScheduledListReturn != null &&
                    apicall.ScheduledListReturn.ItemArray != null &&
                    apicall.ScheduledListReturn.ItemArray.Count > 0)
                {
                    if (apicall.ScheduledListReturn.ItemArray.Count < EntriesPerPage)
                    {
                        moreScheduledEntries = false;
                    }
                    foreach (ItemType scheItem in apicall.ScheduledListReturn.ItemArray)
                    {
                        var slisting = new Listing();
                        slisting.Populate(scheItem);
                        listings.Add(slisting);
                    }
                }
                else
                {
                    moreScheduledEntries = false;
                }

                if (apicall.UnsoldListReturn != null &&
                    apicall.UnsoldListReturn.ItemArray != null &&
                    apicall.UnsoldListReturn.ItemArray.Count > 0)
                {
                    if (apicall.UnsoldListReturn.ItemArray.Count < EntriesPerPage)
                    {
                        moreUnsoldEntries = false;
                    }

                    foreach (ItemType unsoldItem in apicall.UnsoldListReturn.ItemArray)
                    {
                        var unsoldlisting = new Listing();
                        unsoldlisting.Populate(unsoldItem);
                        listings.Add(unsoldlisting);
                    }
                }
                else
                {
                    moreUnsoldEntries = false;
                }
            }

            return(listings);
        }
예제 #9
0
        public ItemType[] GeteBayActiveListing(GeteBayActiveListingRequest request)
        {
            try
            {
                if (string.IsNullOrEmpty(request.SellerID))
                {
                    throw new Exception("No Seller ID");
                }
                var apiContext        = _eBayAPIContextProvider.GetAPIContextBySellerID(request.SellerID);
                var myeBaySellingCall = new GetMyeBaySellingCall(apiContext);

                myeBaySellingCall.ActiveList             = new ItemListCustomizationType();
                myeBaySellingCall.ActiveList.ListingType = ListingTypeCodeType.FixedPriceItem;
                myeBaySellingCall.ActiveList.Include     = true;

                var getItemCall = new GetItemCall(apiContext);
                getItemCall.DetailLevelList.Add(DetailLevelCodeType.ItemReturnDescription);

                int pageNumber = 1;
                int pageSize   = 50;
                int totalPage  = 1;

                PaginationType pageInfo = new PaginationType();

                var lstActiveItem = new List <ItemType>();


                do
                {
                    pageInfo.PageNumber     = pageNumber;
                    pageInfo.EntriesPerPage = pageSize;
                    myeBaySellingCall.ActiveList.Pagination = pageInfo;
                    myeBaySellingCall.GetMyeBaySelling();

                    if (myeBaySellingCall.ActiveListReturn != null && myeBaySellingCall.ActiveListReturn.PaginationResult != null)
                    {
                        totalPage = myeBaySellingCall.ActiveListReturn.PaginationResult.TotalNumberOfPages;
                    }

                    if (myeBaySellingCall.ActiveListReturn != null &&
                        myeBaySellingCall.ActiveListReturn.ItemArray != null &&
                        myeBaySellingCall.ActiveListReturn.ItemArray.Count > 0)
                    {
                        foreach (ItemType actitem in myeBaySellingCall.ActiveListReturn.ItemArray)
                        {
                            try
                            {
                                var item = getItemCall.GetItem(actitem.ItemID);
                                if (item != null)
                                {
                                    lstActiveItem.Add(item);
                                }
                            }
                            catch (Exception ex)
                            {
                                LogManager.Instance.Error(ex.Message);
                            }
                        }
                    }

                    pageNumber++;
                } while (pageNumber <= totalPage);

                return(lstActiveItem.ToArray());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #10
0
        public void relistItems()
        {
            MySQLWrapper s = null;

            try
            {
                changeStatus("Initializing...");
                addLogStatus("Initializing...");
                if (!initialize())
                {
                    throw new Exception("ERROR : Unable to connect to eBay Service");
                }
                s = new MySQLWrapper();
                GetMyeBaySellingCall   eBaySelling = new GetMyeBaySellingCall(context);
                PaginatedItemArrayType pArr        = new PaginatedItemArrayType();
                eBaySelling.UnsoldList         = new ItemListCustomizationType();
                eBaySelling.UnsoldList.Include = true;
                eBaySelling.GetMyeBaySelling();
                ItemTypeCollection unsoldItems = new ItemTypeCollection();
                pArr = eBaySelling.UnsoldListReturn;
                if (pArr != null)
                {
                    string sku = "";
                    unsoldItems = pArr.ItemArray;
                    RelistItemCall   relistItem      = new RelistItemCall(context);
                    StringCollection deleteFieldList = new StringCollection();
                    ItemType         tItem           = new ItemType();
                    changeStatus("ReListing...");
                    addLogStatus("Total Unsold items : " + unsoldItems.Count);
                    for (int i = 0; i < unsoldItems.Count; i++)
                    {
                        tItem.ItemID = unsoldItems[i].ItemID;
                        sku          = s.getSKU(unsoldItems[i].ItemID);
                        if (sku != "")
                        {
                            relistItem.RelistItem(tItem);
                            s.updateReListedItem(sku, relistItem.ItemID);
                            s.addToLogs(sku, "Re-Listed with Item Id : " + relistItem.ItemID);
                            addLogStatus("Item : " + unsoldItems[i].ItemID + " relisted with Item ID : " + relistItem.ItemID);
                        }
                        else
                        {
                            throw new Exception("ItemId : " + unsoldItems[i].ItemID + " not found in database!");
                        }
                    }
                    addLogStatus("Done!");
                }
                else
                {
                    addLogStatus("No Unsold Items!");
                }
            }
            catch (Exception ex)
            {
                addLogStatus("ERROR : " + ex.Message);
            }
            finally {
                s.destroy();
                destroy();
            }
        }