Esempio n. 1
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtboxConfirmPassword.Text.Length < 2)
            {
                MessageBox.Show("Enter a longer password");
            }
            if (passValid)
            {
                DBConnect connector = new DBConnect();
                List<String>[] temp = connector.SelectUsers("SELECT * FROM Users WHERE name='" + txtboxUsername.Text + "'");

                if (temp[0].Count == 0)
                {

                    connector.Insert("INSERT INTO Users (name,pass) VALUES ('" + txtboxUsername.Text + "','" + txtboxPassword.Text + "')");
                    txtboxPassword.Clear();
                    txtboxConfirmPassword.Clear();
                    txtboxUsername.Clear();
                    this.Hide();
                    parent.Show();
                }
                else
                {
                    MessageBox.Show("Error user already exists");
                }
            }
            else
            {
                lblMismatch.Text = "Passwords do no match!";
            }
        }
Esempio n. 2
0
        public void recItemAdd_MouseClick(object sender, MouseEventArgs e)
        {
            Button btn = (Button)sender;
            if (true)//(((Button)sender).Text.Equals(""))//If we want to add it
            {
                DBConnect adder = new DBConnect();
                adder.addToWatchList(theMovie.getMID(), HomeForm.UID);
                btn.Text = "Remove from Watchlist";

            }
            else
            {
                DBConnect adder = new DBConnect();
                //adder.addToWatchList(currMovie.getMID(), UID);//Remove from watchlist
                //btn.Text = "Add to Watchlist";

            }
        }
Esempio n. 3
0
        public void changeToMoviePage(Movie theMovie)
        {
            currMovie = theMovie;
            DBConnect helper = new DBConnect();
            movieRating = (int)helper.getUserRating(theMovie.getMID(), UID);
               // MessageBox.Show("Rating:" + movieRating.ToString());
            userRated = true;
            if (movieRating == -1)
            {
                userRated = false;
                movieRating = (int)helper.AverageRating(theMovie.getMID());
            }

            addBreadrumbs(this, theMovie.getTitle());
            lblLocation.Text = theMovie.getTitle();
            pnlContent.Controls.Clear();

            //build new big panel

            pnlMovieInfo = new FlowLayoutPanel();
            //pnlMovieInfo = new TableLayoutPanel();
            //pnlMovieInfo.Anchor = AnchorStyles.Top;
            //pnlMovieInfo.Anchor = AnchorStyles.Bottom;
            //pnlMovieInfo.Anchor = AnchorStyles.Left;
            //pnlMovieInfo.Anchor = AnchorStyles.Right;
            //pnlMovieInfo.RowCount = 2;
               // pnlMovieInfo.ColumnCount = 1;
            pnlMovieInfo.BackColor = Color.SteelBlue;
            pnlMovieInfo.Dock = DockStyle.Fill;
               // this.pnlMovieInfo.RowStyles[0].Height = 50F;
            //this.pnlMovieInfo.RowStyles[1].Height = 50F;
            //this.pnlMovieInfo.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));

               pnlMovieInfo.FlowDirection = FlowDirection.TopDown;

            //Add Table panel to divide Movie thumbnail with info
            TableLayoutPanel pnlTopTable = new TableLayoutPanel();
                //pnlTopTable.AutoSize = true;
                pnlTopTable.RowCount = 1;
                pnlTopTable.ColumnCount = 2;
                pnlTopTable.Padding = new Padding(0);
                pnlTopTable.Width = 1000;
                pnlTopTable.Height = 360;
                //pnlTopTable.Dock = DockStyle.Fill;

                pnlTopTable.BackColor = Color.SteelBlue;

                //Add left column contents
                FlowLayoutPanel leftCol = new FlowLayoutPanel();
                leftCol.Padding = new Padding(0);
                leftCol.Dock = DockStyle.Fill;
                leftCol.FlowDirection = FlowDirection.TopDown;
                leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails

                //Create area for ratings
                FlowLayoutPanel ratings = new FlowLayoutPanel();
                ratings.Margin = new Padding(22, 0, 0, 0);
                //ratings.Height = 550;
                //ratings.Width = 550;
                ratings.FlowDirection = FlowDirection.LeftToRight;
                ratings.Padding = new Padding(0);
                ratings.BackColor = Color.SteelBlue;
                PictureBox oneStar = new PictureBox();
                PictureBox twoStar = new PictureBox();
                PictureBox threeStar = new PictureBox();
                PictureBox fourStar = new PictureBox();
                PictureBox fiveStar = new PictureBox();
                oneStar.Size = new Size(25, 26);
                twoStar.Size = new Size(25, 26);
                threeStar.Size = new Size(25, 26);
                fourStar.Size = new Size(25, 26);
                fiveStar.Size = new Size(25, 26);

                oneStar.Margin = new Padding(3);
                twoStar.Margin = new Padding(3);
                threeStar.Margin = new Padding(3);
                fourStar.Margin = new Padding(3);
                fiveStar.Margin = new Padding(3);

                oneStar.Padding = new Padding(0);
                twoStar.Padding = new Padding(0);
                threeStar.Padding = new Padding(0);
                fourStar.Padding = new Padding(0);
                fiveStar.Padding = new Padding(0);

                oneStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                twoStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                threeStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                fourStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                fiveStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");

                stars = new List<PictureBox>();
                stars.Add(oneStar);
                stars.Add(twoStar);
                stars.Add(threeStar);
                stars.Add(fourStar);
                stars.Add(fiveStar);

            //Event listeners
                ratings.MouseLeave += new EventHandler(ratings_MouseLeave);

                oneStar.MouseEnter += new EventHandler(oneStar_MouseEnter);
                twoStar.MouseEnter += new EventHandler(twoStar_MouseEnter);
                threeStar.MouseEnter += new EventHandler(threeStar_MouseEnter);
                fourStar.MouseEnter += new EventHandler(fourStar_MouseEnter);
                fiveStar.MouseEnter += new EventHandler(fiveStar_MouseEnter);

                oneStar.MouseClick += new MouseEventHandler(oneStar_MouseClick);
                twoStar.MouseClick += new MouseEventHandler(twoStar_MouseClick);
                threeStar.MouseClick += new MouseEventHandler(threeStar_MouseClick);
                fourStar.MouseClick += new MouseEventHandler(fourStar_MouseClick);
                fiveStar.MouseClick += new MouseEventHandler(fiveStar_MouseClick);

                Button watchlist = new Button();
                if (helper.inWatchList(theMovie.getMID(),UID))//If in watchlist
                {
                    watchlist.Text = "Remove from Watchlist";

                }
                else
                {
                    watchlist.Text = "Add to Watchlist";
                }
                watchlist.MouseClick += new MouseEventHandler(watchlist_MouseClick);
                //watchlist.AutoSize = true;
                watchlist.Width = 150;
                watchlist.FlatStyle = FlatStyle.Flat;
                //watchlist.Dock = DockStyle.Fill;

                ratings.Controls.Add(oneStar);
                ratings.Controls.Add(twoStar);
                ratings.Controls.Add(threeStar);
                ratings.Controls.Add(fourStar);
                ratings.Controls.Add(fiveStar);
                ratings.Controls.Add(watchlist);

                changeAllStars(movieRating);
                leftCol.Controls.Add(ratings); //add ratings

                pnlTopTable.Controls.Add(leftCol, 0, 0);

                //RIGHT column contents
                FlowLayoutPanel pnlMovieDetails = new FlowLayoutPanel();
                pnlMovieDetails.Margin = new Padding(0, 25, 0, 0);

                pnlMovieDetails.Dock = DockStyle.Fill;
                //pnlMovieDetails.Width = 400;
                //pnlMovieDetails.Width = pnlMovieInfo.Width;
                //pnlMovieDetails.Height = pnlMovieInfo.Height / 2;
                pnlMovieDetails.FlowDirection = FlowDirection.TopDown;

                    //Create Tab Info
                    TabControl details = new TabControl();

                    details.Width = 600;
                    details.Height = 285;
                    //details.Dock = DockStyle.Fill;

                    //Create tab pages
                    TabPage pgActors = new TabPage("Actors");
                    //Fill info into the tab page

                    //Actors Tab
                    FlowLayoutPanel flowActors = new FlowLayoutPanel();
                    flowActors.FlowDirection = FlowDirection.TopDown;
                    pgActors.Controls.Add(flowActors);
                    flowActors.Dock = DockStyle.Fill;

                    List<Actor> actorList = theMovie.getActors();
                    for (int i = 0; i < actorList.Count; i++)
                    {
                        Label lblActor = new Label();
                        lblActor.Text = actorList[i].getName();
                        flowActors.Controls.Add(lblActor);
                    }

                    //Info Tab
                    TabPage pgInfo = new TabPage("Info");
                    //FlowLayoutPanel flowInfo = new FlowLayoutPanel();
                    //flowInfo.FlowDirection = FlowDirection.TopDown;
                    //pgInfo.Controls.Add(flowInfo);
                    //flowInfo.Dock = DockStyle.Fill;
                    Label lblInfo = new Label();
                    lblInfo.Dock = DockStyle.Fill;
                    lblInfo.Text = theMovie.getInfo();
                    pgInfo.Controls.Add(lblInfo);
                    //flowInfo.Controls.Add(lblInfo);

                    //Add tab pages
                    details.TabPages.Add(pgActors);
                    details.TabPages.Add(pgInfo);

                    pnlMovieDetails.Controls.Add(details);

                //add right column contents to table
                    pnlTopTable.Controls.Add(pnlMovieDetails, 1, 0);
            //End of Table Panel

            //Below add another FlowPanel for Reviews

            /*
            FlowLayoutPanel pnlReviewHolder = new FlowLayoutPanel();
            pnlReviewHolder.FlowDirection = FlowDirection.TopDown;

                FlowLayoutPanel pnlReviewHeader = new FlowLayoutPanel();
                Label lblReview = new Label();
                lblReview.Text = "REVIEWS";
                Button toggle = new Button();
                toggle.Text = "Show/Hide";
                toggle.FlatStyle = FlatStyle.Flat;
                /////////////////////////// REMEMBER TO ADD BUTTON LISTENER
                pnlReviewHeader.Controls.Add(lblReview);
                pnlReviewHeader.Controls.Add(toggle);
            //Add stuff to the review holder panel
            pnlReviewHolder.Controls.Add(pnlReviewHeader);
             */

            //Add the two items to the Movie Info Panel
            pnlMovieInfo.Controls.Add(pnlTopTable);
               // pnlMovieInfo.Controls.Add(pnlReviewHolder);
            //pnlMovieInfo.Controls.Add(pnlTopTable, 0, 0);
            //pnlMovieInfo.Controls.Add(pnlReviewHolder, 0, 1);

            //Add everything to the Content Panel
            pnlContent.Controls.Add(pnlMovieInfo);
        }
Esempio n. 4
0
 public List<Movie> Search(String searchTerm)
 {
     DBConnect helper = new DBConnect();
     List<Movie> movies;
     if (searchTerm.Length > 2)
     {
         movies = helper.SelectMovie("SELECT * FROM Movies WHERE title LIKE '%" + searchTerm + "%'");
     }
     else
     {
         movies = new List<Movie>();
     }
     return movies;
 }
Esempio n. 5
0
        public void changetoRateMovieList()
        {
            if (ratingsDone > 0 || ratingsDone == -1)
            {
                removeBreadcrumbs(null, "");
                lblLocation.Text = "Rating Movies";
                pnlContent.Controls.Clear();

                DBConnect helper = new DBConnect();
                Movie theMovie = helper.selectRandomMovies(1)[0];
                currMovie = theMovie;

                //Panel pnlRate = new Panel();
                //pnlRate.Controls.Add(theMovie.buildThumbnailPanel());
                // pnlRate.Dock = DockStyle.Fill;

                //Add left column contents
                FlowLayoutPanel leftCol = new FlowLayoutPanel();
                leftCol.Padding = new Padding(0);
                leftCol.Dock = DockStyle.Fill;
                leftCol.FlowDirection = FlowDirection.TopDown;

                //Create area for ratings
                FlowLayoutPanel ratings = new FlowLayoutPanel();
                ratings.Margin = new Padding(22, 0, 0, 0);
                //ratings.Height = 550;
                //ratings.Width = 550;
                ratings.FlowDirection = FlowDirection.LeftToRight;
                ratings.Padding = new Padding(0);
                ratings.BackColor = Color.SteelBlue;
                PictureBox starOne = new PictureBox();
                PictureBox starTwo = new PictureBox();
                PictureBox starThree = new PictureBox();
                PictureBox starFour = new PictureBox();
                PictureBox starFive = new PictureBox();
                starOne.Size = new Size(25, 26);
                starTwo.Size = new Size(25, 26);
                starThree.Size = new Size(25, 26);
                starFour.Size = new Size(25, 26);
                starFive.Size = new Size(25, 26);

                starOne.Margin = new Padding(3);
                starTwo.Margin = new Padding(3);
                starThree.Margin = new Padding(3);
                starFour.Margin = new Padding(3);
                starFive.Margin = new Padding(3);

                starOne.Padding = new Padding(0);
                starTwo.Padding = new Padding(0);
                starThree.Padding = new Padding(0);
                starFour.Padding = new Padding(0);
                starFive.Padding = new Padding(0);

                starOne.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starTwo.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starThree.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starFour.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starFive.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");

                stars = new List<PictureBox>();
                stars.Add(starOne);
                stars.Add(starTwo);
                stars.Add(starThree);
                stars.Add(starFour);
                stars.Add(starFive);

                //Event listeners
                ratings.MouseLeave += new EventHandler(ratings_MouseLeave);

                starOne.MouseEnter += new EventHandler(oneStar_MouseEnter);
                starTwo.MouseEnter += new EventHandler(twoStar_MouseEnter);
                starThree.MouseEnter += new EventHandler(threeStar_MouseEnter);
                starFour.MouseEnter += new EventHandler(fourStar_MouseEnter);
                starFive.MouseEnter += new EventHandler(fiveStar_MouseEnter);

                starOne.MouseClick += new MouseEventHandler(starOne_MouseClick);
                starTwo.MouseClick += new MouseEventHandler(starTwo_MouseClick);
                starThree.MouseClick += new MouseEventHandler(starThree_MouseClick);
                starFour.MouseClick += new MouseEventHandler(starFour_MouseClick);
                starFive.MouseClick += new MouseEventHandler(starFive_MouseClick);

                Button btnSkip = new Button();
                btnSkip.MouseClick += new MouseEventHandler(btnSkip_MouseClick);
                btnSkip.Text = "Skip";
                btnSkip.BackColor = Color.LightSkyBlue;
                btnSkip.ForeColor = Color.White;
                btnSkip.Width = 150;
                btnSkip.FlatStyle = FlatStyle.Flat;

                Label lblRatingsLeft = new Label();
                lblRatingsLeft.ForeColor = Color.White;
                lblRatingsLeft.Text = (ratingsDone).ToString() + " ratings to go.";

                //Add to panels
                ratings.Controls.Add(starOne);
                ratings.Controls.Add(starTwo);
                ratings.Controls.Add(starThree);
                ratings.Controls.Add(starFour);
                ratings.Controls.Add(starFive);
                ratings.Controls.Add(btnSkip);

                leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails

                leftCol.Controls.Add(ratings);

                if(ratingsDone != -1)
                    leftCol.Controls.Add(lblRatingsLeft);

                pnlContent.Controls.Add(leftCol);
                //pnlRate.Controls.Add(leftCol);
            }
            else
            {
                pnlContent.Controls.Clear();
                FlowLayoutPanel temp = new FlowLayoutPanel();
                temp.FlowDirection = FlowDirection.TopDown;
                temp.Height = 400;
                temp.Width = 800;
                Label error = new Label();
                error.Height = 150;
                error.Width = 800;
                error.TextAlign = ContentAlignment.BottomCenter;
                error.ForeColor = Color.White;
                error.Text = "Ratings Complete! We can now give you recommendations, if you would like to continue rating movies, click the button below:";
                lblLocation.Text = "Ratings Complete";

                Button moreRatings = new Button();
                moreRatings.Margin = new Padding(350, 20, 0, 0);
                moreRatings.Text = "Continue Rating!";
                moreRatings.AutoSize = true;
                moreRatings.FlatStyle = FlatStyle.Flat;
                moreRatings.ForeColor = Color.White;
                moreRatings.BackColor = Color.LightSkyBlue;

                moreRatings.MouseClick += new MouseEventHandler(moreRatings_MouseClick);

                temp.Controls.Add(error);
                temp.Controls.Add(moreRatings);
                pnlContent.Controls.Add(temp);
            }
        }
Esempio n. 6
0
        public void changetoProfilePage()
        {
            pnlContent.Controls.Clear();

            TableLayoutPanel profile = new TableLayoutPanel();
            removeBreadcrumbs(null, "");
            addBreadrumbs(profile, "Profile");
            lblLocation.Text = "Profile";

            //styling
            profile.Dock = DockStyle.Fill;
            profile.RowCount = 1;
            profile.ColumnCount = 2;
            profile.BackColor = Color.CornflowerBlue;
            //profile.ColumnStyles[0] = new ColumnStyle(SizeType.Absolute, (float)500.0);

            //left panel
            FlowLayoutPanel userInfo = new FlowLayoutPanel();
            userInfo.Width = 425;
            userInfo.Dock = DockStyle.Fill;
            userInfo.BackColor = Color.SteelBlue;
            userInfo.FlowDirection = FlowDirection.TopDown;

            Label infoTitle = new Label();
            infoTitle.Text = "User Infromation:";
            infoTitle.Font = new Font("Arial", (float)14.0, FontStyle.Bold);
            infoTitle.ForeColor = Color.White;
            userInfo.Controls.Add(infoTitle);

            Label name = new Label();
            name.ForeColor = Color.White;
            name.AutoSize = true;
            name.Font = new Font("Arial", (float)12.0, FontStyle.Bold);
            name.Text = "Username: "******"Watch List:";
                watchTitle.Font = new Font("Arial", (float)14.0, FontStyle.Bold);
                watchTitle.AutoSize = true;
                watchTitle.ForeColor = Color.White;
                watchTitle.Dock = DockStyle.Top;

                //ThumbNail

                thumbNailHolder = new FlowLayoutPanel();
                thumbNailHolder.BackColor = Color.CornflowerBlue;
                thumbNailHolder.Dock = DockStyle.Top;
                thumbNailHolder.Height = 1000;

                this.Resize -= new EventHandler(searchSizeChange);
                this.Resize -= new EventHandler(recSizeChange);
                this.Resize -= new EventHandler(watchSizeChange);

                this.Resize += new EventHandler(watchSizeChange);

            watchlist.Controls.Add(thumbNailHolder);
            watchlist.Controls.Add(watchTitle);

            //Add all this to the content panel
            pnlContent.Controls.Add(profile);

            //Populate Wish List

            DBConnect helper = new DBConnect();
            List<Movie> found = helper.selectMoviesFromWatchList(UID);

            for (int i = 0; i < found.Count; i++)
            {
                thumbNailHolder.Controls.Add(found[i].bildThumbnailWatchPanel());
            }
            numberOfthumbNails = found.Count;

            //MessageBox.Show(found.Count.ToString());
            watchSizeChange();
        }
Esempio n. 7
0
        public List<Movie> SelectMovieByGenre(string genre)
        {
            List<Movie> list = new List<Movie>();

            string query = "SELECT * FROM FitsIn,Genres WHERE Genres.GID=FitsIn.GID AND name LIKE '%" + genre + "%'";

            //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
                while (dataReader.Read())
                {
                    DBConnect temp = new DBConnect();
                    //Console.Out.WriteLine(dataReader["MID"]);
                    list.AddRange( temp.SelectMovie("SELECT * FROM Movies WHERE MID='"+dataReader["MID"]+"'"));
                }

            }
            return list;
        }
Esempio n. 8
0
        public void recItemAdd_MouseClick(object sender, MouseEventArgs e)
        {
            Button btn = (Button)sender;
            DBConnect checker = new DBConnect();
            if (btn.Text.Equals( addTo))
            {
                DBConnect adder = new DBConnect();
                adder.addToWatchList(this.MID, HomeForm.UID);
                btn.Text = removeFrom;

            }
            else
            {
                DBConnect remover = new DBConnect();
                remover.removeFromWatchList(this.MID, HomeForm.UID);//Remove from watchlist
                btn.Text = addTo;

            }
        }
Esempio n. 9
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. 10
0
 private void button1_Click(object sender, EventArgs e)
 {
     DBConnect helper = new DBConnect();
     //Console.Out.WriteLine(helper.AverageRating(1));
 }
Esempio n. 11
0
        //===========End FOR WATCHLIST============
        public List<Movie> selectRecomendations(int UID)
        {
            //Build Recomendations

            string query = "SELECT avg(R.value) as avg,F.GID as GeID FROM `FitsIn` F,Ratings R WHERE R.UID =" + UID + " AND F.MID = R.MID GROUP BY F.GID";

            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

                double value1 = -1;
                int GID1 = -1;
                double value2 = -1;
                int GID2 = -1;

                while (dataReader.Read())
                {
                    if (double.Parse(dataReader["avg"] + "") > value1)
                    {
                        value1 = double.Parse(dataReader["avg"] + "");
                        GID1 = int.Parse(dataReader["GeID"] + "");
                    }
                    else if (double.Parse(dataReader["avg"] + "") > value2)
                    {
                        value2 = double.Parse(dataReader["avg"] + "");
                        GID2 = int.Parse(dataReader["GeID"] + "");
                    }

                    //genreScores.Add(double.Parse(dataReader["avg"] + ""), int.Parse(dataReader["GeID"] + ""));
                }

                dataReader.Close();

                //Pick top n Genre
                const int n = 2;
                int curGID;
                for (int i = 0; i < n; i++)
                {
                    curGID = -1;
                    if (i == 0)
                    {
                        curGID =GID1;
                    }
                    else if (i == 1)
                    {
                        curGID = GID2;
                    }

                    if (curGID != -1)
                    {
                        query = "SELECT MID FROM `FitsIn` WHERE GID = " + curGID + " ORDER BY RAND() LIMIT 5";

                        //Open connection

                        //Create Command
                        cmd = new MySqlCommand(query, connection);
                        //Create a data reader and Execute the command
                        dataReader = cmd.ExecuteReader();
                        //Read the data and store them in the list
                        while (dataReader.Read())
                        {
                            DBConnect temp = new DBConnect();
                            //Console.Out.WriteLine(dataReader["MID"]);
                            list.AddRange(temp.SelectMovie("SELECT * FROM Movies WHERE MID='" + dataReader["MID"] + "'"));
                        }
                        dataReader.Close();
                    }

                }
            }
            return list;
        }
Esempio n. 12
0
        public List<Movie> selectRandomMovies(int n)
        {
            //Build Recomendations

            List<Movie> list = new List<Movie>();
            //Open connection
            if (this.OpenConnection() == true)
            {

                String query = "SELECT MID FROM `Movies` ORDER BY RAND() LIMIT "+n;

                //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
                while (dataReader.Read())
                {
                    DBConnect temp = new DBConnect();
                    //Console.Out.WriteLine(dataReader["MID"]);
                    list.AddRange(temp.SelectMovie("SELECT * FROM Movies WHERE MID='" + dataReader["MID"] + "'"));
                }
                dataReader.Close();

            }
            return list;
        }
Esempio n. 13
0
        public List<Movie> selectMoviesFromWatchList(int UID)
        {
            List<Movie> list = new List<Movie>();

            string query = "SELECT MID FROM WatchList WHERE UID ='" + UID + "'";

            //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
                while (dataReader.Read())
                {
                    DBConnect temp = new DBConnect();
                    //Console.Out.WriteLine(dataReader["MID"]);
                    list.AddRange(temp.SelectMovie("SELECT * FROM Movies WHERE MID='" + dataReader["MID"] + "'"));
                }

            }
            return list;
        }
Esempio n. 14
0
        private void btnCurrLocation_Click(object sender, EventArgs e)
        {
            String temp = ((Button)sender).Text;
            pnlContent.Controls.Clear();

            //Don't bother moving if we're in the right place
            if (temp.Equals(lblLocation.Text))
            {
                //Stay here
            }
            else //otherwise change location
            {
                pnlContent.Controls.Clear();

                if (temp.Length >= 7 && temp.Substring(0, 7).Equals("Search:"))
                {
                    //MessageBox.Show("SEARCH TYPE LINK: "+loc+" + "+ temp);
                    pnlContent.Controls.Add(pnlSearch);
                    String[] renamer = temp.Split(' ');
                    renamer[0] = renamer[0].Substring(0, (renamer[0].Length - 1));
                    String newTitle = temp;
                    if(renamer.Length>=2)
                        newTitle = renamer[0] + " Results for '" + renamer[1] + "'";
                    lblLocation.Text = newTitle;

                }
                else if (temp.Contains("Profile"))
                {
                    changetoProfilePage();
                    lblLocation.Text = temp;
                }
                else if(temp.Contains("Recommendations"))
                {
                    DBConnect helper = new DBConnect();
                    changeToRecPage(helper.selectRecomendations(UID));
                    lblLocation.Text = temp;

                }
                else
                {
                    //MessageBox.Show("MOVIE INFO LINK: " + loc + " + " + loc.Substring(0, 7));
                    pnlContent.Controls.Add(pnlMovieInfo);
                    lblLocation.Text = temp;
                }

                //FIND AND REMOVE EVERYTHING BEFORE THIS ONE
                //We record the location of it (farthest to the right)
                int location = breadcrumbsLayout.Controls.IndexOf((Button)sender)+1;

                int len = breadcrumbsLayout.Controls.Count; //then we see how many breacrumbs there are.
                int stopAt = len - location;

                for (int i = 0; i < stopAt; i++) //And remove all the ones after the one we just removed.
                    breadcrumbsLayout.Controls.RemoveAt(breadcrumbsLayout.Controls.Count - 1);
            }
        }
Esempio n. 15
0
        private List<Movie> Search(string title, string director, string year, string genre, string actor)
        {
            DBConnect helper = new DBConnect();
            List<Movie> movies = new List<Movie>();
            if (title.Length > 2)
            {
                List<Movie> fromTitle = helper.SelectMovie("SELECT * FROM Movies WHERE title LIKE '%" + title + "%'");
                movies.AddRange(fromTitle);
            }
            if (director.Length > 2)
            {
                List<Movie> fromDirector = helper.SelectMovie("SELECT * FROM Movies WHERE director LIKE '%" + director + "%'");
                movies.AddRange(fromDirector);
            }
            if (year.Length > 2)
            {
                List<Movie> fromYear = helper.SelectMovie("SELECT * FROM Movies WHERE year LIKE '%" + year + "%'");
                movies.AddRange(fromYear);
            }
            if (genre.Length > 2)
            {
                List<Movie> fromGenre = helper.SelectMovieByGenre(genre);
                movies.AddRange(fromGenre);
            }
            if (actor.Length > 2)
            {
                List<Movie> fromActor = helper.SelectMovieByActor(actor);
                movies.AddRange(fromActor);
            }

            return movies;
        }
Esempio n. 16
0
 private void btnGetRecommends_Click(object sender, EventArgs e)
 {
     DBConnect helper = new DBConnect();
     changeToRecPage(helper.selectRecomendations(UID));
 }
Esempio n. 17
0
 void twoStar_MouseClick(object sender, MouseEventArgs e)
 {
     DBConnect rater = new DBConnect();
     rater.addRating(currMovie.getMID(), UID, 2);
     userRated = true;
     movieRating = 2;
 }
Esempio n. 18
0
 private void button8_Click(object sender, EventArgs e)
 {
     DBConnect helper = new DBConnect();
     Console.Out.WriteLine(helper.SelectMovieByGenre("History").Count);
 }
Esempio n. 19
0
        void watchlist_MouseClick(object sender, MouseEventArgs e)
        {
            Button btn = (Button)sender;
            if (btn.Text.Equals("Add to Watchlist"))//(((Button)sender).Text.Equals(""))//If we want to add it
            {
                DBConnect adder = new DBConnect();
                adder.addToWatchList(currMovie.getMID(), UID);
                btn.Text = "Remove from Watchlist";

            }
            else
            {
                DBConnect adder = new DBConnect();
                adder.removeFromWatchList(currMovie.getMID(), UID);//Remove from watchlist
                btn.Text = "Add to Watchlist";

            }
        }
Esempio n. 20
0
        public Panel bildThumbnailWatchPanel()
        {
            Panel output = new Panel();

            output.Size = new System.Drawing.Size(thumbNailWatchWidth, thumbNailWatchHeight);

            output.BackColor = System.Drawing.Color.AntiqueWhite;

            output.Margin = new Padding(thumbNailPadding);

            PictureBox poster = new PictureBox();
            //poster.BackColor = Color.AntiqueWhite;
            poster.Padding = new Padding(10);
            poster.Dock = DockStyle.Fill;
            poster.SizeMode = PictureBoxSizeMode.StretchImage;

            Image image = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/image-not-found.gif"));
            poster.Image = image;

            Label titleBox = new Label();
            titleBox.Text = this.title;
            titleBox.Dock = DockStyle.Bottom;
            titleBox.TextAlign = ContentAlignment.MiddleCenter;

            Button BTNWatchList = new Button();
            BTNWatchList.Dock = DockStyle.Bottom;
            BTNWatchList.AutoSize = true;
            BTNWatchList.FlatStyle = FlatStyle.Flat;
            BTNWatchList.BackColor = Color.LightSkyBlue;
            BTNWatchList.TextAlign = ContentAlignment.MiddleCenter;
            BTNWatchList.MouseClick += new MouseEventHandler(recItemAdd_MouseClick);

            DBConnect checker = new DBConnect();
            if (!checker.inWatchList(MID, HomeForm.UID))
                BTNWatchList.Text = addTo;
            else
                BTNWatchList.Text = removeFrom;

            output.Controls.Add(poster);
            output.Controls.Add(titleBox);
            output.Controls.Add(BTNWatchList);

            poster.Click += new EventHandler(clickedThumbNail);
            output.Click += new EventHandler(clickedThumbNail);
            titleBox.Click += new EventHandler(clickedThumbNail);
            return output;
        }
Esempio n. 21
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;
     }
 }