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 simpleButton1_Click(object sender, EventArgs e) { String o; CredencialesEbay credencialesebay = new CredencialesEbay(); foreach (string cuenta in credencialesebay.Cuentas) { XmlDocument xml = new XmlDocument(); xml.LoadXml(o = LeerPoliticas(cuenta)); XmlNodeList elemList = xml.GetElementsByTagName("PaymentProfile"); foreach (XmlNode elem in elemList) { AnadirPolitica(elem, cuenta); } elemList = xml.GetElementsByTagName("ShippingPolicyProfile"); foreach (XmlNode elem in elemList) { AnadirPolitica(elem, cuenta); } } }
private string LeerPoliticas(string cuenta) { CredencialesEbay credencialesebay = new CredencialesEbay(); credencialesebay.cuenta = cuenta; string xmlRequest = @"<?xml version=""1.0"" encoding=""utf-8""?> <getSellerProfilesRequest xmlns=""http://www.ebay.com/marketplace/selling/v1/services""> <includeDetails>true</includeDetails> </getSellerProfilesRequest>"; WebRequest request = WebRequest.Create("https://svcs.ebay.com/services/selling/v1/SellerProfilesManagementService"); request.ContentType = "text/xml"; request.Method = "POST"; request.Headers.Add("X-EBAY-SOA-SERVICE-NAME", "SellerProfilesManagementService"); request.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "getSellerProfiles"); request.Headers.Add("X-EBAY-SOA-SERVICE-VERSION", "1.0.0"); request.Headers.Add("X-EBAY-SOA-GLOBAL-ID", "EBAY-ES"); request.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", credencialesebay.context.ApiCredential.eBayToken); request.Headers.Add("X-EBAY-SOA-REQUEST-DATA-FORMAT", "XML"); byte[] byteArray = Encoding.UTF8.GetBytes(xmlRequest); request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); dataStream.Dispose(); WebResponse response = request.GetResponse(); //<-- error here dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string output = reader.ReadToEnd(); reader.Close(); reader.Dispose(); return(output); }
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); } } }
public ArticulosUserControl() { InitializeComponent(); this.Dock = DockStyle.Fill; this.HandleDestroyed += handleDestroyed; if (File.Exists("Layouts\\Articulos\\gridViewArticulos.xml")) { gridViewArticulos.RestoreLayoutFromXml("Layouts\\Articulos\\gridViewArticulos.xml"); } if (File.Exists("Layouts\\Articulos\\layout.xml")) { layoutControl1.RestoreLayoutFromXml("Layouts\\Articulos\\layout.xml"); } RegistryKey reg = Registry.CurrentUser.OpenSubKey("\\SOFTWARE\\Rajotero\\Articulos", true); if (reg == null) { reg = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Rajotero\\Articulos"); } if (reg != null) { radioGroupRajotero.SelectedIndex = (int)reg.GetValue("Rajotero", 0); radioGroupEscandallo.SelectedIndex = (int)reg.GetValue("Escandallo", 0); radioGroupActivos.SelectedIndex = (int)reg.GetValue("Activo", 0); textEditPalabras.Text = (string)reg.GetValue("Palabras", ""); textEditDelEnvio.Text = (string)reg.GetValue("Envio", ""); } if (File.Exists("Layouts\\Articulos\\gridViewCompras.xml")) { gridViewCompras.RestoreLayoutFromXml("Layouts\\Articulos\\gridViewCompras.xml"); } MyEntityModel.ApplicationDbContextSql dbContext = new MyEntityModel.ApplicationDbContextSql(); dbContext.TipoArticulos.Load(); repositoryItemLookUpEditTipoArticulo1.DataSource = dbContext.TipoArticulos.Local.ToBindingList(); repositoryItemLookUpEditTipoArticulo1.DisplayMember = "Nombre"; repositoryItemLookUpEditTipoArticulo1.ValueMember = "TipoArticuloID"; FechaActualizacionTotalesArticulo(); GridColumn colStock = new GridColumn(); colStock.FieldName = "Stock"; colStock.Caption = "Stock"; colStock.UnboundType = DevExpress.Data.UnboundColumnType.Decimal; gridViewArticulos.Columns.Add(colStock); colStock.VisibleIndex = 0; colUnidadesRecibidas.FieldName = "UnidadesRecibidas"; colUnidadesRecibidas.Caption = "UnidadesRecibidas"; colUnidadesRecibidas.UnboundType = DevExpress.Data.UnboundColumnType.Decimal; gridViewArticulos.Columns.Add(colUnidadesRecibidas); colUnidadesRecibidas.VisibleIndex = 0; LoadSource(); // Prevent the focused cell from being highlighted. gridViewArticulos.OptionsSelection.EnableAppearanceFocusedCell = false; // Draw a dotted focus rectangle around the entire row. gridViewArticulos.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; CredencialesEbay credenciales = new CredencialesEbay(); foreach (string cuenta in credenciales.Cuentas) { LayoutControlItem item1 = layoutControlCuentas.Root.AddItem(); item1.Name = "Ebay " + cuenta; item1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; item1.MaxSize = new Size(205, 30); ComboBoxEdit comboBoxEdit1 = new DevExpress.XtraEditors.ComboBoxEdit(); comboBoxEdit1.Name = "Ebay " + cuenta; comboBoxEdit1.Properties.Items.AddRange(new object[] { "Todos", "Publicados", "Sin publicar" }); comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; comboBoxEdit1.Properties.PopupFormSize = new Size(50, comboBoxEdit1.Properties.PopupFormSize.Height); comboBoxEdit1.Size = new Size(50, comboBoxEdit1.Properties.PopupFormSize.Height); comboBoxEdit1.SelectedIndex = (int)reg.GetValue(comboBoxEdit1.Name, 0); item1.Control = comboBoxEdit1; } foreach (string cuenta in Global.CuentasAmazon) { LayoutControlItem item1 = layoutControlCuentas.Root.AddItem(); item1.Name = "Amazon " + cuenta; item1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom; item1.MaxSize = new Size(205, 30); ComboBoxEdit comboBoxEdit1 = new DevExpress.XtraEditors.ComboBoxEdit(); comboBoxEdit1.Name = "Amazon " + cuenta; comboBoxEdit1.Properties.Items.AddRange(new object[] { "Todos", "Publicados", "Sin publicar" }); comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; comboBoxEdit1.Properties.PopupFormSize = new Size(50, comboBoxEdit1.Properties.PopupFormSize.Height); comboBoxEdit1.Size = new Size(50, comboBoxEdit1.Properties.PopupFormSize.Height); comboBoxEdit1.SelectedIndex = (int)reg.GetValue(comboBoxEdit1.Name, 0); item1.Control = comboBoxEdit1; } }