private void button1_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count < 1)
            {
                return;
            }
            if (comboBox1.SelectedIndex < 0 || comboBox2.SelectedIndex < 0)
            {
                return;
            }
            Cursor.Current  = Cursors.WaitCursor;
            button1.Enabled = false;
            ATINChamCongEntities context = new ATINChamCongEntities();

            DateTime datetmp = DateTime.MinValue;
            int      i       = 0;
            int      y       = 0;

            try
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    y = 0;
                    if (row.Cells[0].Value == null)
                    {
                        continue;
                    }
                    if ((bool)row.Cells[0].Value == true)
                    {
                        if (true)
                        {
                            foreach (ListViewItem lvItem in listView1.Items)
                            {
                                y++;
                                if (lvItem.Checked == true)
                                {
                                    string s = (lvItem.Tag as int?).ToString() + "/" + (comboBox4.SelectedIndex + 1).ToString() + "/" + (2020 + comboBox5.SelectedIndex).ToString();
                                    datetmp = Convert.ToDateTime(s, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
                                    var x = context.spInsertChamCongLoaiVang(datetmp, (row.DataBoundItem as Nguoi).MaNguoi, (comboBox2.SelectedItem as CaLamViec).MaCaLamViec, (comboBox1.SelectedItem as KyHieuCacLoaiVang).MaKyHieu, textBox9.Text.Trim());
                                }
                            }
                        }
                    }
                    i++;
                }
                MessageBox.Show("Thêm công vắng thành công!");
            }
            catch (Exception ex)
            {
                if (ex.Message == "An error occurred while executing the command definition. See the inner exception for details.")
                {
                    Nguoi loi = (dataGridView1.Rows[i].DataBoundItem as Nguoi);
                    MessageBox.Show("Thêm vắng bị dừng giữa chừng \nKhông thể thêm vắng cho " + loi.HoTen + "(" + loi.MaNguoi.ToString() + ")" + "\n" + (comboBox2.SelectedItem as CaLamViec).MaCaLamViec + " Ngày " + y.ToString() + "/" + (comboBox4.SelectedIndex + 1).ToString() + "/" + (2020 + comboBox5.SelectedIndex).ToString() + " Đã tồn tại!", "Cảnh báo!");
                }
                else
                {
                    MessageBox.Show(ex.Message);
                }
            }
            DataGridView2Config(dataGridView1.SelectedRows[0].DataBoundItem as Nguoi);
            Cursor.Current  = Cursors.Default;
            button1.Enabled = true;
        }