Exemple #1
0
 private void supprimerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dgvNotices.SelectedRows.Count > 0)
     {
         if (MessageBox.Show("Confirmez-vous la suppression ?", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             var    coll   = new MongoDB.Driver.MongoClient(Properties.Settings.Default.MongoDB).GetDatabase("wfBiblio").GetCollection <Notice>("Notice");
             Notice notice = ((List <Notice>)dgvNotices.DataSource)[dgvNotices.SelectedRows[0].Index];
             coll.DeleteOne(Builders <Notice> .Filter.Eq(a => a._id, notice._id));
             btnSearch_Click(null, null);
         }
     }
 }