private void OnMovieAdd(object sender, EventArgs e) { var button = sender as ToolStripMenuItem; var form = new MovieDetailForm("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(); }
/// <summary>Controls form for adding movie.</summary> private void OnProductAdd(object sender, EventArgs e) { var button = sender as ToolStripMenuItem; var form = new MovieDetailForm("Add Movie"); //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //"Add" the movie _movie = form.Product; }
private void EditMovie(Movie movie) { var form = new MovieDetailForm(movie); var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //Update the movie form.Movie.Id = movie.Id; _database.Update(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); } RefreshUI(); }
private void OnMovieAdd(object sender, EventArgs e) { var button = sender as ToolStripMenuItem; var form = new MovieDetailForm("Add Movie"); //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //Add to database _database.Add(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); } RefreshUI(); }
private void OnMovieEdit(object sender, EventArgs e) { if (_movie == null) { return; } var form = new MovieDetailForm(_movie); //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //"Editing" the movie _movie = form.Movie; }
/// <summary>Controls form for editing movie.</summary> private void OnProductEdit(object sender, EventArgs e) { if (_movie == null) { MessageBox.Show(this, "No Movies to Edit", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var form = new MovieDetailForm(_movie); //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //"Editing" the product _movie = form.Product; }
private void EditMovie(Movie movie) { var form = new MovieDetailForm(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(); }