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;
			
		}
Esempio n. 2
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();
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        static ItemType getITembySkuUsingActiveITems(string sku)
        {
            ItemType item =null;

            var  apiContext = eBayServiceSettingHelper.GetApiContext();
            GetMyeBaySellingCall apicall = new GetMyeBaySellingCall(apiContext);

            PaginationType pageInfo = null;
            pageInfo = new PaginationType();
            pageInfo.EntriesPerPage = 200;

            apicall.ActiveList = new ItemListCustomizationType();
            if (pageInfo != null)
            {
                apicall.ActiveList.Pagination = pageInfo;
            }

            apicall.GetMyeBaySelling();

            foreach (ItemType actitem in apicall.ActiveListReturn.ItemArray)
            {
                try
                {
                    if (actitem.SKU == sku)
                    {
                        item = actitem;
                        break;
                    }
                }
                catch { }
            }

            return item;
        }
Esempio n. 7
0
        public List<ItemType> GetSales()
        {
            GetMyeBaySellingCall apicall = new GetMyeBaySellingCall(GetContext());

            PaginationType pageInfo = new PaginationType();
            pageInfo.EntriesPerPage = 100;

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

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

            apicall.GetMyeBaySelling();

            List<ItemType> Items = new List<ItemType>();

            if (apicall.ActiveListReturn != null &&
                    apicall.ActiveListReturn.ItemArray != null &&
                    apicall.ActiveListReturn.ItemArray.Count > 0)
            {
                foreach (ItemType actitem in apicall.ActiveListReturn.ItemArray)
                {
                    Items.Add(actitem);
                }
            }

            foreach (ItemType actitem in Items)
                actitem.TimeLeft = FormatTimeLeft(actitem.TimeLeft);

            return Items;
        }
        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);

        }