예제 #1
0
        public static Acteur GetActeur(string id)
        {
            string       naam     = string.Empty;
            DateTime     dob      = new DateTime(1, 1, 1);
            string       woonplek = string.Empty;
            string       baan     = string.Empty;
            List <Prijs> prijzen  = new List <Prijs>();
            List <Film>  films    = new List <Film>();

            using (connection = new OracleConnection(connectionstring))
            {
                query           = "SELECT f.filmid, f.titel FROM film f, filmacteurregel fcr WHERE f.filmid = fcr.filmid AND fcr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection  = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        films.Add(new Film(reader.GetInt32(0).ToString(), reader.GetString(1)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query           = "SELECT p.titel, p.jaar, p.prizeid FROM acteurprijsregel apr, prijs p WHERE p.prizeid = apr.prizeid AND apr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection  = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        prijzen.Add(new Prijs(reader.GetString(0), reader.GetInt32(1), reader.GetInt32(2)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query           = "SELECT a.naam, a.dob, a.woonplek, a.baan FROM acteur a WHERE a.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection  = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        naam     = reader.GetString(0);
                        dob      = reader.GetDateTime(1);
                        woonplek = reader.GetString(2);
                        baan     = reader.GetString(3);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            Acteur acteur = new Acteur(naam, dob, woonplek, baan, prijzen, films, Convert.ToInt32(id));

            return(acteur);
        }
예제 #2
0
        public static Acteur GetActeur(string id)
        {
            string naam = string.Empty;
            DateTime dob = new DateTime(1, 1, 1);
            string woonplek = string.Empty;
            string baan = string.Empty;
            List<Prijs> prijzen = new List<Prijs>();
            List<Film> films = new List<Film>();

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT f.filmid, f.titel FROM film f, filmacteurregel fcr WHERE f.filmid = fcr.filmid AND fcr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        films.Add(new Film(reader.GetInt32(0).ToString(), reader.GetString(1)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT p.titel, p.jaar, p.prizeid FROM acteurprijsregel apr, prijs p WHERE p.prizeid = apr.prizeid AND apr.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        prijzen.Add(new Prijs(reader.GetString(0), reader.GetInt32(1), reader.GetInt32(2)));
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }

            using (connection = new OracleConnection(connectionstring))
            {
                query = "SELECT a.naam, a.dob, a.woonplek, a.baan FROM acteur a WHERE a.acteurid = :pid";
                cmd.CommandText = query;
                cmd.Connection = connection;

                try
                {
                    connection.Open();
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("id", Convert.ToInt32(id));
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        naam = reader.GetString(0);
                        dob = reader.GetDateTime(1);
                        woonplek = reader.GetString(2);
                        baan = reader.GetString(3);
                    }
                }
                catch (Exception ex)
                {
                    cmd.Dispose();
                    connection.Dispose();
                    reader.Close();
                }
            }
            Acteur acteur = new Acteur(naam, dob, woonplek, baan, prijzen, films, Convert.ToInt32(id));
            return acteur;
        }