Exemple #1
0
        private void CodigoBarraTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (string.IsNullOrEmpty(CodigoBarraTextBox.Text))
                {
                    return;
                }

                Producto producto = _servicioProductos.GetProductoPorCodigoDeBarras(CodigoBarraTextBox.Text);
                if (producto != null)
                {
                    var index = AgregarProductoEnGrilla(producto);
                    CodigoBarraTextBox.Clear();
                    DialogResult dr = MessageBox.Show("¿Ingresa cantidad?", "Mensaje",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                      MessageBoxDefaultButton.Button2);
                    if (dr == DialogResult.No)
                    {
                        CalcularMostrarTotales();

                        return;
                    }

                    IngresarCantidad(index);
                }

                CalcularMostrarTotales();
            }
        }
Exemple #2
0
        private void txtCodigoBarra_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (string.IsNullOrEmpty(txtCodigoBarra.Text) ||
                    string.IsNullOrWhiteSpace(txtCodigoBarra.Text))
                {
                    return;
                }
                Producto producto = servicio.GetProductoPorCodigoDeBarras(txtCodigoBarra.Text);

                if (producto == null)
                {
                    //TODO: Se puede sacar un msj de error
                    return;
                }
                AgregarProductoEnGrilla(producto);
                ActualizarTotales();
                txtCodigoBarra.Clear();
            }
        }