private void AddMovieNxtBTN_Click(object sender, EventArgs e) { AddData AD = new AddData(); string Name = MovieNameInput.Text; int Year = Int32.Parse(ReleaseInput.Text); int MinimumAge = Int32.Parse(AgeResInput.Text); string Summary = SumInput.Text; string Actors = ActorsInput.Text; int Duration = Int32.Parse(DurationInput.Text); string Genre = GenreInput.Text; if (Year <= 1800 || Year > Convert.ToInt32((DateTime.Now.ToString("yyyy")))) { ReleaseInput.Clear(); MessageBox.Show("The year of release was not valid. Please try again", "Invalid year of release", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (MinimumAge < 0 || MinimumAge > 99) { AgeResInput.Clear(); MessageBox.Show("The minimum age was not valid. Please try again", "Invalid minimum age", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { AD.InsertMovie(Name, Year, MinimumAge, Summary, Actors, Duration, Genre); this.Hide(); AddTime form = new AddTime(Name, Duration); form.ShowDialog(); this.Close(); } }
private void AddButton_Click(object sender, RoutedEventArgs e) { Movie movie = new Movie(titleInput.Text, Convert.ToInt32(ReleaseInput.Text), Convert.ToDouble(TomatoesInput.Text)); //Movie selectedMovie = lvMovies.SelectedItem as Movie; foreach (Movie m in movieList) { if (movie.Title == m.Title) { MessageBox.Show("no you have"); return; } } movieList.Add(movie); titleInput.Clear(); ReleaseInput.Clear(); TomatoesInput.Clear(); }