private void TxtCodigo_Validating(object sender, CancelEventArgs e) { try { TxtNombre.Text = ""; TxtPrecio.Text = ""; WSArticulos.ServicioArticulos sArts = new WSArticulos.ServicioArticulos(); WSArticulos.Articulo art = sArts.BuscarArticulo(Convert.ToInt32(TxtCodigo.Text)); if (art != null) { TxtNombre.Text = art.Nombre; TxtPrecio.Text = art.Precio.ToString(); BtnBaja.Enabled = true; BtnModificar.Enabled = true; BtnAlta.Enabled = false; } else { BtnBaja.Enabled = false; BtnModificar.Enabled = false; BtnAlta.Enabled = true; } } catch (Exception ex) { LblError.Text = ex.Message; } }
private void BtnAlta_Click(object sender, EventArgs e) { try { WSArticulos.Articulo art = new WSArticulos.Articulo(); art.Codigo = Convert.ToInt32(TxtCodigo.Text); art.Nombre = TxtNombre.Text; art.Precio = Convert.ToDecimal(TxtPrecio.Text); WSArticulos.ServicioArticulos Service = new WSArticulos.ServicioArticulos(); Service.AltaArticulo(art); btnDefdecto(); losNO.Add(art.Codigo); toolStripStatusLabel1.Text = "Alta correcta"; } catch (SoapException ex) { toolStripStatusLabel1.Text = ex.Detail.InnerText; } catch (Exception ex) { toolStripStatusLabel1.Text = ex.Message; } }
private void ListarArticulos_Load(object sender, EventArgs e) { WSArticulos.ServicioArticulos service = new WSArticulos.ServicioArticulos(); WSArticulos.Articulo[] lista = service.ListarArticulo(); DGVListado.DataSource = lista; }