private void grid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == grid.Columns["Edit_col_btn_col"].Index && e.RowIndex >= 0) { var ID = grid.Rows[e.RowIndex].Cells[2].Value; var rowdata = TypeData.Entries.First(p => p.SysID.Equals(ID)); var entry = new EditSingleEntry(); entry.LoadContentType(TypeData, rowdata); var result = entry.ShowDialog(this); if (result == DialogResult.OK) { LoadDataRows(); } } else if (e.ColumnIndex == grid.Columns["Delete_col_btn_col"].Index && e.RowIndex >= 0) { var ID = grid.Rows[e.RowIndex].Cells[2].Value; var rowdata = TypeData.Entries.First(p => p.SysID.Equals(ID)); var result = MessageBox.Show(this, "Are you sure? \nThe record will be permanently deleted.", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { Contentful.Importer.Library.ContentFul.Client.Instance.DeleteEntry(ID.ToString()); MessageBox.Show(this, "Record deleted.", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); Library.ContentFul.Client.Instance.UpdateLanguageCountryVersion(); LoadDataRows(); } } }
private void btnAdd_Click(object sender, EventArgs e) { var entry = new EditSingleEntry(); entry.LoadContentType(TypeData); var result = entry.ShowDialog(this); if (result == DialogResult.OK) { LoadDataRows(); } }