//delete movie private void btnDeleteMovie_Click(object sender, EventArgs e) { string result = null; // validations for empty textbox input if (txtMovieID.Text != string.Empty) { try { result = myDatabase.addOrUpdateMovie(myMovies, "Delete"); MessageBox.Show(txtMovieTitle.Text + " Delete " + result); } catch (Exception ex) { MessageBox.Show(ex.Message); } //update Movies DGV to see new movie DisplayDGVmovies(); DGVmovies.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } else { MessageBox.Show("Fill the movieID fields while deleting movie"); } }
//update movie with any new info private void btnUpdateMovie_Click(object sender, EventArgs e) { myMovies = new Movies(txtMovieID.Text, txtMovieTitle.Text, txtRating.Text, txtMovieYear.Text, txtCopies.Text, txtMoviePlot.Text, txtGenre.Text); string result = null; // validations for empty textbox input if ((txtMovieTitle.Text != string.Empty) && (txtMovieID.Text != string.Empty)) { try { result = myDatabase.addOrUpdateMovie(myMovies, "Update"); MessageBox.Show(txtMovieTitle.Text + " Updating " + result); } catch (Exception ex) { MessageBox.Show(ex.Message); } //update Movies DGV to see new movie DisplayDGVmovies(); DGVmovies.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } else { MessageBox.Show("Fill the title and movieID fields while updating movie"); } }
private void btnPopularMovies_Click_1(object sender, EventArgs e) { //clear all the old data DGVmovies.DataSource = null; try { DGVmovies.DataSource = myDatabase.DGVpopularMovies(); //pass the dataTable data to the DGV DGVmovies.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } catch (Exception ex) { MessageBox.Show(ex.Message); } btnPopularMovies.Hide(); btnAllMovies.Show(); }