private void button1_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; button1.Enabled = false; button2.Enabled = false; ATINChamCongEntities context = new ATINChamCongEntities(); if (dataGridView1.Rows.Count < 1) { return; } try { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value == null) { continue; } if ((bool)row.Cells[0].Value == true) { context.spDeleteChamCongChiTietByNguoi((row.DataBoundItem as Nguoi).MaNguoi, dateEdit1.DateTime, dateEdit2.DateTime, checkBox1.Checked); } } MessageBox.Show("Xóa dữ liệu chấm công thành công!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } Cursor.Current = Cursors.Default; button1.Enabled = true; button2.Enabled = true; }