Exemplo n.º 1
0
        public static int salida(int existencia, string modelo, int unidades)
        {
            MySqlConnection y = new MySqlConnection();

            y = y.ObtenerConexion();
            int retorno = 0;

            existencia = existencia - unidades;
            MySqlCommand registrarEntrada = new MySqlCommand(string.Format("Update almacen1 set EXISTENCIA = '" + existencia + "' where MODELO = '" + modelo + "'"), BDGeneral.ObtenerConexion(y));

            retorno = registrarEntrada.ExecuteNonQuery();
            return(retorno);
        }
Exemplo n.º 2
0
        public static int Alta(Producto producto)
        {
            MySqlConnection x = new MySqlConnection();

            x = x.ObtenerConexion();
            int          retorno  = 0;
            MySqlCommand insertar = new MySqlCommand(string.Format("insert into almacen1 (MODELO, MARCA, DESCRIPCION, EXISTENCIA, PRECIOIVA, PRECIOUNI ) values ('{0}','{1}','{2}', '{3}', '{4}', '{5}')",
                                                                   producto.modelo, producto.marca, producto.descripcion, producto.existencia, producto.precioIVA, producto.precioUnitario), BDGeneral.ObtenerConexion(x));

            retorno = insertar.ExecuteNonQuery();
            return(retorno);
        }
Exemplo n.º 3
0
        public static List <Producto> consulta(string Modelo, string Marca)
        {
            MySqlConnection w = new MySqlConnection();

            w = w.ObtenerConexion();
            List <Producto> Tabla  = new List <Producto>();
            MySqlCommand    buscar = new MySqlCommand(string.Format("select  *from almacen1 where modelo like '" + Modelo + "' or marca like '" + Marca + "' "), BDGeneral.ObtenerConexion(w));
            MySqlDataReader Lector = buscar.ExecuteReader();

            while (Lector.Read())
            {
                Producto producto = new Producto();
                producto.modelo         = Lector.GetString(0);
                producto.marca          = Lector.GetString(1);
                producto.descripcion    = Lector.GetString(2);
                producto.existencia     = Lector.GetInt32(3);
                producto.precioIVA      = Lector.GetFloat(4);
                producto.precioUnitario = Lector.GetFloat(5);
                Tabla.Add(producto);
            }



            return(Tabla);
        }