Ejemplo n.º 1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            String value = listBox1.GetItemText(listBox1.SelectedItem);

            var movies = from movieName in database.Movies
                         where movieName.title == value
                         select movieName;

            Movy movie = movies.First();

            moviesLabel.Text = "Title: " + movie.title + "\n" + "Release Year: " + movie.releaseYear + "\n" + "Language: " + movie.language + "\n";

            var genresID = from genreId in database.MovieGenres
                           where genreId.movieId == movie.movieId
                           select genreId;

            moviesLabel.Text += "Genre: ";
            foreach (var g in genresID)
            {
                var genres = from genre in database.Genres
                             where genre.genreId == g.genreId
                             select genre;

                Genre gg = genres.First();
                moviesLabel.Text += gg.description + ",";
            }
            moviesLabel.Text += "\n";

            var directorID = from id in database.Persons
                             where id.personId == movie.director
                             select id;

            moviesLabel.Text += "Director: " + directorID.First().name + "\n";

            var personNames = from p in database.Persons
                              from pr in database.PersonRoles
                              from pf in database.MoviePersons
                              where pr.personRolesId == pf.personRolesId &&
                              pf.movieId == movie.movieId &&
                              p.personId == pr.personId
                              select p.name;

            moviesLabel.Text += "Actor/Actresses: ";

            foreach (var name in personNames)
            {
                moviesLabel.Text += name.Trim() + ", ";
            }
        }
 partial void DeleteMovy(Movy instance);
 partial void InsertMovy(Movy instance);
 partial void UpdateMovy(Movy instance);
 private void detach_Movies(Movy entity)
 {
     this.SendPropertyChanging();
     entity.PersonRole = null;
 }