private void btnLuuNV_Click(object sender, EventArgs e) //Lưu { try { obj.NV_MaNV = txtMaNhanVien.Text; obj.NV_HoTen = function.upperfirstword(txtTenNhanVien.Text); obj.NV_NgaySinh = DateTime.ParseExact(dateNgaySinh.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); obj.NV_SDT = txtSoDienThoai.Text; obj.NV_CMND = txtCMND.Text; obj.NV_GioiTinh = cbbGioiTinh.Text; obj.CV_MaCV = cbbChucVu.EditValue.ToString(); obj.CA_MaCa = cbbCaLam.EditValue.ToString(); obj.NV_DiaChi = function.upperfirst(txtDiaChi.Text); if (IsInsert == true) { if (txtMaNhanVien.Text == "") { XtraMessageBox.Show("Mã nhân viên không được để trống. Vui lòng điền thông tin!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { bus.Insert(obj); XtraMessageBox.Show("Đã thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); HienThi(); XoaText(); KhoaText(); btnThemMoi.Enabled = true; } } else { bus.Update(obj); XtraMessageBox.Show("Đã sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); HienThi(); XoaText(); KhoaText(); btnThemMoi.Enabled = true; } } catch { XtraMessageBox.Show("Thông tin nhân viên không được để trống, vui lòng nhập đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }