public void UnlockTableDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (UnlockTableDataGridView.Columns[e.ColumnIndex].Name == "ActionButtonColumn" && e.RowIndex >= 0 && UnlockTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value != null) { DialogResult tempDialogResult = MessageBox.Show("Are you sure you want to unlock?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (tempDialogResult.Equals(DialogResult.No)) return; else { String tempOldOrderID = UnlockTableDataGridView.Rows[e.RowIndex].Cells["OrderIDColumn"].Value.ToString(); Int64 tempOldTableNumber = Int64.Parse(UnlockTableDataGridView.Rows[e.RowIndex].Cells["TableNumberColumn"].Value.ToString()); String tempOldTableType = UnlockTableDataGridView.Rows[e.RowIndex].Cells["TableTypeColumn"].Value.ToString(); COrderManager tempUnlockTableManager = new COrderManager(); CResult tempResult = tempUnlockTableManager.UpdateForUnlockTable(tempOldTableNumber, tempOldTableType); if (tempResult.IsSuccess) { this.PopulateUnlockTableDataGridView(); } } } } catch (Exception ex) { } }