Exemple #1
0
        public static int GetItemList(ApiContext apiContext, int Page)
        {
            GetSellerTransactionsCall apiCall = new GetSellerTransactionsCall(apiContext);

            apiCall.DetailLevelList = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll });
//            apiCall.ApiRequest.OutputSelector = new StringCollection(new string[] { "TransactionID", "PaginationResult", "TransactionArray.Transaction.Buyer.UserID", "TransactionArray.Transaction.Item.Title" });
            apiCall.Pagination = new PaginationType()
            {
                EntriesPerPage = 200, PageNumber = Page
            };

            apiCall.Execute();
            apiContext.ApiLogManager.RecordMessage(String.Format("Getting item list - START, page {0}", Page), MessageType.Information, MessageSeverity.Informational);
            TransactionTypeCollection items = apiCall.GetSellerTransactions(new TimeFilter()
            {
                TimeFrom = new DateTime(2012, 8, 14, 12, 0, 0),
                TimeTo   = new DateTime(2012, 8, 14, 23, 59, 59)
            });

            apiContext.ApiLogManager.RecordMessage(String.Format("Getting item list - SUCCESS, page {0}", Page), MessageType.Information, MessageSeverity.Informational);

            foreach (TransactionType i in items)
            {
                apiContext.ApiLogManager.RecordMessage(String.Format("UserID: {0}\tTransactioNID: {1}\tBuyer Name: {2}\tCreation Time: {3}\tSellingManagerSalesRecordNumber: {4}",
                                                                     i.Buyer.UserID, i.TransactionID, i.Buyer.BuyerInfo.ShippingAddress.Name, i.CreatedDate, i.ShippingDetails.SellingManagerSalesRecordNumber), MessageType.Information, MessageSeverity.Informational);
            }
            return(apiCall.PaginationResult.TotalNumberOfPages);
        }
Exemple #2
0
        /// <summary>
        /// Returns a list of ebay transaction types matching a specified time period
        /// </summary>
        /// <param name="from">Start date and time of the requiered time period</param>
        /// <param name="until">End date and time of the requiered time period</param>
        /// <returns></returns>
        public static List <TransactionType> LoadEbayTransactions(DateTime from, DateTime until)
        {
            List <TransactionType> result = new List <TransactionType>();

            //Get all sales
            GetSellerTransactionsCall transactionCall = new GetSellerTransactionsCall(EbayController.GetApiContext());

            transactionCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            transactionCall.IncludeContainingOrder = true;
            transactionCall.Site       = SiteCodeType.Germany;
            transactionCall.Pagination = new PaginationType();
            transactionCall.Pagination.EntriesPerPage = 200;

            Int32 pageNumber = 1;

            do
            {
                transactionCall.Pagination.PageNumber = pageNumber;
                TransactionTypeCollection transactionPage = transactionCall.GetSellerTransactions(from, until);

                result.AddRange(transactionPage.ToArray());

                pageNumber++;
            }while (transactionCall.HasMoreTransactions);

            //Get all orders for the loaded sales
            var           orderIds  = from current in result where current.ContainingOrder != null select current.ContainingOrder.OrderID;
            GetOrdersCall orderCall = new GetOrdersCall(EbayController.GetApiContext());

            orderCall.OrderIDList = new StringCollection(orderIds.ToArray());
            orderCall.Execute();

            //Assign orders to sales
            List <OrderType> orders = new List <OrderType>(orderCall.OrderList.ToArray());

            foreach (TransactionType current in result)
            {
                if (current.ContainingOrder != null)
                {
                    current.ContainingOrder = orders.FirstOrDefault(x => x.OrderID == current.ContainingOrder.OrderID);
                }
            }

            return(result);
        }
Exemple #3
0
        public void GetSellerTransactions()
        {
            GetSellerTransactionsCall gst = new GetSellerTransactionsCall(this.apiContext);

            // Time filter
            System.DateTime calTo   = System.DateTime.Now;
            System.DateTime calFrom = calTo.AddHours(-1);
            TimeFilter      tf      = new TimeFilter(calFrom, calTo);

            gst.ModTimeFilter = tf;
            // Pagination
            PaginationType pt = new PaginationType();

            pt.EntriesPerPage = 100; pt.EntriesPerPageSpecified = true;
            pt.PageNumber     = 1; pt.PageNumberSpecified = true;
            gst.Pagination    = pt;
            gst.Execute();
            TestData.SellerTransactions = gst.ApiResponse.TransactionArray;
        }
        private void BtnGetSellerTransactions_Click(object sender, System.EventArgs e)
        {
            try
            {
                LstTransactions.Items.Clear();

                GetSellerTransactionsCall apicall = new GetSellerTransactionsCall(Context);
                TimeFilter timefilter             = new TimeFilter();
                if (GMT.Checked.Equals(true))
                {
                    timefilter.TimeFromUTC = DatePickModFrom.Value;
                    timefilter.TimeToUTC   = DatePickModTo.Value;
                }
                else
                {
                    timefilter.TimeFrom = DatePickModFrom.Value;
                    timefilter.TimeTo   = DatePickModTo.Value;
                }
                TransactionTypeCollection transactions = apicall.GetSellerTransactions(timefilter);
//				TransactionTypeCollection transactions = apicall.GetSellerTransactions(DatePickModFrom.Value, DatePickModTo.Value);

                foreach (TransactionType trans in transactions)
                {
                    string[] listparams = new string[6];
                    listparams[0] = trans.Item.ItemID;
                    listparams[1] = trans.TransactionID;
                    listparams[2] = trans.TransactionPrice.Value.ToString();
                    listparams[3] = trans.AmountPaid.Value.ToString();
                    listparams[4] = trans.QuantityPurchased.ToString();
                    listparams[5] = trans.Buyer.UserID;

                    ListViewItem vi = new ListViewItem(listparams);
                    LstTransactions.Items.Add(vi);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }