private void aceptarArticulo() { try { if (!(validarBusqueda())) { return; } //MessageBox.Show("Seleccionó ID: " + DsArt.Tables[0].Rows[0]["CÓDIGO"].ToString() + " DESCRIPCION: " + DsArt.Tables[0].Rows[0]["DESCRIPCIÓN"].ToString()); Entidades.Articulo Articulo = new Entidades.Articulo(); Entidades.Venta Venta = new Entidades.Venta(); DataSet DsArticulo = new DataSet(); UInt64 IdArticulo; Int32 Cantidad; if (txtCantidad.Text.Trim() == "") { txtCantidad.Text = "1"; } IdArticulo = UInt64.Parse(grdResultados.Rows[filaSeleccionada].Cells["ID"].Value.ToString()); DsArticulo = Articulo.obtenerArticulos(IdArticulo.ToString()); if (DsArticulo.Tables[0].Rows.Count > 0) { IdArticulo = UInt64.Parse(DsArticulo.Tables[0].Rows[0]["CÓDIGO"].ToString()); Cantidad = Int32.Parse(txtCantidad.Text); Venta.guardarArticuloVentaTemporal(IdArticulo, Cantidad); } else { MessageBox.Show("Artículo inexistente en la Base de Datos"); } this.Close(); } catch (Exception ex) { fg.mostrarErrorTryCatch(ex); } }
private void btnAceptar_Click(object sender, EventArgs e) { try { //MessageBox.Show("Seleccionó ID: " + DsArt.Tables[0].Rows[0]["CÓDIGO"].ToString() + " DESCRIPCION: " + DsArt.Tables[0].Rows[0]["DESCRIPCIÓN"].ToString()); Entidades.Articulo Articulo = new Entidades.Articulo(); Entidades.Venta Venta = new Entidades.Venta(); DataSet DsArticulo = new DataSet(); Int64 IdArticulo; Int32 Cantidad; IdArticulo = Int64.Parse(grdResultados.Rows[filaSeleccionada].Cells["ID"].Value.ToString()); DsArticulo = Articulo.obtenerArticulos(IdArticulo.ToString()); if (DsArticulo.Tables[0].Rows.Count > 0) { IdArticulo = Int64.Parse(DsArticulo.Tables[0].Rows[0]["CÓDIGO"].ToString()); Cantidad = Int32.Parse(txtCantidad.Text); Venta.guardarArticuloVentaTemporal(IdArticulo, Cantidad); } else { MessageBox.Show("Artículo inexistente en la Base de Datos"); } this.Hide(); } catch (Exception ex) { fg.mostrarErrorTryCatch(ex); } }
private void txtCodigoArticulo_KeyPress(object sender, KeyPressEventArgs e) { try { fg.keyPressNumerosDecimales(e, txtCodigoArticulo); if (e.KeyChar == 13 && txtCodigoArticulo.Text.Length > 0) { //SI APRETO ENTER EJECUTO ESTE CODIGO DataSet DsArticulo = new DataSet(); Entidades.Articulo Articulo = new Entidades.Articulo(); //Entidades.Venta Venta = new Entidades.Venta(); if (txtCantidad.Text.Trim() == "") { txtCantidad.Text = "1"; } DsArticulo = Articulo.obtenerArticulos(txtCodigoArticulo.Text); if (DsArticulo.Tables[0].Rows.Count > 0) { Venta.guardarArticuloVentaTemporal(UInt64.Parse(txtCodigoArticulo.Text), Int32.Parse(txtCantidad.Text)); } else { buscarArticuloYGuardarVentaTemporal(); } cargarArticulosEnGrilla(); //grdItemsVenta = fg.formatoGrilla(grdItemsVenta, 9); txtCodigoArticulo.Text = String.Empty; txtCantidad.Text = "1"; txtCodigoArticulo.Focus(); } } catch (Exception ex) { fg.mostrarErrorTryCatch(ex); } }