private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView1.CurrentCell != null) { var kyHieuVang = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].DataBoundItem as KyHieuCacLoaiVang; if (dataGridView1.CurrentCell.ColumnIndex == 3) { context.spUpdateKyHieuCacLoaiVang(kyHieuVang.MaKyHieu, (bool)dataGridView1.CurrentCell.Value, (bool)dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value); } if (dataGridView1.CurrentCell.ColumnIndex == 4) { context.spUpdateKyHieuCacLoaiVang(kyHieuVang.MaKyHieu, (bool)dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value, (bool)dataGridView1.CurrentCell.Value); } } }