public void AddMoiveToTable() { try { year = int.Parse(addYear.Text); title = addTitle.Text; director = addDirector.Text; if ((year.ToString() != "") && (title != "") && (director != "")) if (!movieTable.ContainsKey(year)) { Movie addMovieEntry = new Movie(year, title, director); movieTable.Add(addMovieEntry.Year, addMovieEntry); MessageBox.Show("Movie entry successfully added."); DisplayMovies.DisplayAddedMovie(); ClearAddFields(); } else { MessageBox.Show("A movie from this year already exists."); ClearAddFields(); } else MessageBox.Show("All fields are required."); } catch (FormatException) { MessageBox.Show("Failed to add Movie. \nPlease make sure all fields are filled correctly."); } }
private void createMovieTable() { Movie movie1 = new Movie(1961, "West SideStory", "Jerome Robbins"); Movie movie2 = new Movie(1972, "The Godfather", "Francis Ford Coppola"); Movie movie3 = new Movie(1984, "Amadeus", "Milos Forman"); Movie movie4 = new Movie(2007, "No Country for Old Men", "Ethan & Joel Coen"); movieTable.Add(movie1.Year, movie1); movieTable.Add(movie2.Year, movie2); movieTable.Add(movie3.Year, movie3); movieTable.Add(movie4.Year, movie4); }
public static void DisplaySearch(Movie searchedMovie) { lbDisplay.AppendText(searchedMovie.ToString()); }