Exemple #1
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (qlcf.Kiemtrakhoachinh(txtMaNhanVien.Text))
            {
                DialogResult result = MessageBox.Show("Bạn có muốn thêm nhân viên?", "Xác nhận", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    qlcf.ThemNV(txtMaNhanVien.Text, txtTenNhanVien.Text, cboNhomNV.SelectedValue.ToString());
                }
                else if (result == DialogResult.No)
                {
                    return;
                }
            }
            else
            {
                DialogResult result = MessageBox.Show("Bạn có muốn cập nhật nhân viên?", "Xác nhận", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    qlcf.CapNhatNV(txtMaNhanVien.Text, txtTenNhanVien.Text, cboNhomNV.SelectedValue.ToString());
                }
                else if (result == DialogResult.No)
                {
                    return;
                }
            }
            qlcf.getNhanVien(dataGridView1);

            btnThem.Enabled    = true;
            btnSua.Enabled     = false;
            btnXoa.Enabled     = false;
            btnCapNhat.Enabled = false;
        }