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(10); System.DateTime calFrom = System.DateTime.Now.AddHours(-20); 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 GetSellerEventsFull() { Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); GetSellerEventsCall api = new GetSellerEventsCall(this.apiContext); //specify more info string categoryID = TestData.NewItem2.PrimaryCategory.CategoryID; DateTime endTimeFrom = DateTime.Now.AddDays(-1); DateTime endTimeTo = DateTime.Now.AddDays(1); //these properties how to use? bool IncludeWatchCount = true; PaginationType pagination = new PaginationType(); pagination.PageNumber = 1; pagination.EntriesPerPage = 20; api.EndTimeFrom = endTimeFrom; api.EndTimeTo = endTimeTo; api.IncludeWatchCount = IncludeWatchCount; api.DetailLevelList = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }); api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); ItemTypeCollection events = api.ApiResponse.ItemArray; // Make sure it covers that item that I just added. ItemType foundEvent = findItem(events, TestData.NewItem.ItemID); Assert.IsNotNull(foundEvent); }
public static ItemType[] GetSellerList(ApiContext apiContext) { GetSellerListCall apiCall = new GetSellerListCall(apiContext); apiCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); apiCall.Pagination = new PaginationType() { EntriesPerPage = 200, PageNumber = 1 }; apiCall.EndTimeFrom = new DateTime(2012, 9, 1); apiCall.EndTimeTo = new DateTime(2012, 9, 20); ItemTypeCollection items = apiCall.GetSellerList(); List <ItemType> result = new List <ItemType>(); foreach (ItemType i in items) { if (i.ListingType == ListingTypeCodeType.FixedPriceItem) { result.Add(i); apiContext.ApiLogManager.RecordMessage(String.Format("{0}: {1}", i.ItemID, i.Description), MessageType.Information, MessageSeverity.Informational); } } return(result.ToArray()); }
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); } }
static ItemType findItem(ItemTypeCollection items, String itemID) { for(int i = 0; i < items.Count; i++ ) { if( items[i].ItemID.Equals(itemID) ) return items[i]; } return null; }
private void UpdateProductWeight() { Log("Updating Product Weight"); ItemTypeCollection eBayProducts = ebc.GetProductWeight(); var fbProducts = fb.GetProductWeight(); var toUpdate = new ItemTypeCollection(); foreach (ItemType kvp in eBayProducts) { if (fbProducts.ContainsKey(kvp.SKU)) { double dbl = fbProducts[kvp.SKU]; if (!dbl.Equals(kvp.ShippingDetails.CalculatedShippingRate.WeightMajor.Value)) //change of logic needed here { toUpdate.Add(new ItemType() { ItemID = kvp.ItemID, SKU = kvp.SKU, ShippingDetails = new ShippingDetailsType() { CalculatedShippingRate = new CalculatedShippingRateType() { WeightMajor = new MeasureType() { Value = Convert.ToDecimal(dbl) } } } }); } } } if (toUpdate.Count > 0) { Log("Updating Product Weight: " + toUpdate.Count); foreach (ItemType i in toUpdate) { var updated = ebc.UpdateProductWeight(i.ItemID, i.SKU, i.ShippingDetails.CalculatedShippingRate.WeightMajor.Value); if (updated) { Log($"Sku/Variant/Productcode: [{i.SKU}] Weight: [{i.ShippingDetails.CalculatedShippingRate.WeightMajor.Value}] OK"); } else { Log($"Sku/Variant/Productcode: [{i.SKU}] Weight: [{i.ShippingDetails.CalculatedShippingRate.WeightMajor.Value}] FAILED"); } } } else { Log("No Products to Update!"); } Log("Product Price Finished"); }
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(); } }
private void InitialControlValue() { ItemId = ""; ItemName = ""; ItemSize = ""; Count = 1; StockPrice = ""; Price = ""; Color = ""; ItemType = ItemTypeCollection.FirstOrDefault(); }
static ItemType findItem(ItemTypeCollection items, String itemID) { for (int i = 0; i < items.Count; i++) { if (items[i].ItemID.Equals(itemID)) { return(items[i]); } } return(null); }
public string GetInventory() { ApiContext context = eBayCall.GetContext(); try { GetSellerListCall oGetSellerListCall = new GetSellerListCall(context); // use GranularityLevel of Fine oGetSellerListCall.GranularityLevel = GranularityLevelCodeType.Fine; // get the first page, 200 items per page PaginationType oPagination = new PaginationType(); oPagination.EntriesPerPage = 200; oPagination.EntriesPerPageSpecified = true; oPagination.PageNumber = 1; oPagination.PageNumberSpecified = true; oGetSellerListCall.Pagination = oPagination; // ask for all items that are ending in the future (active items) oGetSellerListCall.EndTimeFilter = new TimeFilter(DateTime.Now, DateTime.Now.AddMonths(1)); // return items that end soonest first oGetSellerListCall.Sort = 2; ItemTypeCollection oItems = oGetSellerListCall.GetSellerList(); if (oItems != null) { if (oItems.Count > 0) { return(JsonConvert.SerializeObject(oItems, Formatting.Indented)); } else { return("No active inventory."); } } else { return("Inventory is null!"); } } catch (ApiException oApiEx) { return(oApiEx.Message); } catch (Exception ex) { return(ex.Message); } }
public async Task ItemTypes() { ItemTypeCollection response = await crest.GetRoot().QueryAsync(r => r.ItemTypes); MarketTypeCollection types = crest.GetRoot().Query(r => r.MarketTypes); List <MarketTypeCollection.Item> list = types.Items.ToList(); while (types.Next != null) { types = types.Query(t => t.Next); list.AddRange(types.Items); } }
public ItemTypeCollection GetInventory() { ItemTypeCollection ret = new ItemTypeCollection(); GetMyeBaySellingCall oGetMyeBaySellingCall = new GetMyeBaySellingCall(context); oGetMyeBaySellingCall.ActiveList = new ItemListCustomizationType(); try { oGetMyeBaySellingCall.Execute(); foreach (ItemType oItem in oGetMyeBaySellingCall.ActiveListReturn.ItemArray) { if (oItem.Variations?.Variation.Count > 0) { foreach (VariationType vr in oItem.Variations.Variation) { ItemType i = new ItemType(); i.ItemID = oItem.ItemID; i.SKU = vr.SKU; i.Quantity = vr.Quantity - vr.SellingStatus.QuantitySold; i.BuyItNowPrice = vr.StartPrice; ret.Add(i); } } else { ItemType i = new ItemType(); i.ItemID = oItem.ItemID; i.SKU = oItem.SKU; i.Quantity = oItem.QuantityAvailable; i.BuyItNowPrice = oItem.BuyItNowPrice; ret.Add(i); } } } catch (ApiException oApiEx) { Console.WriteLine(oApiEx.Message); } catch (SdkException oSdkEx) { Console.WriteLine(oSdkEx.Message); } catch (Exception oEx) { Console.WriteLine(oEx.Message); } return(ret); }
public static ItemTypeCollection GetAllItem() { ItemTypeCollection collection = new ItemTypeCollection(); using (var reader = SqlHelper.ExecuteReader("tblItemType_GetAll", null)) { while (reader.Read()) { ItemType obj = new ItemType(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ItemTypeCollection GetbyUser(string CreatedUser) { ItemTypeCollection collection = new ItemTypeCollection(); ItemType obj; using (var reader = SqlHelper.ExecuteReader("tblItemType_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser))) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ItemTypeCollection GetbyEventCode(string EventCode) { ItemTypeCollection collection = new ItemTypeCollection(); ItemType obj; using (var reader = SqlHelper.ExecuteReader("tblItemType_GetByEventCode", new SqlParameter("@EventCode", EventCode))) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public void GetBidderList() { GetBidderListCall api = new GetBidderListCall(this.apiContext); // Set the item to be ended. api.ActiveItemsOnly = false; // Time filter System.DateTime calTo = DateTime.Now; System.DateTime calFrom = calTo; calFrom.AddHours(-1); api.EndTimeFrom = calFrom; api.EndTimeTo = calTo; // Make API call. ItemTypeCollection items = api.GetBidderList(api.ActiveItemsOnly, calFrom, calTo, null, GranularityLevelCodeType.Coarse); UserType bidder = api.ApiResponse.Bidder; }
static ItemType findItem(ItemTypeCollection items, String itemID) { if (items == null) { return(null); } for (int i = 0; i < items.Count; i++) { ItemType item = items[i]; if (item != null && item.ItemID != null && item.ItemID.Equals(itemID)) { return(item); } } return(null); }
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); }
public static IStoreAnalysis Analysis(UserSettingsView settings, ref ItemTypeCollection storeItems) { IStoreAnalysis analysis = new StoreAnalysis(); var items = new List <string>(); var qtyMismatch = new List <string>(); int cnt = 0; int qtyMismatchCnt = 0; if (storeItems.Count == 0) { storeItems = ebayAPIs.GetSellerList(settings, out string errMsg); } if (storeItems != null) { // scan each item in store - is it in db? foreach (ItemType oItem in storeItems) { //if (oItem.ItemID == "224079107216") //{ // int stop = 99; //} var listing = Utility.StoreCheck.LookupItemid(settings, oItem.ItemID); if (listing == null) { items.Add(oItem.Title); ++cnt; } else { if (listing.Qty != (oItem.Quantity - oItem.SellingStatus.QuantitySold)) { qtyMismatch.Add(oItem.Title); ++qtyMismatchCnt; } } } analysis.DBIsMissingItems = items; analysis.QtyMismatch = qtyMismatch; analysis.InActive = GetInactive(settings.StoreID); } return(analysis); }
private void ProcessListingData(ItemTypeCollection listingsDtos) { foreach (ItemType listingDto in listingsDtos) { BonanzaListing listing = _marketplace.Listings.SingleOrDefault(p => p.Code.Equals(listingDto.ItemID)); if (listing == null) { listing = new BonanzaListing(); } try { Map(listing, listingDto); } catch (PropertyConstraintException e) { //Map(listing, SyncListing(listingDto.ItemID)); } } }
public static void InitializeEbay() { GetApiContext(); if (ActiveList == null) { ActiveList = new ItemTypeCollection(); } if (SoldList == null) { SoldList = new OrderTransactionTypeCollection(); } if (_timer == null) { //_timer = new DispatcherTimer(TimeSpan.FromMinutes(1), DispatcherPriority.Background, // RefreshEbayData, Dispatcher.CurrentDispatcher); //_timer.Start(); } }
public List <SimpleList> ItemInFBEB() { InitConnections(); ItemTypeCollection eBayProducts = ebc.GetInventory(); var fbProducts = fb.GetInventory(); var allItems = new List <String>(); foreach (ItemType itm in eBayProducts) { allItems.Add(itm.SKU); } allItems.AddRange(fbProducts.Keys); var distinctProducts = allItems.Distinct(); List <SimpleList> ret = new List <SimpleList>(); ret.AddRange(distinctProducts.Select(k => new SimpleList() { Name = k })); foreach (var x in ret) { foreach (ItemType item in eBayProducts) { if (item.SKU == x.Name) { x.InEB = true; } } x.InFB = fbProducts.ContainsKey(x.Name); } return(ret); }
/// <summary> /// items are listed that are not in the db /// </summary> /// <param name="totalListed"></param> /// <returns></returns> public static List <string> DBIsMissingItems_notused(UserSettingsView settings, ref ItemTypeCollection storeItems) { var items = new List <string>(); /* * int cnt = 0; * if (storeItems.Count == 0) * { * storeItems = ebayAPIs.GetSellerList(settings, out string errMsg); * } * if (storeItems != null) * { * // scan each item in store - is it in db? * foreach (ItemType oItem in storeItems) * { * if (oItem.Quantity > 0) * { * int stop = 99; * } * bool r = Utility.StoreCheck.LookupItemid(settings, oItem.ItemID); * if (!r) * { * items.Add(oItem.Title); ++cnt; * } * } * } */ return(items); }
static ItemType findItem(ItemTypeCollection items, String itemID) { if( items == null ) return null; for(int i = 0; i < items.Count; i++ ) { ItemType item = items[i]; if( item != null && item.ItemID != null && item.ItemID.Equals(itemID) ) return item; } return null; }
void GetSellerListOfItems() { ApiContext oContext = new ApiContext(); int nNumberofTotalListing = 0; int nNumberofSoldListing = 0; double nTotalAmount = 0; int nAlreadyRelistedCount = 0; int nEligibleItemForRelist = 0; string szShippingType; dataGridView1.Rows.Clear(); Cursor.Current = Cursors.WaitCursor; txtResults.Text = " "; // set the dev,app,cert information oContext.ApiCredential.ApiAccount.Developer = ConfigurationManager.AppSettings["DevID"]; oContext.ApiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["AppID"]; oContext.ApiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["CertID"]; // set the AuthToken oContext.ApiCredential.eBayToken = ConfigurationManager.AppSettings["UserToken"]; // set the base SOAP URL .. use https://api.sandbox.ebay.com/wsapi for Sandbox calls //oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi"; oContext.SoapApiServerUrl = ConfigurationManager.AppSettings["ServerUrl"]; // set the Site of the Context oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US; // very important, let's setup the logging ApiLogManager oLogManager = new ApiLogManager(); oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetSellerList459NETSDK.log", true, true, true)); oLogManager.EnableLogging = true; oContext.ApiLogManager = oLogManager; // the WSDL Version used for this SDK build oContext.Version = "459"; // set the CallRetry properties CallRetry oCallRetry = new CallRetry(); // set the delay between each retry to 1 millisecond oCallRetry.DelayTime = 1; // set the maximum number of retries oCallRetry.MaximumRetries = 3; // set the error codes on which to retry StringCollection oErrorCodes = new StringCollection(); oErrorCodes.Add("10007"); // Internal error to the application ... general error oErrorCodes.Add("2"); // unsupported verb error oErrorCodes.Add("251"); // eBay Structured Exception ... general error oCallRetry.TriggerErrorCodes = oErrorCodes; // set the exception types on which to retry TypeCollection oExceptions = new TypeCollection(); oExceptions.Add(typeof(System.Net.ProtocolViolationException)); // the "Client found response content type of 'text/plain'" exception is of type SdkException, so let's add that to the list oExceptions.Add(typeof(SdkException)); oCallRetry.TriggerExceptions = oExceptions; // set CallRetry back to ApiContext oContext.CallRetry = oCallRetry; // set the timeout to 2 minutes oContext.Timeout = 120000; GetSellerListCall oGetSellerListCall = new GetSellerListCall(oContext); // set the Version used in the call oGetSellerListCall.Version = oContext.Version; // set the Site of the call oGetSellerListCall.Site = oContext.Site; // enable the compression feature oGetSellerListCall.EnableCompression = true; // use GranularityLevel of Fine oGetSellerListCall.GranularityLevel = GranularityLevelCodeType.Fine; // get the first page, 200 items per page PaginationType oPagination = new PaginationType(); oPagination.EntriesPerPage = 200; //oPagination.EntriesPerPageSpecified = true; oPagination.PageNumber = 1; //oPagination.PageNumberSpecified = true; oGetSellerListCall.Pagination = oPagination; oGetSellerListCall.UserID = txtUserID.Text; // ask for all items that are ending in the future (active items) //oGetSellerListCall.EndTimeFilter = new TimeFilter(DateTime.Now.AddDays(-3),DateTime.Now); //oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, DateTime.Now); oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, dateTimePicker2.Value); // return items that end soonest first oGetSellerListCall.Sort = 1; // see http://developer.ebay.com/DevZone/SOAP/docs/WSDL/xsd/1/element/1597.htm for Sort documentation try { ItemTypeCollection oItems = oGetSellerListCall.GetSellerList(); // output some of the data nNumberofTotalListing = 0; nNumberofSoldListing = 0; int pagenumber = 1; while (pagenumber <= oGetSellerListCall.PaginationResult.TotalNumberOfPages) { if (pagenumber > 1) { oGetSellerListCall.Pagination.PageNumber = pagenumber; //oGetSellerListCall.Execute(); oItems = oGetSellerListCall.GetSellerList(); } foreach (ItemType oItem in oItems) { nNumberofTotalListing = nNumberofTotalListing + 1; if (oItem.ShippingDetails.ShippingType == ShippingTypeCodeType.Free) { szShippingType = "FREE"; } if (oItem.SellingStatus.HighBidder != null) { if (!(chkbx_OnlyRelistOnes.Checked)) { dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, oItem.SellingStatus.HighBidder.UserID); } nNumberofSoldListing = nNumberofSoldListing + 1; nTotalAmount = nTotalAmount + Convert.ToDouble(oItem.SellingStatus.CurrentPrice.Value); } else { if (oItem.ListingDetails.RelistedItemID == null) { dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, "DNS"); nEligibleItemForRelist += 1; } else { nAlreadyRelistedCount += 1; } } //Console.WriteLine("ItemID is " + oItem.ItemID); //Console.WriteLine("This item is of type " + oItem.ListingType.ToString()); //if (0 < oItem.SellingStatus.BidCount) //{ // The HighBidder element is valid only if there is at least 1 bid // Console.WriteLine("High Bidder is " + oItem.SellingStatus.HighBidder.UserID); //} //Console.WriteLine("Current Price is " + oItem.SellingStatus.CurrentPrice.currencyID.ToString() + " " + oItem.SellingStatus.CurrentPrice.Value.ToString()); //Console.WriteLine("End Time is " + oItem.ListingDetails.EndTime.ToLongDateString() + " " + oItem.ListingDetails.EndTime.ToLongTimeString()); //Console.WriteLine(""); // the data that is accessible through the item object // for different GranularityLevel and DetailLevel choices // can be found at the following URL: // http://developer.ebay.com/DevZone/SOAP/docs/WebHelp/GetSellerListCall-GetSellerList_Best_Practices.html } pagenumber += 1; } //pagenumber += 1; // // // //Console.WriteLine("Done"); txtbx_AmountSold.Text = nTotalAmount.ToString(); txtbx_NumberOfListing.Text = nNumberofTotalListing.ToString(); txtbx_NumberofSold.Text = nNumberofSoldListing.ToString(); txtbx_AlreadyListed.Text = nAlreadyRelistedCount.ToString(); txtbx_relistEligible.Text = nEligibleItemForRelist.ToString(); } catch (ApiException oApiEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oApiEx.Message; return; } catch (SdkException oSdkEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oSdkEx.Message; return; } catch (Exception oEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oEx.Message; return; } Cursor.Current = Cursors.Default; }
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(); } }
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()); }
private void UpdateProductPrice() { Log("Updating Product Price"); var eBayProducts = ebc.GetProductPrice(); var fbProducts = fb.GetProductPrice(); var toUpdate = new ItemTypeCollection(); foreach (ItemType kvp in eBayProducts) { if (fbProducts.ContainsKey(kvp.SKU)) { var dbl = fbProducts[kvp.SKU]; if (dbl != kvp.BuyItNowPrice.Value) { toUpdate.Add(new ItemType() { ItemID = kvp.ItemID, SKU = kvp.SKU, BuyItNowPrice = new AmountType() { Value = dbl, currencyID = CurrencyCodeType.AUD } }); } } } if (toUpdate.Count > 0) { Log("Updating Product Price: " + toUpdate.Count); int groupOf = 4; List <ItemType> items = new List <ItemType>(); foreach (ItemType it in toUpdate) { items.Add(it); } List <List <ItemType> > groups = new List <List <ItemType> >(); for (int i = 0; i < items.Count; i += groupOf) { groups.Add(items.GetRange(i, Math.Min(groupOf, items.Count - i))); } foreach (List <ItemType> group in groups) { var updatedGroup = ebc.GroupUpdateProductPrice(group); if (updatedGroup) { foreach (var i in group) { Log($"Sku/Variant/Productcode: [{i.SKU}] Price: [{i.BuyItNowPrice.Value}] OK"); } } else { foreach (var i in group) { Log($"Sku/Variant/Productcode: [{i.SKU}] Price: [{i.BuyItNowPrice.Value}] FAILED"); } } } } else { Log("No Products to Update!"); } Log("Product Price Finished"); }
public void TestInitialization() { _itemToTest = new ItemTypeCollection(_random.NextLong()); }
public void UpdateInventory() { Log("Updating Inventory"); ItemTypeCollection eBayProducts = ebc.GetInventory(); var fbProducts = fb.GetInventory(); var toUpdate = new ItemTypeCollection(); foreach (ItemType kvp in eBayProducts) { if (fbProducts.ContainsKey(kvp.SKU)) { var dbl = fbProducts[kvp.SKU]; int toUpdateValue = Convert.ToInt32(dbl); if (dbl <= 3) { toUpdateValue = 0; } if ((toUpdateValue == 0 && kvp.Quantity != 0) || (toUpdateValue > 3 && (kvp.Quantity != toUpdateValue))) { toUpdate.Add(new ItemType() { ItemID = kvp.ItemID, SKU = kvp.SKU, Quantity = toUpdateValue }); } } } if (toUpdate.Count > 0) { int groupOf = 4; List <ItemType> items = new List <ItemType>(); foreach (ItemType it in toUpdate) { items.Add(it); } List <List <ItemType> > groups = new List <List <ItemType> >(); for (int i = 0; i < items.Count; i += groupOf) { groups.Add(items.GetRange(i, Math.Min(groupOf, items.Count - i))); } Log("Updating Inventory: " + toUpdate.Count); foreach (List <ItemType> group in groups) { var updatedGroup = ebc.GroupUpdateProductInventory(group); if (updatedGroup) { foreach (var i in group) { Log($"Sku/Variant/Productcode: [{i.SKU}] Qty: [{i.Quantity}] OK"); } } else { foreach (var i in group) { Log($"Sku/Variant/Productcode: [{i.SKU}] Qty: [{i.Quantity}] FAILED"); } } } } else { Log("No Inventory to Update!"); } Log("Inventory Update Finished"); }
void GetSellerListOfItems() { ApiContext oContext = new ApiContext(); int nNumberofTotalListing = 0; int nNumberofSoldListing = 0; double nTotalAmount = 0; int nAlreadyRelistedCount = 0; int nEligibleItemForRelist = 0; string szShippingType; string szError = ""; string szInsertString = ""; string[] szArray = new string[30]; string[] szItemArray = new string[30]; int nCount = 0; string szHighBidder = ""; string szSubTitle = " "; string szTitle = " "; string szDescription = " "; string szSelectString = " "; DateTime jddate = new DateTime(); string szInventoryCategory = " "; string szInventoryCamera = " "; string szInventoryLocation = " "; string szInventorySource = " "; DateTime jdInvShipDate = new DateTime(); DateTime jdListedDate = new DateTime(); double dInvPrice = 0; int nQtyAvail = 0; int nQtySold = 0; int nLotSize = 0; //dataGridView1.Rows.Clear(); Cursor.Current = Cursors.WaitCursor; System.Data.OleDb.OleDbConnection conn_newdb = new System.Data.OleDb.OleDbConnection(); conn_newdb.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data source= " + txtbx_dbpath.Text; try { conn_newdb.Open(); } catch (Exception) { szError = "Failed"; } /*the inventory header database connection*/ System.Data.OleDb.OleDbConnection conn_newdb2 = new System.Data.OleDb.OleDbConnection(); conn_newdb2.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data source= " + txtbx_InvDBPath.Text; try { conn_newdb2.Open(); } catch (Exception) { szError = "Failed"; } txtResults.Text = " "; // set the dev,app,cert information oContext.ApiCredential.ApiAccount.Developer = ConfigurationManager.AppSettings["DevID"]; oContext.ApiCredential.ApiAccount.Application = ConfigurationManager.AppSettings["AppID"]; oContext.ApiCredential.ApiAccount.Certificate = ConfigurationManager.AppSettings["CertID"]; // set the AuthToken oContext.ApiCredential.eBayToken = ConfigurationManager.AppSettings["UserToken"]; // set the base SOAP URL .. use https://api.sandbox.ebay.com/wsapi for Sandbox calls //oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi"; oContext.SoapApiServerUrl = ConfigurationManager.AppSettings["ServerUrl"]; // set the Site of the Context oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US; // very important, let's setup the logging ApiLogManager oLogManager = new ApiLogManager(); oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetSellerList459NETSDK.log", true, true, true)); oLogManager.EnableLogging = true; oContext.ApiLogManager = oLogManager; // the WSDL Version used for this SDK build oContext.Version = "459"; // set the CallRetry properties CallRetry oCallRetry = new CallRetry(); // set the delay between each retry to 1 millisecond oCallRetry.DelayTime = 1; // set the maximum number of retries oCallRetry.MaximumRetries = 3; // set the error codes on which to retry StringCollection oErrorCodes = new StringCollection(); oErrorCodes.Add("10007"); // Internal error to the application ... general error oErrorCodes.Add("2"); // unsupported verb error oErrorCodes.Add("251"); // eBay Structured Exception ... general error oCallRetry.TriggerErrorCodes = oErrorCodes; // set the exception types on which to retry TypeCollection oExceptions = new TypeCollection(); oExceptions.Add(typeof(System.Net.ProtocolViolationException)); // the "Client found response content type of 'text/plain'" exception is of type SdkException, so let's add that to the list oExceptions.Add(typeof(SdkException)); oCallRetry.TriggerExceptions = oExceptions; // set CallRetry back to ApiContext oContext.CallRetry = oCallRetry; // set the timeout to 2 minutes oContext.Timeout = 120000; GetSellerListCall oGetSellerListCall = new GetSellerListCall(oContext); // set the Version used in the call oGetSellerListCall.Version = oContext.Version; // set the Site of the call oGetSellerListCall.Site = oContext.Site; // enable the compression feature oGetSellerListCall.EnableCompression = true; // use GranularityLevel of Fine //oGetSellerListCall.GranularityLevel = GranularityLevelCodeType.Fine; oGetSellerListCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); // get the first page, 200 items per page PaginationType oPagination = new PaginationType(); oPagination.EntriesPerPage = 200; //oPagination.EntriesPerPageSpecified = true; oPagination.PageNumber = 1; //oPagination.PageNumberSpecified = true; oGetSellerListCall.Pagination = oPagination; oGetSellerListCall.UserID = txtbx_userid.Text; // ask for all items that are ending in the future (active items) //oGetSellerListCall.EndTimeFilter = new TimeFilter(DateTime.Now.AddDays(-3),DateTime.Now); //oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, DateTime.Now); oGetSellerListCall.EndTimeFilter = new TimeFilter(dateTimePicker1.Value, dateTimePicker2.Value); // return items that end soonest first oGetSellerListCall.Sort = 1; // see http://developer.ebay.com/DevZone/SOAP/docs/WSDL/xsd/1/element/1597.htm for Sort documentation try { ItemTypeCollection oItems = oGetSellerListCall.GetSellerList(); // output some of the data nNumberofTotalListing = 0; nNumberofSoldListing = 0; int pagenumber = 1; while (pagenumber <= oGetSellerListCall.PaginationResult.TotalNumberOfPages) { if (pagenumber > 1) { oGetSellerListCall.Pagination.PageNumber = pagenumber; //oGetSellerListCall.Execute(); oItems = oGetSellerListCall.GetSellerList(); } foreach (ItemType oItem in oItems) { if (oItem.SKU != null) { szArray = oItem.SKU.Split(' '); } else { szArray[0] = "BLANK"; } nQtySold = oItem.SellingStatus.QuantitySold; nQtyAvail = oItem.Quantity - nQtySold; nLotSize = oItem.LotSize; szItemArray = szArray[0].Split(','); szItemArray = szItemArray[0].Split('.'); if (oItem.SellingStatus.HighBidder != null) { szHighBidder = oItem.SellingStatus.HighBidder.UserID; } else { szHighBidder = " "; } if (oItem.SubTitle != null) { szSubTitle = oItem.SubTitle.Replace('\"', ' '); } else { szSubTitle = " "; } if (oItem.Title != null) { szTitle = oItem.Title.Replace('\"', ' '); } else { szTitle = " "; } //ShippingServiceOptionsTypeCollection shippingCol = new ShippingServiceOptionsTypeCollection(); //shippingCol = oItem.ShippingDetails.ShippingServiceOptions; ShippingServiceOptionsType[] opt = new ShippingServiceOptionsType[10]; if (oItem.ShippingDetails.ShippingServiceOptions.Count == 0) { szShippingType = "NOTKNOWN"; } else { opt[0] = oItem.ShippingDetails.ShippingServiceOptions[0]; if (opt[0].ShippingServiceCost == null) { szShippingType = "FREE"; } else { if (opt[0].ShippingServiceCost.Value > 0) { szShippingType = "NOT FREE"; } else { szShippingType = "FREE"; } } } nNumberofTotalListing = nNumberofTotalListing + 1; //oItem.ShippingDetails.ShippingServiceOptions. //if (oItem.ShippingDetails.ShippingServiceOptions.IndexO == ShippingTypeCodeType.Free) //if (oItem.ShippingDetails.ShippingType == ShippingTypeCodeType.Free) // szShippingType = "FREE"; if (oItem.SellingStatus.HighBidder != null) { /*if (!(chkbx_OnlyRelistOnes.Checked)) * { * dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, oItem.SellingStatus.HighBidder.UserID); * }*/ nNumberofSoldListing = nNumberofSoldListing + 1; nTotalAmount = nTotalAmount + Convert.ToDouble(oItem.SellingStatus.CurrentPrice.Value); } else { if (oItem.ListingDetails.RelistedItemID == null) { // dataGridView1.Rows.Add(oItem.ItemID, oItem.ListingType, oItem.Title, oItem.SubTitle, oItem.ListingDetails.StartTime.ToShortDateString(), oItem.ListingDetails.EndTime.ToShortDateString(), oItem.SellingStatus.CurrentPrice.Value, "DNS"); nEligibleItemForRelist += 1; } else { nAlreadyRelistedCount += 1; } } /**/ /*Get the data from the inventory header so that we can load this main db*/ /*************************************************************************/ szSelectString = " "; int outnumber = 0; //jdInvShipDate = new DateTime(0); if (int.TryParse(szItemArray[0].ToString(), out outnumber)) //if (int.TryParse(szItemArray[0].ToString()), out value) { szSelectString = "Select * from InventoryHeader where INVITEM = " + szItemArray[0]; OleDbCommand cmd_InvMon = new OleDbCommand(szSelectString, conn_newdb2); OleDbDataReader reader_InvMon = cmd_InvMon.ExecuteReader(); while (reader_InvMon.Read()) { if (reader_InvMon != null) { if ((reader_InvMon["INVDATE"].ToString() != null) && reader_InvMon["INVDATE"].ToString() != " " && reader_InvMon["INVDATE"].ToString() != "") { jddate = Convert.ToDateTime(reader_InvMon["INVDATE"].ToString()); } if ((reader_InvMon["INVSOLDDATE"].ToString() != null) && reader_InvMon["INVSOLDDATE"].ToString() != " " && reader_InvMon["INVSOLDDATE"].ToString() != "") { jdInvShipDate = Convert.ToDateTime(reader_InvMon["INVSOLDDATE"].ToString()); } else { jdInvShipDate = Convert.ToDateTime("01/01/1974"); } if ((reader_InvMon["INVLISTEDDATE"].ToString() != null) && reader_InvMon["INVLISTEDDATE"].ToString() != " " && reader_InvMon["INVLISTEDDATE"].ToString() != "") { jdListedDate = Convert.ToDateTime(reader_InvMon["INVLISTEDDATE"].ToString()); } szInventoryCamera = reader_InvMon["INVCAMERA"].ToString(); szInventoryCategory = reader_InvMon["INVHEADER"].ToString(); szInventoryLocation = reader_InvMon["INVLOCATION"].ToString(); szInventorySource = reader_InvMon["INVCHECKINDATE"].ToString(); dInvPrice = Convert.ToDouble(reader_InvMon["INVPRICE"].ToString()); } break; } } /*************************************************************************/ szDescription = ""; //szDescription = oItem.Description; //szDescription = szDescription.Replace("\"", "\"\""); if (CheckRecordExistence(szItemArray[0], oItem.ItemID)) { //Update szInsertString = ""; szInsertString = "Update EbayAnalysis Set " + "SoldDate = " + "\"" + oItem.ListingDetails.EndTime.AddHours(-7) + "\"," + "ListedDate = " + "\"" + oItem.ListingDetails.StartTime.AddHours(-7) + "\"," + "HighBidder = " + "\"" + szHighBidder + "\"," + "SoldPrice = " + oItem.SellingStatus.CurrentPrice.Value + "," + "Description = " + "\"" + szDescription + "\"," + "Category = " + "\"" + oItem.PrimaryCategory.CategoryID + "\"," + "CategoryDescription = " + "\"" + oItem.PrimaryCategory.CategoryName + "\"," + "ShippingType = " + "\"" + szShippingType + "\"," + "InventoryDate = " + "\"" + jddate + "\"," + "InventoryShipDate = " + "\"" + jdInvShipDate + "\"," + //"InventoryListedDate = " + "\"" + jdListedDate + "\"," + "InventoryCategory = " + "\"" + szInventoryCategory + "\"," + "InventoryCamera = " + "\"" + szInventoryCamera + "\"," + "InventoryLocation = " + "\"" + szInventoryLocation + "\"," + "InventorySource = " + "\"" + szInventorySource + "\"," + "InventoryPrice = " + dInvPrice + "," + "QtySold = " + nQtySold + "," + "QtyAvailable = " + nQtyAvail + "," + "LotSize = " + nLotSize + " Where ( CustomItemNumber = " + "\"" + szItemArray[0] + "\"" + "AND " + "EbayItemNumber = " + "\"" + oItem.ItemID + "\"" + ")"; } else { szInsertString = ""; szInsertString = "insert into EbayAnalysis (" + "CustomItemNumber," + "EbayItemNumber," + "SoldDate," + "ListedDate," + "HighBidder," + "StartingPrice," + "SoldPrice," + "NumberOfDays," + "Title," + "SubTitle," + "Description," + "Category," + "CategoryDescription," + "ShippingType," + "InventoryDate," + "InventoryShipDate," + "InventoryListedDate," + "InventoryCategory," + "InventoryCamera," + "InventoryLocation," + "InventorySource," + "InventoryPrice," + "QtySold," + "QtyAvailable," + "LotSize" + ") VALUES ( " + "\"" + szItemArray[0] + "\"," + oItem.ItemID + "," + "\"" + oItem.ListingDetails.EndTime.AddHours(-7) + "\"," + "\"" + oItem.ListingDetails.StartTime.AddHours(-7) + "\"," + "\"" + szHighBidder + "\"," + oItem.StartPrice.Value + "," + oItem.SellingStatus.CurrentPrice.Value + "," + "0" + "," + "\"" + szTitle + "\"" + "," + "\"" + szSubTitle + "\"" + "," + "\"" + szDescription + "\"," + "\"" + oItem.PrimaryCategory.CategoryID + "\"," + "\"" + oItem.PrimaryCategory.CategoryName + "\"," + "\"" + szShippingType + "\"," + "\"" + jddate + "\"," + "\"" + jdInvShipDate + "\"," + "\"" + jdListedDate + "\"," + "\"" + szInventoryCategory + "\"," + "\"" + szInventoryCamera + "\"," + "\"" + szInventoryLocation + "\"," + "\"" + szInventorySource + "\"," + dInvPrice + "," + nQtySold + "," + nQtyAvail + "," + nLotSize + ")"; } OleDbCommand cmd6 = new OleDbCommand(szInsertString, conn_newdb); cmd6.ExecuteNonQuery(); nCount++; label1.Text = nCount.ToString(); label1.Refresh(); } pagenumber += 1; } conn_newdb.Close(); conn_newdb2.Close(); //pagenumber += 1; } catch (ApiException oApiEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oApiEx.Message; return; } catch (SdkException oSdkEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oSdkEx.Message; return; } catch (Exception oEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do txtResults.Text = oEx.Message; return; } Cursor.Current = Cursors.Default; }