Example #1
0
        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
            {
            }
        }
Example #2
0
        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("");
        }
Example #3
0
        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);
        }