コード例 #1
0
        public void Actualizar(clsPrecio NuevosDatos)
        {
            SqlConnection conexion = new SqlConnection(mdlVariables.CadenaDeConexion);
            SqlCommand    comando  = new SqlCommand("usp_Precio_Actualizar", conexion);

            comando.CommandType = System.Data.CommandType.StoredProcedure;
            comando.Parameters.AddWithValue("@parIdProducto_P", IdProductoInt);
            comando.Parameters.AddWithValue("@parIdMedida_P", IdMedidaInt);
            comando.Parameters.AddWithValue("@parNUEVO_Precio", NuevosDatos.Precio);
            conexion.Open();
            comando.ExecuteNonQuery();
            conexion.Close();
        }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         clsPrecio nuevoPrecio;
         nuevoPrecio = new clsPrecio(Convert.ToInt32(lblIdProducto.Text), LasMedidas[cmbMedida.SelectedIndex], Convert.ToDecimal(nudPrecio.Value));
         nuevoPrecio.InsertarPrecio();
         MessageBox.Show("Precio Registrado");
     }
     catch (Exception ErrorRegProd)
     {
         MessageBox.Show(ErrorRegProd.Message);
     }
 }
コード例 #3
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            //Crear un objeto de la clase clsPrecio que tenga
            //  los nuevos datos
            clsPrecio nuevoPrecio;

            nuevoPrecio = new clsPrecio(Convert.ToInt32(lblIdProducto.Text), Convert.ToInt32(lblIdMedida.Text), Convert.ToDecimal(nudPrecio.Value));
            PrecioSeleccionado.Actualizar(nuevoPrecio);
            MessageBox.Show("Datos actualizados satisfactoriamente.");

            //Bloquear todo
            btnGuardar.Visible          = false;
            btnActualizarPrecio.Visible = true;
            txtTexto.Clear();
            nudPrecio.Enabled = false;
            //limpiar
            lstvPrecio.Items.Clear();
            txtProducto.Clear();
            txtMedida.Clear();
            nudPrecio.Value = 0;
        }
コード例 #4
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_Precio_Listar_ProductoMedida", conexion);

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

            cont = cmd.ExecuteReader();

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