Exemplo n.º 1
0
        private void OnMoviesAdd(object sender, EventArgs e)
        {
            var child = new MovieDetailForm();

            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            //Save Movie
            _database.Add(child.Movie);
            UpdateList();
        }
Exemplo n.º 2
0
        private void EditMovie(Movie movie)
        {
            var child = new MovieDetailForm();

            child.Movie = movie;
            if (child.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            //Save Movie
            _database.Update(child.Movie);
            RefreshList();
        }
Exemplo n.º 3
0
        private void EditMovie(Movie movie)
        {
            if (movie != null)
            {
                var movieDetailForm = new MovieDetailForm(movie);
                movieDetailForm.PlaceValuesInTextBox(movie);
                if (movieDetailForm.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                _database.Update(movieDetailForm.Movie);
                UpdateList();
            }
        }
Exemplo n.º 4
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_movie == null)
            {
                MessageBox.Show("There are no movies for you to edit.", "Edit Movie",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var movieDetailForm = new MovieDetailForm(_movie);

            movieDetailForm.PlaceValuesInTextBox(_movie);
            movieDetailForm.ShowDialog(this);

            _movie = movieDetailForm.Movie;
        }
Exemplo n.º 5
0
        private void TitleAdd(object sender, EventArgs e)
        {
            var button = sender as ToolStripMenuItem;



            var form = new MovieDetailForm("Add Title");



            //Show form modally

            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }
        }
Exemplo n.º 6
0
        private void OnMovieEdit(object sender, EventArgs e)
        {
            if (_movie == null)
            {
                MessageBox.Show("No movie defined YET!", "Error");
                return;
            }

            var child = new MovieDetailForm();

            child.Movie = _movie;
            if (child.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            //TODO: Save Movie
            _movie = child.Movie;
        }
Exemplo n.º 7
0
        private void OnAdd(object sender, EventArgs e)
        {
            var movieDetailForm = new MovieDetailForm();

            if (movieDetailForm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                _database.Add(movieDetailForm.Movie);
            }
            catch (Exception er)
            {
                DisplayError(er);
            }
            UpdateList();
        }
Exemplo n.º 8
0
        private void OnTitleEdit(object sender, EventArgs e)

        {
            //Get selected Title

            var _title = GetSeletedTitle();

            if (_title == null)
            {
                return;
            }

            var form = new MovieDetailForm(_title);

            var result = form.ShowDialog(this);

            if (result != DialogResult.OK)
            {
                return;
            }
Exemplo n.º 9
0
        private void EditMovie(Movie movie)
        {
            var movieDetailForm = new MovieDetailForm(movie);

            movieDetailForm.PlaceValuesInTextBox(movie);
            if (movieDetailForm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                _database.Update(movieDetailForm.Movie);
            }
            catch (Exception er)
            {
                DisplayError(er);
            }
            UpdateList();
        }
Exemplo n.º 10
0
        private void OnMoviesEdit(object sender, EventArgs e)
        {
            //If there is no movie, show error dialog.
            if (_movie == null)
            {
                MessageBox.Show(this, "No movie to edit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            var child = new MovieDetailForm();

            child.Movie = _movie;

            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            //Save Movie
            _movie = child.Movie;
        }
Exemplo n.º 11
0
        private void EditMovie(Movie movie)
        {
            var child = new MovieDetailForm();

            child.Movie = movie;

            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            //Save Movie
            try
            {
                _database.Update(child.Movie);
            } catch (Exception ex)
            {
                DisplayError(ex, "Update failed");
            };
            UpdateList();
        }
Exemplo n.º 12
0
        private void OnMoviesAdd(object sender, EventArgs e)
        {
            var child = new MovieDetailForm();

            if (child.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            try
            {
                _database.Add(child.Movie);
            } catch (ValidationException ex)
            {
                DisplayError(ex, "Validation Failed");
            } catch (Exception ex)
            {
                DisplayError(ex, "Add Failed");
            };

            UpdateList();
        }