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 { } }
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); } }