Example #1
0
        private void Add_MovieToList(string movieName)
        {
            try
            {
                MovieClass movie = new MovieClass(movieName);

                ListViewItem item = new ListViewItem(movie.Movie_Name);
                item.SubItems.Add(movie.Get_Genre(1));
                item.SubItems.Add(movie.Get_Mark());
                item.SubItems.Add(movie.Get_Year());
                item.SubItems.Add(movie.Director);
                if (movie.Runtime != null)
                    item.SubItems.Add(movie.Runtime.Replace(" min", ""));
                else
                    item.SubItems.Add("Unknown");
                if (movie.Get_Date_Year() == -1)
                    item.SubItems.Add("Not viewed yet");
                else if (movie.Get_Date_Year() == 0)
                    item.SubItems.Add("Unknown");
                else
                    item.SubItems.Add(movie.Get_Date_Month().ToString() + "/" + movie.Get_Date_Day().ToString() + "/"
                        + movie.Get_Date_Year().ToString());
                item.SubItems.Add(movie.Get_Country(0));
                item.SubItems.Add(movie.Get_Language(0));
                //item.SubItems.Add(Name);
                MovieList.Items.Add(item);
            }
            catch
            {
                Error_Message();
            }
        }
Example #2
0
        private void Update_Movie_Details(MovieClass Movie)
        {
            try
            {
                Size tempSize = new Size(252, 20);

                Update_Stars_Movie_Details();

                MoviePoster.ImageLocation = "images\\" + Movie.Index.ToString() + ".jpg";
                MovieName.Text = Movie.Movie_Name;

                try
                {
                    tempSize.Width = (int)(252 * float.Parse(Movie.Get_Mark()) / 10);
                    TopPicture.Size = tempSize;
                    TopPicture.Visible = true;
                    pictureBox2.Visible = true;
                }
                catch
                {
                    TopPicture.Visible = false;
                    pictureBox2.Visible = false;
                }

                try
                {
                    tempSize.Width = (int)(252 * float.Parse(Movie.Get_IMDB_Mark()) / 10);
                    TopPictureMark.Size = tempSize;
                    TopPictureMark.Visible = true;
                    pictureBox1.Visible = true;
                }
                catch
                {
                    TopPictureMark.Visible = false;
                    pictureBox1.Visible = false;
                }

                MarkName.Text = Movie.Get_Mark();
                if (Movie.Get_IMDB_Name() != null)
                    IMDBName.Text = "( " + Movie.Get_IMDB_Name() + " )";
                else
                    IMDBName.Text = "( " + Movie.Movie_Name + " ) - no Update";
                MovieNam.Text = Movie.Movie_Name;
                if (Movie.Get_IMDB_Mark() == null)
                    IMDBMarkDate.Text = "Unknown";
                else
                    IMDBMarkDate.Text = Movie.Get_IMDB_Mark();
                if ((Movie.Get_Date_Day() != 0 || Movie.Get_Date_Month() != 0 || Movie.Get_Date_Year() != 0) && Movie.Get_Date_Year() != -1)
                    DateDate.Text = Movie.Get_Date_Month().ToString() + "/" + Movie.Get_Date_Day().ToString() + "/" + Movie.Get_Date_Year().ToString();
                else if (Movie.Get_Date_Year() == -1)
                    DateDate.Text = "Not viewed yet";
                else
                    DateDate.Text = "Unknown";
                ReviewRichTextBox.Text = Movie.Get_Review().Replace(@"\n", Environment.NewLine);
                DirectorDate.Text = Movie.Director;
                DescriptionTextBox.Text = Movie.Storyline;

                try
                {
                    tempSize = new Size(61, 20);
                    YearDate.Size = tempSize;
                    YearDate.Text = int.Parse(Movie.Get_Year()).ToString();
                }
                catch
                {
                    tempSize = new Size(100, 20);
                    YearDate.Size = tempSize;
                    YearDate.Text = Movie.Get_Year();
                }

                List<string> Aux = new List<string>();

                ComboGenreDate.Items.Clear();
                ComboGenreDate.Text = Movie.Get_Genre(0);
                Aux = Movie.Get_Genre();
                foreach(string genre in Aux)
                    ComboGenreDate.Items.Add(genre);

                RuntimeDate.Text = Movie.Runtime;
                MPAAtext.Text = Movie.MPAA_Rating;

                CountryDate.Items.Clear();
                CountryDate.Text = Movie.Get_Country(0);
                Aux = Movie.Get_Country();
                foreach(string country in Aux)
                    CountryDate.Items.Add(country);

                LanguageDate.Items.Clear();
                LanguageDate.Text = Movie.Get_Language(0);
                Aux = Movie.Get_Language();
                foreach(string language in Aux)
                    LanguageDate.Items.Add(language);

                toolTip1.SetToolTip(DirectorWebLink, "Visit " + Movie.Director + "'s page");

                Tags.Items.Clear();
                if (Movie.Get_Tags().Count > 0)
                {
                    Tags.Text = Movie.Get_Tag(0);
                    foreach (string tag in Movie.Get_Tags())
                        Tags.Items.Add(tag);
                }
                else
                    Tags.Text = "Unknown";

                PrizesBox.Text = Movie.Prize;
                toolTip2.SetToolTip(OscarButton, "Visit " + Movie.Movie_Name + "'s Gallery of Trophies");
            }
            catch
            {
            }
        }
Example #3
0
        private void Update_MovieList(int index)
        {
            try
            {
                MovieClass movie = new MovieClass(MovieList.Items[index].Text);

                MovieList.Items[index].Text = movie.Movie_Name;
                MovieList.Items[index].SubItems[1].Text = movie.Get_Genre(0);
                MovieList.Items[index].SubItems[2].Text = movie.Get_Mark();
                MovieList.Items[index].SubItems[3].Text = movie.Get_Year();
                MovieList.Items[index].SubItems[4].Text = movie.Director;
                if (movie.Runtime != null)
                    MovieList.Items[index].SubItems[5].Text = movie.Runtime.Replace(" min", "");
                else
                    MovieList.Items[index].SubItems[5].Text = "Unknown";
                if (movie.Get_Date_Year() == 0)
                    MovieList.Items[index].SubItems[6].Text = "Unknown";
                else
                    MovieList.Items[index].SubItems[6].Text = movie.Get_Date_Month().ToString() + "/" + movie.Get_Date_Day().ToString() + "/"
                        + movie.Get_Date_Year().ToString();
                MovieList.Items[index].SubItems[7].Text = movie.Get_Country(0);
                MovieList.Items[index].SubItems[8].Text = movie.Get_Language(0);
            }
            catch
            {
                return;
            }
        }
Example #4
0
        private void Update_MovieList()
        {
            MovieClass movie = new MovieClass();

            for (; MovieList.Items.Count > 0; MovieList.Items[0].Remove()) ;

            List<string> MovieNameList = DataBaseManipulation.MovieDetails("Name");

            foreach(string MovieName in MovieNameList)
            {
                movie = new MovieClass(MovieName);
                if (movie.Movie_Name != null)
                {
                    ListViewItem item = new ListViewItem(movie.Movie_Name);
                    item.SubItems.Add(movie.Get_Genre(0));
                    item.SubItems.Add(movie.Get_Mark());
                    item.SubItems.Add(movie.Get_Year());
                    item.SubItems.Add(movie.Director);
                    if (movie.Runtime != null)
                        item.SubItems.Add(movie.Runtime.Replace(" min", ""));
                    else
                        item.SubItems.Add("Unknown");
                    if (movie.Get_Date_Year() == -1)
                        item.SubItems.Add("Not yet viewed");
                    else if (movie.Get_Date_Year() == 0)
                        item.SubItems.Add("Unknown");
                    else
                        item.SubItems.Add(movie.Get_Date_Month().ToString() + "/" + movie.Get_Date_Day().ToString() + "/"
                            + movie.Get_Date_Year().ToString());
                    item.SubItems.Add(movie.Get_Country(0));
                    item.SubItems.Add(movie.Get_Language(0));
                    //item.SubItems.Add(Name);
                    MovieList.Items.Add(item);
                }
            }
        }
Example #5
0
        private void clearToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                string ClearingMovie = MovieList.SelectedItems[0].Text.ToString();
                MovieClass movie = new MovieClass(ClearingMovie);

                if (Directory.Exists("images\\" + movie.Index.ToString() + " Stars") == true)
                    Directory.Delete("images\\" + movie.Index.ToString() + " Stars", true);
                if (File.Exists("images\\" + movie.Index.ToString() + ".jpg") == true)
                    File.Delete("images\\" + movie.Index.ToString() + ".jpg");

                Movie = new MovieClass(ClearingMovie);
                MovieClass MovieAux = new MovieClass();
                MovieAux.Movie_Name = Movie.Movie_Name;
                MovieAux.Set_Date(Movie.Get_Date_Day().ToString(), Movie.Get_Date_Month().ToString(), Movie.Get_Date_Year().ToString());
                MovieAux.Set_IMDB_Adress(Movie.Get_IMDB_Adress());
                MovieAux.Set_Mark(Movie.Get_Mark());
                MovieAux.Set_Review(Movie.Get_Review());
                if (DataBaseManipulation.DefaultMovie().Movie_Name == MovieAux.Movie_Name)
                    MovieAux.Default = true;
                DataBaseManipulation.UpdateMovie(MovieAux);

                Update_Movie_Details(MovieAux);

                reloadToolStripMenuItem_Click(sender, e);

                MessageBox.Show("\"" + ClearingMovie + "\" was successfully cleaned!", "Successfully cleaned", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                Error_Message();
            }
        }
        public static void UpdateMovie(MovieClass Movie,int LastIndex)
        {
            try
            {
                if (DBCon.ConnectionString == "")
                {
                    DBCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Directory.GetCurrentDirectory() + "\\Movies.mdb;User Id=Admin;Password=;";
                    DBCon.Open();
                }

                string command = "UPDATE Movies SET ";
                command += "Name = '" + WorkerClass.StringWithoutApostrophe(Movie.Movie_Name) + "',";
                command += "[Year] = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_Year()) + "',";
                command += "[Mark] = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_Mark()) + "',";
                command += " IMDb_Adress = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_IMDB_Adress()) + "',";
                command += " [Date] = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_Date_Month().ToString()) + "/" + WorkerClass.StringWithoutApostrophe(Movie.Get_Date_Day().ToString()) + "/" + WorkerClass.StringWithoutApostrophe(Movie.Get_Date_Year().ToString()) + "',";
                command += " [Review] = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_Review()) + "',";
                command += " RunTime = '" + Movie.Runtime + "',";
                command += " IMDb_Name = '" + WorkerClass.StringWithoutApostrophe(Movie.Get_IMDB_Name()) + "',";
                command += " IMDb_Mark = '" + Movie.Get_IMDB_Mark() + "',";
                command += " DirectorName = '" + WorkerClass.StringWithoutApostrophe(Movie.Director) + "',";
                command += " DirectorWebLink = '" + Movie.DirectorLink + "',";
                command += " [Country] = '" + WorkerClass.StringWithApostrophe(WorkerClass.ListToString(Movie.Get_Country())) + "',";
                command += " Stars = '" + WorkerClass.StringWithoutApostrophe(WorkerClass.ListToString(Movie.Get_Stars())) + "',";
                command += " StarsLink = '" + WorkerClass.StringWithoutApostrophe(WorkerClass.ListToString(Movie.Get_StarsLink())) + "',";
                command += " Genres = '" + WorkerClass.StringWithoutApostrophe(WorkerClass.ListToString(Movie.Get_Genre())) + "',";
                command += " [Language] = '" + WorkerClass.StringWithoutApostrophe(WorkerClass.ListToString(Movie.Get_Language())) + "',";
                command += " Tags = '" + WorkerClass.StringWithApostrophe(WorkerClass.ListToString(Movie.Get_Tags())) + "',";
                command += " StoryLine = '" + WorkerClass.StringWithoutApostrophe(Movie.Storyline) + "',";
                command += " TrailerMovie = '" + WorkerClass.StringWithoutApostrophe(Movie.MovieTrailer) + "',";
                command += " DefaultMovie = " + (Movie.Default ? 1 : 0).ToString() + ",";
                command += " MPAA = '" + WorkerClass.StringWithoutApostrophe(Movie.MPAA_Rating) + "',";
                command += " Prizes = '" + WorkerClass.StringWithoutApostrophe(Movie.Prize) + "'";
                command += " WHERE Index = " + LastIndex;

                OleDbCommand DBCom = new OleDbCommand(command, DBCon);
                DBCom.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }