Beispiel #1
0
        //Opens new MovieDetails form and saves user given info to a new movie
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var button = sender as ToolStripMenuItem;

            var form = new MovieDetails("Add Movie");

            //Show form modally
            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            //Add to database
            try
            {
                _database.Add(form.Movie);
            } catch (NotImplementedException)
            {
                MessageBox.Show("Not Implemented yet.");
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            };

            RefreshUI();
        }
Beispiel #2
0
        //Opens new MovieDetails form and saves user given info to a new movie
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var button = sender as ToolStripMenuItem;

            var form = new MovieDetails();

            form.Text = "Add Movie";

            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            _movie = form.Movie;
        }
Beispiel #3
0
        private void EditMovie(Movie movie)
        {
            var form   = new MovieDetails(movie);
            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            form.Movie.Id = movie.Id;
            _database.Update(form.Movie, out var message);
            if (!String.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
            }

            RefreshUI();
        }
Beispiel #4
0
        //Opens new MovieDetails form and saves user given info to a new movie
        private void OnMovieAdd(object sender, EventArgs e)
        {
            var button = sender as ToolStripMenuItem;

            var form = new MovieDetails("Add Movie");

            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            _database.Add(form.Movie, out var message);
            if (!String.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
            }

            RefreshUI();
        }
Beispiel #5
0
        //Helper method to handle editing movies
        private void EditMovie(Movie movie)
        {
            var form   = new MovieDetails(movie);
            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            //Update the movie
            form.Movie.Id = movie.Id;

            try
            {
                _database.Update(form.Movie);
            } catch (Exception e)
            {
                MessageBox.Show(e.Message);
            };

            RefreshUI();
        }
Beispiel #6
0
        //Edits info saved in movie
        private void OnMovieEdit(object sender, EventArgs e)
        {
            //Error message if nothing is stored in movie
            if (_movie == null)
            {
                MessageBox.Show("There are no movies to edit");
                return;
            }

            var form = new MovieDetails();

            form.Text  = "Edit Movie";
            form.Movie = _movie;

            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }

            //Editing the movie
            _movie = form.Movie;
        }