public static void fnGrabarErrorEbayArticulo(string articulo, string error) { MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); EBAY_SEGUIMIENTO ebay_seguimiento = new EBAY_SEGUIMIENTO(); try { ebay_seguimiento = dbContext.EBAY_SEGUIMIENTO.Where(w => w.ARTICULO == articulo).FirstOrDefault(); } catch (Exception edb) { Console.WriteLine("Error en dbContext " + edb); return; } if (ebay_seguimiento == null) { return; } ebay_seguimiento.TextoError = error; try { dbContext.SaveChanges(); } catch { } }
private void PintarImagenesEbay(MyEntityModel.EBAY_SEGUIMIENTO row) { MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); dbContext.LeerArticuloEbay(row.ARTICULO, row.VENDEDOR, row.ARTICULO_MIO, row.CODIGO); EBAY_SEGUIMIENTO ebay = dbContext.EBAY_SEGUIMIENTO.Where(w => w.ARTICULO == row.ARTICULO).FirstOrDefault(); List <string> ListaImagenes = new List <string>(); imageSliderEbay.Images.Clear(); ListaImagenes.Clear(); if (ebay.PictureURL != null) { string[] URLs = ebay.PictureURL.Split('\t'); foreach (string url in URLs) { Uri uri = new Uri(url); string fil = uri.Segments[5]; fil = fil.Remove(fil.Length - 1); fil = fil + ".jpg"; var directorio = string.Format(".\\{0}\\{1}\\{2}\\{3}", fil[0], fil[1], fil[2], fil[3]); Directory.CreateDirectory(directorio); fil = directorio + "\\" + fil; if (!System.IO.File.Exists(fil)) { WebClient webClient = new WebClient(); webClient.DownloadFile(url, fil); } imageSliderEbay.Images.Add(Image.FromFile(fil)); } } }
private void gridViewEbay_Click(object sender, EventArgs e) { GridView view = gridViewEbay; int currentRowHandle = view.FocusedRowHandle; MyEntityModel.EBAY_SEGUIMIENTO row = (MyEntityModel.EBAY_SEGUIMIENTO)view.GetRow(currentRowHandle); MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); List <EBAY_SEGUIMIENTO> articulos = dbContext.EBAY_SEGUIMIENTO.Where(w => w.CODIGO.Trim() == row.ARTICULO_MIO).ToList(); codigoActual = row.ARTICULO_MIO.Trim(); gridControlEbaycompetencia.DataSource = articulos; if (!LayoutControlEbaycompetenciaCargada) { if (File.Exists("Layouts\\EbayUserControl\\gridViewEbaycompetencia.xml")) { gridViewEbaycompetencia.RestoreLayoutFromXml("Layouts\\EbayUserControl\\gridViewEbaycompetencia.xml"); } LayoutControlEbaycompetenciaCargada = true; } if (layoutControlGroupImagenes.Visible) { // PintarImagenesEbay(row); // new Thread(new ThreadStart(PintarImagenesEbay(row))).Start(); Thread thread = new Thread(() => PintarImagenesEbay(row)); thread.Start(); } costosEbayUserControl1.articuloEbayID = row.ARTICULO; }
void PonerDisponibleArticulo_click(object sender, EventArgs e) { GridView view = gridViewEbay; int currentRowHandle = view.FocusedRowHandle; MyEntityModel.EBAY_SEGUIMIENTO row = (MyEntityModel.EBAY_SEGUIMIENTO)view.GetRow(currentRowHandle); CredencialesEbay credencialeebay = new CredencialesEbay(); credencialeebay.cuenta = row.VENDEDOR; ItemType item = new ItemType(); ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(credencialeebay.context); item.Quantity = 20; item.ItemID = row.ARTICULO; reviseFP.Item = item; try { reviseFP.Execute(); FuncionesEbay.fnGrabarErrorEbayArticulo(row.ARTICULO, ""); } catch (Exception ex) { FuncionesEbay.fnGrabarErrorEbayArticulo(row.ARTICULO, ex.Message); } Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised SKU " + reviseFP.ItemID); }
private void gridViewEbaycompetencia_Click(object sender, EventArgs e) { GridView view = gridViewEbaycompetencia; int currentRowHandle = view.FocusedRowHandle; MyEntityModel.EBAY_SEGUIMIENTO row = (MyEntityModel.EBAY_SEGUIMIENTO)view.GetRow(currentRowHandle); new Thread(() => PintarImagenesEbayCompetencia(row)).Start(); }
void AbrirArticulo_click(object sender, EventArgs e) { GridView view = gridViewEbay; int currentRowHandle = view.FocusedRowHandle; MyEntityModel.EBAY_SEGUIMIENTO row = (MyEntityModel.EBAY_SEGUIMIENTO)view.GetRow(currentRowHandle); System.Diagnostics.Process.Start("http://www.ebay.es/itm/" + row.ARTICULO); }
public static ItemType LeerArticuloEbay(String ArticuloID) { MyEntityModel.RepuestosDeMovilesDbContext dbContext = new MyEntityModel.RepuestosDeMovilesDbContext(); EBAY_SEGUIMIENTO es = dbContext.EBAY_SEGUIMIENTO.Where(w => w.ARTICULO == ArticuloID).FirstOrDefault(); if (es != null) { return(LeerArticuloEbay(ArticuloID, es.VENDEDOR)); } return(null); }
public static void fnAnadirCompetenciaSeguimiento(ItemType item, string codigoActual) { EBAY_SEGUIMIENTO ebay_seguimiento = new EBAY_SEGUIMIENTO(); fnCopiarArticuloEbaySeguimiento(item, ebay_seguimiento); ebay_seguimiento.CODIGO = codigoActual; RepuestosDeMovilesDbContext dbcontext = new RepuestosDeMovilesDbContext(); dbcontext.EBAY_SEGUIMIENTO.Add(ebay_seguimiento); dbcontext.SaveChanges(); }
public static void fnCopiarArticuloEbaySeguimiento(ItemType Item, EBAY_SEGUIMIENTO ebay_seguimiento) { ebay_seguimiento.ARTICULO = Item.ItemID; 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.VENDEDOR = Item.Seller.UserID; ebay_seguimiento.PRECIO_VENTA = ebay_seguimiento.PRECIO + ebay_seguimiento.ENVIO; ebay_seguimiento.StoreCategoryID = Item.Storefront.StoreCategoryID; ebay_seguimiento.StoreCategory2ID = Item.Storefront.StoreCategory2ID; ebay_seguimiento.PrimaryCategoryID = Item.PrimaryCategory.CategoryID.ToString(); if (Item.SecondaryCategory != null) { ebay_seguimiento.SecondaryCategoryID = Item.SecondaryCategory.CategoryID.ToString(); } if (Item.SellerProfiles != null) { if (Item.SellerProfiles.SellerPaymentProfile != null) { ebay_seguimiento.ProfileIDPayment = Item.SellerProfiles.SellerPaymentProfile.PaymentProfileID; } if (Item.SellerProfiles.SellerShippingProfile != null) { ebay_seguimiento.ProfileIDShipping = Item.SellerProfiles.SellerShippingProfile.ShippingProfileID; } } ebay_seguimiento.TextoError = ""; }
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(""); }
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); }