private void btnLuu_Click(object sender, EventArgs e) { if (them) { try { BLGiangVien blGV = new BLGiangVien(); if (picHinhGV.Image == null) { blGV.ThemGiangVien(this.txtMaGV.Text, this.txtTenGV.Text, this.rdoNam.Checked, this.txtDiaChi.Text, this.txtDienThoai.Text, this.txtEmail.Text, null, ref err); } else { blGV.ThemGiangVien(this.txtMaGV.Text, this.txtTenGV.Text, this.rdoNam.Checked, this.txtDiaChi.Text, this.txtDienThoai.Text, this.txtEmail.Text, imageToByteArray(picHinhGV.Image), ref err); } LoadData(); XtraMessageBox.Show("Đã thêm xong!"); } catch { XtraMessageBox.Show("Không thêm được. Lỗi rồi!"); } } else { BLGiangVien blGV = new BLGiangVien(); if (picHinhGV.Image == null) { blGV.CapNhatGiangVien(this.txtMaGV.Text, this.txtTenGV.Text, this.rdoNam.Checked, this.txtDiaChi.Text, this.txtDienThoai.Text, this.txtEmail.Text, null, ref err); } else { blGV.CapNhatGiangVien(this.txtMaGV.Text, this.txtTenGV.Text, this.rdoNam.Checked, this.txtDiaChi.Text, this.txtDienThoai.Text, this.txtEmail.Text, imageToByteArray(picHinhGV.Image), ref err); } LoadData(); XtraMessageBox.Show("Đã sửa xong!"); } }