Beispiel #1
0
        static public Entidades.SprayBoom buscarSprayBoom(string id)
        {
            Conexion.OpenConnection();
            Entidades.SprayBoom s = new Entidades.SprayBoom();

            string       query   = "Select* from SprayBoom Where idSprayBoom LIKE @idSprayBoom";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSprayBoom", id);
            comando.Prepare();
            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                s.Boquilla    = reader.GetString("boquilla");
                s.Capacidad   = reader.GetDouble("capacidad");
                s.IdSprayBoom = reader.GetString("idSprayBoom");
                s.Km          = reader.GetString("km");
                s.Marcha      = reader.GetString("marcha");
                s.Metodo      = reader.GetString("metodo");
                s.Psi         = reader.GetDouble("psi");
                s.Rpm         = reader.GetDouble("rpm");

                Conexion.CloseConnection();
                return(s);
            }
            //retorna valores nulos en caso de no encontrar coincidencias
            Conexion.CloseConnection();
            return(s);
        }
Beispiel #2
0
        static public void eliminar(Entidades.SprayBoom s)
        {
            Conexion.OpenConnection();

            string       query   = "DELETE from SprayBoom WHERE idSprayBoom = @idSprayBoom";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSprayBoom", s.IdSprayBoom);
            comando.Prepare();

            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Beispiel #3
0
        static public void modificar(Entidades.SprayBoom s)
        {
            Conexion.OpenConnection();

            string       query   = "UPDATE sprayboom set capacidad = @capacidad, psi = @psi, rpm = @rpm, boquilla = @boquilla, km = @km, marcha = @marcha, metodo = @metodo WHERE idSprayBoom = @idSprayBoom";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSprayBoom", s.IdSprayBoom);
            comando.Parameters.AddWithValue("@capacidad", s.Capacidad);
            comando.Parameters.AddWithValue("@psi", s.Psi);
            comando.Parameters.AddWithValue("@rpm", s.Rpm);
            comando.Parameters.AddWithValue("@boquilla", s.Boquilla);
            comando.Parameters.AddWithValue("@km", s.Km);
            comando.Parameters.AddWithValue("@marcha", s.Marcha);
            comando.Parameters.AddWithValue("@metodo", s.Metodo);
            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }
Beispiel #4
0
        static public void insertar(Entidades.SprayBoom s)
        {
            Conexion.OpenConnection();

            string       query   = "insert into sprayboom (idSprayBoom, capacidad, psi, rpm, boquilla, km, marcha, metodo) values(@idSprayBoom, @capacidad, @psi, @rpm, @boquilla, @km, @marcha, @metodo)";
            MySqlCommand comando = new MySqlCommand(query, Conexion.Connection);

            comando.Parameters.AddWithValue("@idSprayBoom", s.IdSprayBoom);
            comando.Parameters.AddWithValue("@capacidad", s.Capacidad);
            comando.Parameters.AddWithValue("@psi", s.Psi);
            comando.Parameters.AddWithValue("@rpm", s.Rpm);
            comando.Parameters.AddWithValue("@boquilla", s.Boquilla);
            comando.Parameters.AddWithValue("@km", s.Km);
            comando.Parameters.AddWithValue("@marcha", s.Marcha);
            comando.Parameters.AddWithValue("@metodo", s.Metodo);

            comando.Prepare();
            comando.ExecuteNonQuery();

            Conexion.CloseConnection();
        }