public void buscar() { modProducto modProducto = new modProducto(); try { string operacion; operacion = "WHERE Barra LIKE '%" + txtBuscar.Text + "%' OR Descripcion LIKE '%" + txtBuscar.Text + "%' OR Marca like '%" + txtBuscar.Text + "%' OR Categoria like '%" + txtBuscar.Text + "%'"; grilla.DataSource = modProducto.cargarProductoTabla(operacion).Tables["rsProducto"]; } catch (MySqlException ex) { MessageBox.Show(ex.StackTrace); } }
public void buscarProducto() { modProducto modProducto = new modProducto(); productoAComprar = new DataSet(); string condicion = ""; if (IsNumeric(txtCodigoProducto.Text) == true) { condicion = " where id = " + txtCodigoProducto.Text + " or CodigoDeBarra = '" + txtCodigoProducto.Text + "'"; } else { condicion = " where CodigoDeBarra = '" + txtCodigoProducto.Text + "'"; } productoAComprar = modProducto.cargarProducto(condicion); if (Convert.ToInt32(productoAComprar.Tables["rsProducto"].Rows.Count) == 0) { Interaction.MsgBox("Producto No existente"); txtCodigoProducto.Focus(); } else { modSesion = new modSesion(); lblCodigo.Text = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["id"]); lblDescricion.Text = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["Descripcion"]); string costomedio; costomedio = Convert.ToString(productoAComprar.Tables["rsProducto"].Rows[0]["CostoMedio"]); txtCosto.Text = Convert.ToString(modSesion.mascaraCosto(costomedio)); txtCostoMedio.Text = Convert.ToString(modSesion.mascaraCosto(productoAComprar.Tables["rsProducto"].Rows[0]["CostoMedio"])); txtCostoReal.Text = Convert.ToString(modSesion.mascaraCosto(productoAComprar.Tables["rsProducto"].Rows[0]["Costo"])); txtStock.Text = Convert.ToString(modSesion.mascaraCantidad(productoAComprar.Tables["rsProducto"].Rows[0]["Stock"])); txtCantidad.Focus(); } }
private void frmBuscarProducto_Load(object sender, EventArgs e) { modProducto modProducto = new modProducto(); grilla.DataSource = modProducto.cargarProductoTabla("").Tables["rsProducto"]; }