private void button1_Click(object sender, EventArgs e) { bool addTheater = false; try { TimeSpan theaterTime = TimeSpan.Parse(textBox4.Text); Theater tempTheater = new Theater(textBox1.Text, theaterTime); foreach (Movie m in displayBoard.GetMovies) { if (m.GetName.ToLower().Equals(textBox2.Text.ToLower())) { tempTheater.Movie = m; displayBoard.AddTheaters(tempTheater); label5.Show(); label5.BringToFront(); addTheater = true; } } } catch { } finally { if (!addTheater) { label6.Show(); label6.BringToFront(); } textBox1.Text = textBox2.Text = textBox4.Text = ""; } }
public void InitializeItems() { theaterOneTime = new TimeSpan(15, 30, 0); theaterTwoTime = new TimeSpan(20, 45, 0); theaterOne = new Theater("Orchid", theaterOneTime); theaterTwo = new Theater("Rose", theaterTwoTime); movieOne = new Movie("Avengers Endgame", 3, "Superheroes in action", "Chris Hemsworth"); movieTwo = new Movie("Birdbox", 1, "Don't make a sound", "Sandra Bullock"); theaterOne.Movie = movieOne; theaterTwo.Movie = movieTwo; displayBoardOne = new DisplayBoard(); displayBoardOne.AddTheaters(theaterOne); displayBoardOne.AddTheaters(theaterTwo); displayBoardOne.AddMovies(movieOne); displayBoardOne.AddMovies(movieTwo); }