private void OnMoviesAdd(object sender, EventArgs e) { var child = new MovieDetailsForm("Movie Details"); if (child.ShowDialog(this) != DialogResult.OK) { return; } _movie = child.Movie; }
private void OnMoviesAdd(object sender, EventArgs e) { var child = new MovieDetailsForm("Movie Details"); if (child.ShowDialog(this) != DialogResult.OK) { return; } _database.Add(child.Movie); UpdateList(); }
private void EditMovie(Movie movie) { var child = new MovieDetailsForm("Movie Details"); child.Movie = movie; if (child.ShowDialog(this) != DialogResult.OK) { return; } _database.Update(child.Movie); UpdateList(); }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Opens/creates form to add new movie exemplar depending on the current /// active form with selected movie. /// </summary> /// internal void AddNewMovieExemplar() { MovieListForm movieList = Find <MovieListForm> (); MovieDetailsForm movieDetials = Find <MovieDetailsForm> (); MovieExemplarListForm exemplarList = Find <MovieExemplarListForm> (); if (exemplarList != null && exemplarList.MdiForm == ActiveMdiChild) { OpenAddNew <MovieExemplarListForm> (); } else if (movieDetials != null && movieDetials.Record != null && movieDetials.MdiForm == ActiveMdiChild) { OpenAddNewMovieExemplarDetails(movieDetials.Record); } else if (movieList != null && movieList.CurrentRecord != null && movieList.MdiForm == ActiveMdiChild) { OpenAddNewMovieExemplarDetails(movieList.CurrentRecord); } else if (exemplarList != null && (exemplarList.Movie != null || exemplarList.CurrentRecord != null)) { OpenAddNew <MovieExemplarListForm> (); } else if (movieDetials != null && movieDetials.Record != null) { OpenAddNewMovieExemplarDetails(movieDetials.Record); } else if (movieList != null && movieList.CurrentRecord != null) { OpenAddNewMovieExemplarDetails(movieList.CurrentRecord); } else // movies == null && exemplars == null { Open <MovieListForm>(OpenMode.Edit); MessageBox.Show( "Choose a movie first!\n\n" + "Then select Add New Exemplar for the movie...", "Add New Movie Exemplar", MessageBoxButtons.OK, MessageBoxIcon.Information ); } }
private void EditMovie(Movie movie) { var child = new MovieDetailsForm("Movie Details"); child.Movie = movie; if (child.ShowDialog(this) != DialogResult.OK) { return; } try { _database.Update(child.Movie); } catch (Exception ex) { DisplayError(ex, "Update Failed"); }; UpdateList(); }
private void OnMovieAdd(object sender, EventArgs e) { var child = new MovieDetailsForm("Movie Details"); 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(); }