Esempio n. 1
0
        //Select statement
        //  public Movie(int MID,String title,String length,String director,String year,List<Actor> Actors, List<Genre> Genres)
        public List <Movie> SelectMovie(String cmdString)
        {
            string       query = cmdString;
            List <Movie> list  = new List <Movie>();

            //Open connection
            if (this.OpenConnection() == true)
            {
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();
                //Read the data and store them in the list
                DBConnect tempA = new DBConnect();
                DBConnect tempB = new DBConnect();
                while (dataReader.Read())
                {
                    List <Actor> actors = tempA.SelectActor("SELECT * FROM WasIn,Actors WHERE WasIn.AID=Actors.AID AND WasIn.MID=" + dataReader["MID"]);
                    List <Genre> genres = tempB.SelectGenres("SELECT * FROM FitsIn,Genres WHERE Genres.GID=FitsIn.GID AND FitsIn.MID=" + dataReader["MID"]);
                    list.Add(new Movie(Int32.Parse(dataReader["MID"] + ""), dataReader["title"] + "", dataReader["length"] + "", dataReader["director"] + "", dataReader["year"] + "", actors, genres));
                }
                //close Data Reader
                dataReader.Close();
                //close Connection
                this.CloseConnection();
                //return list to be displayed
                return(list);
            }
            else
            {
                return(list);
            }
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            DBConnect    helper = new DBConnect();
            List <Genre> test   = helper.SelectGenres("SELECT * FROM Genres WHERE GID='1'");
            Genre        blah   = test[0];

            MessageBox.Show(blah.getName());
        }
Esempio n. 3
0
 private void button4_Click(object sender, EventArgs e)
 {
     DBConnect helper = new DBConnect();
     List<Genre> test = helper.SelectGenres("SELECT * FROM Genres WHERE GID='1'");
     Genre blah = test[0];
     MessageBox.Show(blah.getName());
 }
Esempio n. 4
0
 //Select statement
 //  public Movie(int MID,String title,String length,String director,String year,List<Actor> Actors, List<Genre> Genres)
 public List<Movie> SelectMovie(String cmdString)
 {
     string query = cmdString;
     List<Movie> list = new List<Movie>();
     //Open connection
     if (this.OpenConnection() == true)
     {
         //Create Command
         MySqlCommand cmd = new MySqlCommand(query, connection);
         //Create a data reader and Execute the command
         MySqlDataReader dataReader = cmd.ExecuteReader();
         //Read the data and store them in the list
         DBConnect tempA = new DBConnect();
         DBConnect tempB = new DBConnect();
         while (dataReader.Read())
         {
             List<Actor> actors = tempA.SelectActor("SELECT * FROM WasIn,Actors WHERE WasIn.AID=Actors.AID AND WasIn.MID=" + dataReader["MID"]);
             List<Genre> genres = tempB.SelectGenres("SELECT * FROM FitsIn,Genres WHERE Genres.GID=FitsIn.GID AND FitsIn.MID=" + dataReader["MID"]);
             list.Add(new Movie(Int32.Parse(dataReader["MID"] + ""), dataReader["title"] + "", dataReader["length"] + "", dataReader["director"] + "", dataReader["year"] + "", actors, genres));
         }
         //close Data Reader
         dataReader.Close();
         //close Connection
         this.CloseConnection();
         //return list to be displayed
         return list;
     }
     else
     {
         return list;
     }
 }