Ejemplo n.º 1
0
        public static SeleccionProducto getSeleccionProducto(int idSeleccion)
        {
            //creo la conexion
            SqlConnection cnn = new SqlConnection(Conexion.Connection);

            //abro la conexion
            cnn.Open();

            //Creo el comando sql a utlizar
            SqlCommand cmd = new SqlCommand("select idSeleccion, nombre, observacion from SeleccionProducto Where idSeleccion = @idSeleccion");

            //Cargo el valor del parametro
            cmd.Parameters.Add(new SqlParameter("@idSeleccion", idSeleccion));
            //asigno la conexion al comando
            cmd.Connection = cnn;

            SeleccionProducto tp = new SeleccionProducto();
            //creo el datareader
            SqlDataReader obdr = cmd.ExecuteReader();

            //recorro el datareader
            while (obdr.Read())
            {
                tp.IdSeleccionProducto = obdr.GetInt32(0);
                tp.Nombre      = obdr.GetString(1);
                tp.Observacion = obdr.GetString(2);
            }
            cnn.Close();
            return(tp);
        }
Ejemplo n.º 2
0
        private void VerProductosButton_Click(object sender, EventArgs e)
        {
            SeleccionProducto TraeProducto = new SeleccionProducto();

            if (TraeProducto.ShowDialog() == DialogResult.OK)
            {
                Producto             = BuscaProducto(TraeProducto.IdProductoSeleccionado);
                ProductoTextBox.Text = Producto.Descripcion;
                CantidadNumericUpDown.Focus();
            }
        }
Ejemplo n.º 3
0
        private void VerProductosButton_Click(object sender, EventArgs e)
        {
            LimpiarProductoGroupBox();
            SeleccionProducto TraeProducto = new SeleccionProducto();

            if (TraeProducto.ShowDialog() == DialogResult.OK)
            {
                Productos ProductoTraido = BuscaProducto(TraeProducto.IdProductoSeleccionado);
                LlenaCamposProducto(ProductoTraido);
                CantidadNumericUpDown.Focus();
            }
        }