public void GetItem() { bool includeCrossPromotion = true; bool includeItemSpecifics = true; bool includeTaxTable = false; bool includeWatchCount = true; ItemType item = null; Assert.IsNotNull(TestData.NewItem2, "Failed because no item available -- requires successful AddItem test"); GetItemCall api = new GetItemCall(this.apiContext); api.IncludeCrossPromotion = includeCrossPromotion; api.IncludeItemSpecifics = includeItemSpecifics; api.IncludeTaxTable = includeTaxTable; api.IncludeWatchCount = includeWatchCount; api.ItemID = TestData.NewItem2.ItemID; api.Execute(); //check whether the call is success. Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "do not success!"); Assert.IsNotNull(api.ApiResponse.Item); item = api.ApiResponse.Item; Assert.IsTrue(item.ItemSpecifics.Count > 0, "this is no item spcifics"); Assert.IsTrue(item.WatchCount >= 0); }
public void ReviseFixedPriceItem() { ItemType itemTest = TestData.NewFixedPriceItem; Assert.IsNotNull(itemTest); // ReviseFixedPriceItemCall rviCall = new ReviseFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = itemTest.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 2.89; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.Item = item; rviCall.Execute(); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); //check whether the call is success. Assert.IsTrue(rviCall.AbstractResponse.Ack == AckCodeType.Success || rviCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!"); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(itemTest.ItemID); Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // Update itemTest. TestData.NewFixedPriceItem = returnedItem; }
private List <ZohoLead> GetBestOfferLead(List <ZohoLead> leads, ItemType item, BestOfferType offer) { try { var checkLead = leads.Where(i => i.UserId == offer.Buyer.UserID).FirstOrDefault(); if (checkLead == null) { var lead = new ZohoLead() { ItemDescription = item.Description, UserId = offer.Buyer.UserID, EbayItemId = item.ItemID, Offers = new List <Offer>() { new Offer() { OfferAmount = offer.Price.Value, OfferExpirationDate = offer.ExpirationTime } }, Email = offer.Buyer.Email, FirstName = offer.Buyer.UserFirstName, LastName = offer.Buyer.UserLastName, //PageViews = (int)item.HitCount, //Watchers = (int)item.WatchCount, }; apiContext = GetApiContext(); GetItemCall call = new GetItemCall(apiContext); call.ItemID = item.ItemID; call.IncludeWatchCount = true; call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ItemType ebayItem = call.GetItem(item.ItemID); lead.ItemDescription = ebayItem.Description; lead.PageViews = (int)ebayItem.HitCount; lead.Watchers = (int)ebayItem.WatchCount; leads.Add(lead); } else { checkLead.Offers.Add( new Offer() { OfferAmount = offer.Price.Value, OfferExpirationDate = offer.ExpirationTime } ); } return(leads); } catch (Exception ex) { Trace.TraceError(ex.Message); throw ex; } }
// http://developer.ebay.com/devzone/xml/docs/reference/ebay/getitem.html public ItemType GetItem(string itemid) { var call = new GetItemCall(api); call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); var item = call.GetItem(itemid); responseXML = call.SoapResponse; return(item); }
// Ebay API: GetItem // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetItem.html // Use this call to retrieve the data for a single item listed on an eBay site public static bool GetEbayItem(AccountType account) { GetItemCall getItemApiCall = new GetItemCall(account.SellerApiContext); getItemApiCall.ItemID = "130824387148"; DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnSummary }; getItemApiCall.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType itemType = getItemApiCall.GetItem("130824387148"); return(true); }
private List <ZohoLead> GetBidderLead(List <ZohoLead> leads, ItemType item, OfferType bidder) { try { var checkLead = leads.Where(i => i.UserId == bidder.User.UserID).FirstOrDefault(); if (checkLead == null) { var lead = new ZohoLead() { ItemDescription = item.Description, UserId = bidder.User.UserID, EbayItemId = item.ItemID, HighBidAmount = bidder.HighestBid.Value, TimeBid = bidder.TimeBid, Email = bidder.User.Email, FirstName = bidder.User.UserFirstName, LastName = bidder.User.UserLastName, //PageViews = (int)item.HitCount, //Watchers = (int)item.WatchCount, }; apiContext = GetApiContext(); GetItemCall call = new GetItemCall(apiContext); call.ItemID = item.ItemID; call.IncludeWatchCount = true; call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ItemType ebayItem = call.GetItem(item.ItemID); lead.ItemDescription = ebayItem.Description; lead.PageViews = (int)ebayItem.HitCount; lead.Watchers = (int)ebayItem.WatchCount; leads.Add(lead); } else { checkLead.HighBidAmount = bidder.HighestBid.Value; checkLead.TimeBid = bidder.TimeBid; } return(leads); } catch (Exception ex) { Trace.TraceError(ex.Message); throw ex; } }
public void TestMethod1() { var context = new ApiContext { ApiCredential = new ApiCredential { eBayToken = eBayToken }, CallRetry = new CallRetry { MaximumRetries = 5 } }; //GetApiAccessRulesCall apicall = new GetApiAccessRulesCall(context); //var rules = apicall.GetApiAccessRules(); GetItemCall apical2 = new GetItemCall(context); var rules11 = apical2.GetItem("323269291886"); }
public ItemType GetSoldItemSnapshot(string orderLineItemID) { try { var apiContext = _eBayApiContextProvider.GetAPIContext(); var getItemCall = new GetItemCall(apiContext); ItemType retItem = null; var orderLineItemIDSpilt = orderLineItemID.Split('-'); if (orderLineItemIDSpilt.Count() == 2) { var detailLevel = new DetailLevelCodeTypeCollection(); detailLevel.Add(DetailLevelCodeType.ItemReturnDescription); var getItemRequest = new GetItemRequestType() { ItemID = orderLineItemIDSpilt[0], TransactionID = orderLineItemIDSpilt[1], DetailLevel = detailLevel }; int failTimes = 0; bool isSuccess = false; do { try { var response = getItemCall.ExecuteRequest(getItemRequest) as GetItemResponseType; //lstSoldItem.Add(response.Item); isSuccess = true; retItem = response.Item; } catch (Exception ex) { failTimes++; LogManager.Instance.Error($"Get item itemID:{getItemRequest.ItemID}, transactionID:{getItemRequest.TransactionID} failed. {ex.ToString()}"); } }while (failTimes < 5 && !isSuccess); //if (!isSuccess) // throw new Exception($"Get item itemID:{getItemRequest.ItemID}, transactionID:{getItemRequest.TransactionID} failed for {failTimes} times."); } return(retItem); //return lstSoldItem.ToArray(); } catch (Exception ex) { LogManager.Instance.Error(ex.ToString()); throw ex; } }
private List <ZohoLead> GetMemberMessageLead(List <ZohoLead> leads, ItemType item, MemberMessageExchangeType message) { try { var checkLead = leads.Where(i => i.UserId == message.Question.SenderID).FirstOrDefault(); if (checkLead == null) { var lead = new ZohoLead() { //ItemDescription = item.Description, UserId = message.Question.SenderID, //PageViews = (int)message.Item.HitCount, //Watchers = (int)message.Item.WatchCount, EbayItemId = item.ItemID, Email = message.Question.SenderEmail, MemberMessage = $"{message.CreationDate} - {message.Question.Body}\n" }; apiContext = GetApiContext(); GetItemCall call = new GetItemCall(apiContext); call.ItemID = item.ItemID; call.IncludeWatchCount = true; call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ItemType ebayItem = call.GetItem(item.ItemID); lead.ItemDescription = ebayItem.Description; lead.PageViews = (int)ebayItem.HitCount; lead.Watchers = (int)ebayItem.WatchCount; leads.Add(lead); } else { checkLead.MemberMessage += $"{message.CreationDate} - {message.Question.Body}\n"; } return(leads); } catch (Exception ex) { Trace.TraceError(ex.Message); throw ex; } }
private void simpleButton1_Click(object sender, EventArgs e) { credencialesEbay.cuenta = "ofertasparati"; GetItemCall getItemcall = new GetItemCall(credencialesEbay.context); getItemcall.ItemID = "272416907107"; getItemcall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); getItemcall.IncludeItemSpecifics = true; getItemcall.Execute(); ItemType item = getItemcall.ApiResponse.Item; NameValueListType i = item.Variations.VariationSpecificsSet.ItemAt(0); //item.SKU = "pepe"; //ReviseItemCall RIC = new ReviseItemCall(credencialesEbay.context); //RIC.Item = item; //RIC.Execute(); //ReviseFixedPriceItemCall RI = new ReviseFixedPriceItemCall(credencialesEbay.context); //RI.Item = item; //RI.Execute(); }
public async Task <ItemType> GetItem(CommerceContext commerceContext, string itemId) { using (var activity = CommandActivity.Start(commerceContext, this)) { //Instantiate the call wrapper class var apiCall = new GetItemCall(await GetEbayContext(commerceContext).ConfigureAwait(false)); try { var result = apiCall.GetItem(itemId); return(result); } catch (Exception ex) { await commerceContext.AddMessage("Warn", "Ebay.GetItem.Exception", new Object[] { ex }, ex.Message).ConfigureAwait(false); } return(new ItemType()); } }
/// <summary> /// get an item /// </summary> /// <param name="itemId"></param> /// <param name="metrics"></param> /// <returns></returns> public static ItemType GetItem(string itemId, CallMetricsTable metrics) { Debug.Assert(itemId != null); Debug.Assert(itemId.Length > 0); try { ApiContext ctx = GetContext(); ctx.EnableMetrics = true; ctx.CallMetricsTable = metrics; GetItemCall call = new GetItemCall(ctx); call.Site = SiteCodeType.US; ItemType item = call.GetItem(itemId); return(CheckForErrors("GetItem", call) ? item : null); } catch (Exception e) { ShowException("GetItem(" + itemId + ")", e); return(null); } }
void AddItems() { try { ApiContext apiContext = GetApiContext(); AddFixedPriceItemCall addApiCall = new AddFixedPriceItemCall(apiContext); GetItemCall getApiCall = new GetItemCall(apiContext); GetSellerListCall listApiCall = new GetSellerListCall(apiContext); EndItemsCall endApiCall = new EndItemsCall(apiContext); ModelDataContext context = new ModelDataContext(); articles = (from current in context.Articles orderby current.ArticleNumber where current.AmountOnStock > 0 select current).Take(2); EndActiveAuctions(articles); System.Threading.Thread.Sleep(5000); foreach (Article article in articles) { try { //create a new ItemType object corresponding to article-backend data with fix quantity of 99 pieces an add it ItemType item = BuildItem(article); addApiCall.AddFixedPriceItem(item); } catch (Exception ex) { Assert.Fail(ex.Message); } } } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void RelistFixedPriceItem() { Assert.IsNotNull(TestData.EndedFixedPriceItem); // RelistFixedPriceItemCall rviCall = new RelistFixedPriceItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = TestData.EndedFixedPriceItem.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 1.98; item.StartPrice.currencyID = CurrencyCodeType.USD; rviCall.RelistFixedPriceItem(item, null); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); // Call GetItem and then compare the startPrice. GetItemCall getItem = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); ItemType returnedItem = getItem.GetItem(item.ItemID); // Make sure it's relisted. /* * Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value, * TestData.EndedItem); */ Assert.AreEqual(returnedItem.StartPrice.Value, item.StartPrice.Value); // End the new created item. EndItemCall api = new EndItemCall(this.apiContext); // Set the item to be ended. api.ItemID = item.ItemID; api.EndingReason = EndReasonCodeType.NotAvailable; api.Execute(); }
private List <ZohoLead> GetBidderLead(List <ZohoLead> leads, GetItemResponseType item) { try { var lead = new ZohoLead() { ItemDescription = item.Item.Description, //PageViews = (int)item.Item.HitCount, //Watchers = (int)item.Item.WatchCount, UserId = item.Item.SellingStatus.HighBidder.UserID, EbayItemId = item.Item.ItemID, HighBidAmount = item.Item.SellingStatus.CurrentPrice.Value, TimeBid = item.Timestamp, Email = item.Item.SellingStatus.HighBidder.Email, FirstName = item.Item.SellingStatus.HighBidder.UserFirstName, LastName = item.Item.SellingStatus.HighBidder.UserLastName }; apiContext = GetApiContext(); GetItemCall call = new GetItemCall(apiContext); call.ItemID = item.Item.ItemID; call.IncludeWatchCount = true; call.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ItemType ebayItem = call.GetItem(item.Item.ItemID); lead.ItemDescription = ebayItem.Description; lead.PageViews = (int)ebayItem.HitCount; lead.Watchers = (int)ebayItem.WatchCount; leads.Add(lead); return(leads); } catch (Exception ex) { Trace.TraceError(ex.Message); throw ex; } }
static void Main(string[] args) { try { Console.WriteLine("+++++++++++++++++++++++++++++++++++++++"); Console.WriteLine("+ Welcome to eBay SDK for .Net Sample +"); Console.WriteLine("+ - ConsoleGetItemUsingOAuth +"); Console.WriteLine("+++++++++++++++++++++++++++++++++++++++"); //Initialize eBay ApiContext object ApiContext apiContext = GetApiContext(); //Create Call object and execute the Call GetItemCall apiCall = new GetItemCall(apiContext); apiCall.ItemID = ConfigurationManager.AppSettings["ItemID"].ToString(); apiCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); apiCall.Execute(); Console.WriteLine("Begin to call eBay API, please wait ..."); Console.WriteLine("End to call eBay API, show call result ..."); Console.WriteLine(); //Handle the result returned Console.WriteLine("ItemID: " + apiCall.Item.ItemID.ToString()); Console.WriteLine(); Console.WriteLine(); } catch (Exception ex) { Console.WriteLine("Failed to get user data : " + ex.Message); } Console.WriteLine(); Console.WriteLine("Press any key to close the program."); Console.ReadKey(); }
/// <summary> /// get an item. /// </summary> /// <param name="itemGet"></param> /// <param name="apiContext"></param> /// <param name="message"></param> /// <param name="itemOut"></param> /// <returns></returns> public static bool GetItem(ItemType itemGet, ApiContext apiContext, out string message, out ItemType itemOut) { message = string.Empty; itemOut = null; bool includeCrossPromotion = true; bool includeItemSpecifics = true; bool includeTaxTable = true; bool includeWatchCount = true; try { GetItemCall api = new GetItemCall(apiContext); DetailLevelCodeType detaillevel = DetailLevelCodeType.ReturnAll; api.DetailLevelList = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { detaillevel }); itemOut = api.GetItem(itemGet.ItemID, includeWatchCount, includeCrossPromotion, includeItemSpecifics, includeTaxTable, null, null, null, null, false); if (itemOut == null) { message = "do not get the item"; } if (itemOut.ItemID != itemGet.ItemID) { message = "the item getted is not the same as item wanted"; } } catch (Exception e) { message = e.Message; return(false); } return(true); }
public string LeerArticuloEbay(String ArticuloID, string cuenta, string articulo_mio, string codigo) { MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); MyEntityModel.ApplicationDbContextSql dbContextSql = new MyEntityModel.ApplicationDbContextSql(); CredencialesEbay credencialeebay = new CredencialesEbay(); credencialeebay.cuenta = cuenta; ItemType Item; GetItemCall ap = new GetItemCall(credencialeebay.context); ap.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ap.IncludeItemSpecifics = true; try { Item = ap.GetItem(ArticuloID); } catch (ApiException oApiEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Console.WriteLine("1 " + oApiEx.Message); return(oApiEx.Message); } catch (SdkException oSdkEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Console.WriteLine("2 " + oSdkEx.Message); return(oSdkEx.Message); } catch (Exception oEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Console.WriteLine("3 " + oEx.Message); return(oEx.Message); } EBAY_SEGUIMIENTO ebay_seguimiento = new EBAY_SEGUIMIENTO(); try { ebay_seguimiento = dbContext.EBAY_SEGUIMIENTO.Where(w => w.ARTICULO == Item.ItemID).FirstOrDefault(); } catch (Exception edb) { Console.WriteLine("Error en dbContext " + edb); } if (ebay_seguimiento != null) { ebay_seguimiento.Descripcion = Item.Description; ebay_seguimiento.DISPONIBLES = Item.Quantity - Item.SellingStatus.QuantitySold; ebay_seguimiento.ENVIO = (decimal?)Item.ShippingDetails.ShippingServiceOptions[0].ShippingServiceCost.Value; ebay_seguimiento.IMAGEN_EBAY = Item.PictureDetails.PictureURL[0]; ebay_seguimiento.PRECIO = (decimal?)Item.StartPrice.Value; ebay_seguimiento.SUBTITULO = Item.SubTitle; ebay_seguimiento.TITULO = Item.Title; ebay_seguimiento.VENDIDOS = Item.SellingStatus.QuantitySold; ebay_seguimiento.VENDIDOS_SEMANA = Ventas(ebay_seguimiento.ARTICULO_MIO, ebay_seguimiento.VENDEDOR, 7); ebay_seguimiento.VENDIDOS_MES = Ventas(ebay_seguimiento.ARTICULO_MIO, ebay_seguimiento.VENDEDOR, 30); ebay_seguimiento.FECHA = DateTime.Now; ebay_seguimiento.PictureURL = string.Join("\t", Item.PictureDetails.PictureURL.ToArray()); dbContext.SaveChanges(); return(""); } else { ebay_seguimiento = new EBAY_SEGUIMIENTO(); ebay_seguimiento.VENDEDOR = Item.Seller.UserID; ebay_seguimiento.ARTICULO = Item.ItemID; ebay_seguimiento.CODIGO = codigo; ebay_seguimiento.TITULO = Item.Title; ebay_seguimiento.SUBTITULO = Item.SubTitle; ebay_seguimiento.Descripcion = Item.Description; ebay_seguimiento.DISPONIBLES = Item.Quantity - Item.SellingStatus.QuantitySold; ebay_seguimiento.ENVIO = (decimal?)Item.ShippingDetails.ShippingServiceOptions[0].ShippingServiceCost.Value; ebay_seguimiento.IMAGEN_EBAY = Item.PictureDetails.PictureURL[0]; ebay_seguimiento.PRECIO = (decimal?)Item.StartPrice.Value; ebay_seguimiento.VENDIDOS = Item.SellingStatus.QuantitySold; ebay_seguimiento.VENDIDOS_SEMANA = Ventas(ebay_seguimiento.ARTICULO_MIO, ebay_seguimiento.VENDEDOR, 7); ebay_seguimiento.VENDIDOS_MES = Ventas(ebay_seguimiento.ARTICULO_MIO, ebay_seguimiento.VENDEDOR, 30); ebay_seguimiento.FECHA = DateTime.Now; ebay_seguimiento.PictureURL = string.Join("\t", Item.PictureDetails.PictureURL); dbContext.EBAY_SEGUIMIENTO.Add(ebay_seguimiento); dbContext.SaveChanges(); } return(""); }
private static void OnTimer() { using (var context = new EbayDb()) { var items = context.Listings.Where(x => !x.IsUsed); if (items.Any()) { #region foreach (var item in items.ToList()) { GetItemCall apiCall = new GetItemCall(apiContext); var status = apiCall.GetItem(item.ListingID).SellingStatus.ListingStatus; if (status == ListingStatusCodeType.Active) { item.ApiCallType = ApiCallTypes.Updating; item.Revise(apiContext); } else if (status == ListingStatusCodeType.Completed || status == ListingStatusCodeType.Ended) { item.ApiCallType = ApiCallTypes.Relisting; item.Relist(apiContext); } itemsList.Add(item); if (item.IsApiCallSuccess) { if (item.ApiCallType == ApiCallTypes.Updating) { item.IsUsed = true; context.SaveChanges(); } else if (item.ApiCallType == ApiCallTypes.Relisting) { using (TransactionScope scope = new TransactionScope()) { context.DeleteObject(item); var newItem = new Listings { ListingID = item.RelistedItemID, RelistedItemID = item.ListingID, MPN = item.MPN, SellingPrice = item.SellingPrice, Quantity = item.Quantity, IsUsed = true }; context.Listings.AddObject(newItem); context.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave); scope.Complete(); context.AcceptAllChanges(); } } } } #endregion CreateXmlFile(itemsList); } } itemsList.Clear(); RestartTimer(); }
public static ItemType LeerArticuloEbay(String ArticuloID, string cuenta) { new Thread(delegate() { fnNotificacion(" Leyendo " + ArticuloID); }).Start(); MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); MyEntityModel.ApplicationDbContextSql dbContextSql = new MyEntityModel.ApplicationDbContextSql(); CredencialesEbay credencialeebay = new CredencialesEbay(); credencialeebay.cuenta = cuenta; ItemType Item; GetItemCall ap = new GetItemCall(credencialeebay.context); ap.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); ap.IncludeItemSpecifics = true; try { Notificacion(ArticuloID, 1); Item = ap.GetItem(ArticuloID); } catch (ApiException oApiEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Debug.WriteLine("1 " + oApiEx.Message); fnGrabarErrorEbayArticulo(ArticuloID, oApiEx.Message); return(null); } catch (SdkException oSdkEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Debug.WriteLine("2 " + oSdkEx.Message); fnGrabarErrorEbayArticulo(ArticuloID, oSdkEx.Message); return(null); } catch (Exception oEx) { // process exception ... pass to caller, implement retry logic here or in caller, whatever you want to do Debug.WriteLine("3 " + oEx.Message); fnGrabarErrorEbayArticulo(ArticuloID, oEx.Message); return(null); } EBAY_SEGUIMIENTO ebay_seguimiento = new EBAY_SEGUIMIENTO(); try { ebay_seguimiento = dbContext.EBAY_SEGUIMIENTO.Where(w => w.ARTICULO == Item.ItemID).FirstOrDefault(); } catch (Exception edb) { Debug.WriteLine("Error en dbContext " + edb); } if (ebay_seguimiento != null) { Debug.WriteLine("Articulo " + ArticuloID + " Leido"); fnCopiarArticuloEbaySeguimiento(Item, ebay_seguimiento); try { dbContext.SaveChanges(); Debug.WriteLine("Articulo " + ArticuloID + " Grabado"); } catch { Debug.WriteLine("Articulo " + ArticuloID + " ****** ERROR AL GRABAR ******"); } } return(Item); }
public ItemType[] GeteBaySellerListBySKUs(GeteBaySellerListBySKUsRequest request) { try { if (string.IsNullOrEmpty(request.SellerID)) { throw new Exception("No Seller ID"); } var apiContext = _eBayAPIContextProvider.GetAPIContextBySellerID(request.SellerID); var getItemCall = new GetItemCall(apiContext); getItemCall.DetailLevelList.Add(DetailLevelCodeType.ItemReturnDescription); var lstSellerListing = new List <ItemType>(); var getSellerListCall = new GetSellerListCall(apiContext); getSellerListCall.EndTimeFrom = DateTime.Now.ToUniversalTime(); getSellerListCall.EndTimeTo = DateTime.Now.AddDays(90).ToUniversalTime(); getSellerListCall.SKUArrayList = new StringCollection(); foreach (var sku in request.SKUs) { getSellerListCall.SKUArrayList.Add(sku.ToUpper()); } int pageNumber = 1; int pageSize = 50; int totalPage = 1; PaginationType pageInfo = new PaginationType(); do { pageInfo.PageNumber = pageNumber; pageInfo.EntriesPerPage = pageSize; getSellerListCall.Pagination = pageInfo; getSellerListCall.GetSellerList(); if (getSellerListCall.PaginationResult != null) { totalPage = getSellerListCall.PaginationResult.TotalNumberOfPages; } if (getSellerListCall.ItemList != null) { foreach (var listItem in getSellerListCall.ItemList.ToArray()) { try { var item = getItemCall.GetItem(listItem.ItemID); if (item != null) { lstSellerListing.Add(item); } } catch (Exception ex) { LogManager.Instance.Error(ex.Message); } } } pageNumber++; }while (pageNumber <= totalPage); return(lstSellerListing.ToArray()); } catch (Exception ex) { throw ex; } }
private void BtnGetItem_Click(object sender, System.EventArgs e) { try { TxtTitle.Text = ""; TxtCategory.Text = ""; TxtCategory2.Text = ""; TxtCurrentPrice.Text = ""; TxtBuyItNowPrice.Text = ""; TxtBidCount.Text = ""; TxtHighBidder.Text = ""; TxtStartTime.Text = ""; TxtEndTime.Text = ""; TxtQuantity.Text = ""; TxtQuantitySold.Text = ""; LblItemIdResult.Text = ""; TxtCategory2Id.Text = ""; TxtCategoryId.Text = ""; Context.CallRetry = GetCallRetry(); GetItemCall apicall = new GetItemCall(Context); apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); fetchedItem = apicall.GetItem(TxtItemId.Text); // Set values from the item returned TxtTitle.Text = fetchedItem.Title; TxtCategory.Text = fetchedItem.PrimaryCategory.CategoryName; TxtCategoryId.Text = fetchedItem.PrimaryCategory.CategoryID; if (fetchedItem.SecondaryCategory != null) { TxtCategory2.Text = fetchedItem.SecondaryCategory.CategoryName; TxtCategory2Id.Text = fetchedItem.SecondaryCategory.CategoryID; } TxtCurrentPrice.Text = fetchedItem.SellingStatus.CurrentPrice.Value.ToString(); TxtBuyItNowPrice.Text = fetchedItem.BuyItNowPrice.Value.ToString(); TxtBidCount.Text = fetchedItem.SellingStatus.BidCount.ToString(); if (fetchedItem.SellingStatus.HighBidder != null) { TxtHighBidder.Text = fetchedItem.SellingStatus.HighBidder.UserID; } TxtStartTime.Text = fetchedItem.ListingDetails.StartTime.ToString(); TxtEndTime.Text = fetchedItem.ListingDetails.EndTime.ToString(); TxtQuantity.Text = fetchedItem.Quantity.ToString(); TxtQuantitySold.Text = fetchedItem.SellingStatus.QuantitySold.ToString(); TxtBestOfferCount.Text = "0"; TxtBestOfferEnabled.Text = "False"; if (fetchedItem.BestOfferDetails != null) { TxtBestOfferCount.Text = fetchedItem.BestOfferDetails.BestOfferCount.ToString(); TxtBestOfferEnabled.Text = fetchedItem.BestOfferDetails.BestOfferEnabled.ToString(); } if (fetchedItem.PayPalEmailAddress != null) { TxtPayPalEmailAddress.Text = fetchedItem.PayPalEmailAddress.ToString(); } if (fetchedItem.ApplicationData != null) { TxtApplicationData.Text = fetchedItem.ApplicationData.ToString(); } //if (fetchedItem.ProductListingDetails != null) // TxtProductID.Text = fetchedItem.ProductListingDetails.ProductID; TxtPictureURL.Text = ""; if (fetchedItem.PictureDetails != null) { StringCollection PictureURLs = fetchedItem.PictureDetails.PictureURL; string PictureURL = ""; for (int i = 0; PictureURLs != null && i < PictureURLs.Count; i++) { PictureURL += PictureURLs[i] + ","; } TxtPictureURL.Text = PictureURL; } TxtSite.Text = fetchedItem.Site.ToString(); TxtListType.Text = fetchedItem.ListingType.ToString(); mItemID = fetchedItem.ItemID; LblItemIdResult.Text = "Item Id: " + fetchedItem.ItemID; if (LblItemIdResult.Text.Length > 0) { BtnRelistItem.Visible = true; BtnReviseItem.Visible = true; BtnEndItem.Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void RelistItem() { Assert.IsNotNull(TestData.EndedItem); // RelistItemCall rviCall = new RelistItemCall(this.apiContext); ItemType item = new ItemType(); item.ItemID = TestData.EndedItem.ItemID; item.StartPrice = new AmountType(); item.StartPrice.Value = 1.98; item.StartPrice.currencyID = CurrencyCodeType.USD; //StringCollection modList = new StringCollection(); //modList.Add("item.startPrice"); //ModifiedFieldType[] mfList = eBayUtil.CopyModifiedList(modList, null); //rviCall.ModifiedFields = mfList; //verify first VerifyRelistItemCall vriCall = new VerifyRelistItemCall(this.apiContext); vriCall.Item = item; vriCall.Execute(); FeeTypeCollection fees = vriCall.FeeList; Assert.IsNotNull(fees); GetItemCall getItem1 = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels1 = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem1.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels1); ItemType returnedItem1 = getItem1.GetItem(item.ItemID); // Make sure it's relisted. /* * Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value, * TestData.EndedItem); */ Assert.AreNotEqual(returnedItem1.StartPrice.Value, item.StartPrice.Value); rviCall.Item = item; rviCall.RelistItem(item); // Let's wait for the server to "digest" the data. System.Threading.Thread.Sleep(1000); // Call GetItem and then compare the startPrice. GetItemCall getItem2 = new GetItemCall(this.apiContext); DetailLevelCodeType[] detailLevels2 = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; getItem2.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels2); ItemType returnedItem2 = getItem2.GetItem(item.ItemID); // Make sure it's relisted. /* * Assert.AreEqual(returnedItem.ListingDetails.getRelistedItemID().Value, * TestData.EndedItem); */ Assert.AreEqual(returnedItem2.StartPrice.Value, item.StartPrice.Value); // End the new created item. EndItemCall api = new EndItemCall(this.apiContext); // Set the item to be ended. api.ItemID = item.ItemID; api.EndingReason = EndReasonCodeType.NotAvailable; api.Execute(); }
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; } }