示例#1
0
        private void uxButtonAddMovie_Click(object sender, EventArgs e)
        {
            Inrepo = new SqlIndividualAwardsWonRepository("Data Source=mssql.cs.ksu.edu;" +
                                                          "Initial Catalog=phyo;" +
                                                          "User id=UserId;" +
                                                          "Password=Password;");

            person = new SqlPersonRepository("Data Source=mssql.cs.ksu.edu;" +
                                             "Initial Catalog=phyo;" +
                                             "User id=UserId;" +
                                             "Password=Password;");
            //person.GetPerson()

            personrepo = new SqlMoviePersonsRepository("Data Source=mssql.cs.ksu.edu;" +
                                                       "Initial Catalog=phyo;" +
                                                       "User id=UserId;" +
                                                       "Password=Password;");

            personrepo.RetrieveMoviePerson();



            if (this.listBox1.SelectedItem != null && !Form1.items.Contains(this.listBox1.SelectedItem.ToString()))
            {
                Form1.items.Add(this.listBox1.SelectedItem.ToString());
            }
            if (this.listBox2.SelectedItem != null && !Form1.items.Contains(this.listBox2.SelectedItem.ToString()))
            {
                Form1.items.Add(this.listBox2.SelectedItem.ToString());
            }
            this.Dispose();
        }
示例#2
0
        private void uxSearchProduction_Click(object sender, EventArgs e)
        {
            personrepo = new SqlMoviePersonsRepository("Data Source=mssql.cs.ksu.edu;" +
                                                       "Initial Catalog=phyo;" +
                                                       "User id=UserId;" +
                                                       "Password=Password;");
            person = new SqlPersonRepository("Data Source=mssql.cs.ksu.edu;" +
                                             "Initial Catalog=phyo;" +
                                             "User id=UserId;" +
                                             "Password=Password;");

            movieAwardsWon = new SqlMovieAwardsWonRepository("Data Source=mssql.cs.ksu.edu;" +
                                                             "Initial Catalog=phyo;" +
                                                             "User id=UserId;" +
                                                             "Password=Password;");
            movieCategory = new SqlMovieRepository("Data Source=mssql.cs.ksu.edu;" +
                                                   "Initial Catalog=phyo;" +
                                                   "User id=UserId;" +
                                                   "Password=Password;");
            Inrepo = new SqlIndividualAwardsWonRepository("Data Source=mssql.cs.ksu.edu;" +
                                                          "Initial Catalog=phyo;" +
                                                          "User id=UserId;" +
                                                          "Password=Password;");

            List <Movie> won = new List <Movie>();

            if (this.listBox2.SelectedItem.Equals("Best Picture"))
            {
                foreach (MovieAwardsWon i in movieAwardsWon.RetrieveMovieAwardsWon())
                {
                    if (i.Category.Equals("Best Picture"))
                    {
                        Movie a = movieCategory.FetchMovie(i.MovieId);
                        won.Add(a);
                    }
                }
                dataGridView1.DataSource = won;
            }


            List <Person> won1 = new List <Person>();

            if (this.listBox2.SelectedItem.Equals("Director"))
            {
                foreach (IndividualAwardsWon i in Inrepo.RetrieveIndividualAwardsWon())
                {
                    MoviePerson a = personrepo.FetchMoviePerson(i.MoviePersonId);
                    if (a.Role.Equals("Director"))
                    {
                        Person b = person.FetchPerson(a.PersonId);
                        won1.Add(b);
                    }
                }
                dataGridView1.DataSource = won1;
            }
            if (this.listBox2.SelectedItem.Equals("Adapted Screenplay"))
            {
                foreach (MovieAwardsWon i in movieAwardsWon.RetrieveMovieAwardsWon())
                {
                    if (i.Category.Equals("Adapted Screenplay"))
                    {
                        Movie a = movieCategory.FetchMovie(i.MovieId);
                        won.Add(a);
                    }
                }
                dataGridView1.DataSource = won;
            }
        }