private void deleteBtn_Click(object sender, EventArgs e) { int itemIndex = 0; DataTable myTable = (DataTable)dataGrid1.DataSource; List <string> argumentsList = new List <string>(); foreach (DataRow item in myTable.Rows) { if (dataGrid1.IsSelected(itemIndex)) { if (check.ToString() == "Movies") { argumentsList.Add(item["Tytuł"].ToString()); } if (check.ToString() == "Comments") { argumentsList.Add(item["Email"].ToString()); } if (check.ToString() == "Users") { argumentsList.Add(item["Email"].ToString()); } } itemIndex++; } MongoQueries.DeleteMany(argumentsList, check.ToString()); getAllMoviesBtn_Click(sender, e); }
private void showAllUsersBtn_Click(object sender, EventArgs e) { dataGrid1.DataSource = MongoQueries.GetAllUsers(); check = _checkChoice.Users; filterComboBox.Items.Clear(); DataHelper.FillFilterComboBox(check, filterComboBox); }
private void searchButton_Click_1(object sender, EventArgs e) { foreach (var foo in Enum.GetValues(typeof(_checkChoice))) { if (check.ToString() == foo.ToString()) { dataGrid1.DataSource = MongoQueries.FilterBy(findTxt.Text, check.ToString(), filterComboBox.SelectedItem.ToString()); } } }
private void addUserBtn_Click(object sender, EventArgs e) { using (addUserForm addUserForm = new addUserForm()) { if (addUserForm.ShowDialog() == DialogResult.OK) { MongoQueries.AddUser(addUserForm.Document); } } }
private void addCommentBtn_Click(object sender, EventArgs e) { using (addCommentForm addComment = new addCommentForm()) { DialogResult dr = addComment.ShowDialog(); if (dr == DialogResult.Yes) { MongoQueries.AddComment(addComment.NewComment); MongoQueries.UpdateCommentAmount(addComment.MovieTitle, addComment.UserEmail); MessageBox.Show("Comment added successfully.", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void addMovieBtn_Click(object sender, EventArgs e) { using (addMovieForm addMovieForm = new addMovieForm()) { DialogResult dr = addMovieForm.ShowDialog(); if (dr == DialogResult.OK) { MongoQueries.AddMovie(addMovieForm.NewMovie); MessageBox.Show("Successfully added 1 movie.", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (dr == DialogResult.Yes) { int amount = addMovieForm.amount(); MongoQueries.AddMovies(addMovieForm.MoviesList); MessageBox.Show("Successfully added " + amount + " movies.", "Add", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }