private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == gridBurdens.NewRowIndex || e.RowIndex < 0) { return; } if (e.ColumnIndex == 2) { var item = bindingSource1[e.RowIndex] as BurdenView; var form = new AddEditBurdenForm(item.BurdenId); if (form.ShowDialog(this) == DialogResult.OK) { loadBurdens(); } } else if (e.ColumnIndex == 3) { var item = bindingSource1[e.RowIndex] as BurdenView; var table = DbWrapper.Db.GetCollection <Burden>(); table.Delete(new BsonValue(item.BurdenId)); loadBurdens(); } }
private void btnAddNewBurden_Click(object sender, EventArgs e) { var form = new AddEditBurdenForm(); if (form.ShowDialog(this) == DialogResult.OK) { loadBurdens(); } }