public void cargarData(string val) { try { CapaNegocio.Producto bib = new CapaNegocio.Producto(); bib.Id_producto = int.Parse(val); if (bib.buscarProducto()) { txtID.Text = val; txtNombre.Text = bib.Nombre_producto; txtMarca.Text = bib.Marca_producto; txtMarca.Text = bib.Marca_producto; txtPrecio.Text = bib.Precio_producto.ToString(); txtStock.Text = bib.Stock_producto.ToString(); } else { } } catch (Exception ex) { Console.WriteLine("Error :" + ex.Message); } }
protected void btnConsultar_Click(object sender, EventArgs e) { try { CapaNegocio.Producto bib = new CapaNegocio.Producto(); bib.Id_producto = int.Parse(txtID.Text); if (bib.buscarProducto()) { txtNombre.Text = bib.Nombre_producto; txtMarca.Text = bib.Marca_producto; txtMarca.Text = bib.Marca_producto; txtPrecio.Text = bib.Precio_producto.ToString(); txtStock.Text = bib.Stock_producto.ToString(); lblMensaje.Text = string.Empty; } else { lblMensaje.Text = "Producto no existe"; limpiar(); } } catch (Exception ex) { lblMensaje.Text = "Error : " + ex.Message; limpiar(); } }