Esempio n. 1
0
        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();
            }
        }