private void btGuardar_Click(object sender, EventArgs e)
        {
            clsPrecio nuevoPrecio;

            nuevoPrecio = new clsPrecio(Convert.ToInt32(lblId.Text), LasMedidas[cmbMedida.SelectedIndex], Convert.ToDecimal(nudPrecio.Value));
            nuevoPrecio.InsertarPrecio();
            MessageBox.Show("Precio Registrado");
        }
Esempio n. 2
0
        public static List <clsPrecio> ListarPreciosProductoMedida(int parIdProducto, string parNombreMed)
        {
            List <clsPrecio> x        = new List <clsPrecio>();
            SqlConnection    conexion = new SqlConnection(mdlVariables.CadenaDeConexion);
            SqlCommand       cmd      = new SqlCommand("usp_Producto_Listar_PrecioMedida", conexion);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@parIdProducto", parIdProducto);
            cmd.Parameters.AddWithValue("@parNombre", parNombreMed);
            conexion.Open();
            SqlDataReader cont;

            cont = cmd.ExecuteReader();

            while (cont.Read() == true)
            {
                clsPrecio MiObjeto;
                MiObjeto = new clsPrecio(Convert.ToInt32(cont["IdProducto"]), cont["Nombre"].ToString(), Convert.ToDecimal(cont["Precio"]));
                x.Add(MiObjeto);
            }
            conexion.Close();
            return(x);
        }