Esempio n. 1
0
        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);
        }
        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;
        }
        public static void UpdateInventory(string accountName, string token, string itemId, int qty, string sku, int isVariation, int soldQty, double startPrice)
        {
            ApiContext context = new ApiContext();

            context.ApiCredential.eBayToken = token;
            context.SoapApiServerUrl        = "https://api.ebay.com/wsapi";
            context.ApiLogManager           = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", false, false, false));
            context.ApiLogManager.EnableLogging = true;
            context.Version = "861";
            context.Site    = SiteCodeType.US;
            ReviseFixedPriceItemCall reviseFixedPriceItemCall = new ReviseFixedPriceItemCall(context);
            ItemType item = new ItemType();

            try
            {
                if (isVariation == 0)
                {
                    item.ItemID            = itemId;
                    item.QuantityAvailable = qty;
                    item.Quantity          = qty;
                    //item.StartPrice.Value = startPrice;
                    reviseFixedPriceItemCall.Item = item;
                    reviseFixedPriceItemCall.Execute();
                }
                else
                {
                    item.ItemID = itemId;
                    VariationType           simpleType = new VariationType();
                    VariationTypeCollection vtc        = new VariationTypeCollection();
                    VariationsType          vsType     = new VariationsType();

                    simpleType.SKU      = sku;
                    simpleType.Quantity = qty;
                    vtc.Add(simpleType);
                    vsType.Variation = vtc;
                    item.Variations  = vsType;
                    reviseFixedPriceItemCall.Item = item;
                    reviseFixedPriceItemCall.Execute();
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility exceptionUtility = new ExceptionUtility();
                exceptionUtility.CatchMethod(ex, "UpdateInventoryByReviseFixedPriceItem ", accountName + ":" + itemId + "(" + sku + ")" + " " + ex.Message.ToString(), senderEmail, messageFromPassword, messageToEmail, smtpClient, smtpPortNum);
            }
        }
Esempio n. 4
0
        public bool UpdateProductWeight(string eBayID, string sku, decimal weight)
        {
            ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(context);
            ItemType item = new ItemType();

            item.ItemID = eBayID;
            item.SKU    = sku;
            item.ShippingDetails.CalculatedShippingRate.WeightMajor.Value = weight;

            reviseFP.Item = item;
            reviseFP.Execute();

            return(reviseFP.ApiResponse.Ack != AckCodeType.Failure);
        }
Esempio n. 5
0
        private static void ReviseFixedPriceItem(string itemID, double price)
        {
            //create the context
            ApiContext context = new ApiContext();

            //set the User token
            string token = AppSettingsHelper.Token;

            context.ApiCredential.eBayToken = token;

            //set the server url
            string endpoint = AppSettingsHelper.Endpoint;

            context.SoapApiServerUrl = endpoint;

            //enable logging
            context.ApiLogManager = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("log.txt", true, true, true));
            context.ApiLogManager.EnableLogging = true;

            //set the version
            context.Version = "817";
            context.Site    = SiteCodeType.US;

            ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(context);

            ItemType item = new ItemType();

            item.ItemID = itemID;

            //Basic (Title revision)
            item.StartPrice = new AmountType
            {
                Value      = price,
                currencyID = CurrencyCodeType.USD
            };

            reviseFP.Item = item;

            reviseFP.Execute();
            Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised ItemID " + reviseFP.ItemID);
        }
Esempio n. 6
0
        private void buttonEditVenta_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            decimal precio;
            var     result = XtraInputBox.Show("Nuevo precio:", "Cambiar precio de venta (envío NO incluido)", ebay_seguimiento.PRECIO.ToString());

            if (result != "")
            {
                try
                {
                    precio = fnSpreciodprecio(result);
                    ItemType item = new ItemType();
                    item.ItemID = ebay_seguimiento.ARTICULO;
                    CredencialesEbay credencialeebay = new CredencialesEbay();
                    credencialeebay.cuenta = ebay_seguimiento.VENDEDOR;
                    ReviseFixedPriceItemCall reviseFP = new ReviseFixedPriceItemCall(credencialeebay.context);
                    item.StartPrice = new AmountType {
                        currencyID = CurrencyCodeType.EUR, Value = (double)precio
                    };
                    item.ItemID   = ebay_seguimiento.ARTICULO;
                    reviseFP.Item = item;
                    try
                    {
                        reviseFP.Execute();
                        FuncionesEbay.fnGrabarErrorEbayArticulo(ebay_seguimiento.ARTICULO, "");
                    }
                    catch (Exception ex)
                    {
                        FuncionesEbay.fnGrabarErrorEbayArticulo(ebay_seguimiento.ARTICULO, ex.Message);
                    }
                    Console.WriteLine(reviseFP.ApiResponse.Ack + " Revised SKU " + reviseFP.ItemID);
                }
                catch
                {
                    XtraMessageBox.Show("Error en el precio", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }