Example #1
0
        private void toolStripLuu_Click_1(object sender, EventArgs e)
        {
            DataTable sdt = busCC.LoadCTCC(busCC.GetMaPhieu(cbxNhanVien.SelectedValue.ToString(), int.Parse(cbo_Nam.Text), int.Parse(cbo_Thang.Text)).ToString());

            foreach (DataRow row in sdt.Rows)
            {
                if (row["Ngay"].ToString() == cbo_Ngay.Text)
                {
                    MessageBox.Show("Đã chấm công ngày này rồi!", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (cbxNhanVien.SelectedValue.ToString() != string.Empty || cbo_Nam.Text != string.Empty || cbo_Thang.Text != string.Empty || cbo_Ngay.Text != string.Empty ||
                txtGioTC.Text != string.Empty || txtGioTre.Text != string.Empty || chkNgayCong.Checked == false)
            {
                if (busCC.Luu(cbxNhanVien.SelectedValue.ToString(), int.Parse(cbo_Nam.Text), int.Parse(cbo_Thang.Text), int.Parse(cbo_Ngay.Text), int.Parse(txtGioTC.Text), int.Parse(txtGioTre.Text), chkNgayCong.Checked))
                {
                    MessageBox.Show("Lưu thành công");
                }
                else
                {
                    MessageBox.Show("Lưu thất bại");
                }
            }
            else
            {
                MessageBox.Show("Thiếu thông tin");
            }
            xem();
        }