private void btn_luu_ItemClick(object sender, ItemClickEventArgs e) { if (!KTDL()) { return; } var result = nv.InsertNV(txt_maNV.Text, txt_tenNV.Text, cbo_MaCV.Text, txt_DiaChi.Text, txt_DienThoai.Text, cbo_GioiTinh.Text, datetimepick_NgayVaoLam.Text); switch (result) { case DAL.Result.SUCCESS: MessageBox.Show("Thêm thông tin nhân viên thành công"); break; case DAL.Result.EMPTY: MessageBox.Show("Chưa nhập đủ thông tin"); break; case DAL.Result.FAILED: MessageBox.Show("Thêm thông tin nhân viên thất bại"); break; case DAL.Result.PRIMARY_KEY: MessageBox.Show("Mã nhân viên đã tồn tại"); break; case DAL.Result.UNIQUE_NAME: MessageBox.Show("Tên nhân viên đã tồn tai"); break; } if (result == DAL.Result.SUCCESS) { this.Close(); } }
public Result InsertNhanVien(string pMaNV, string pTenNV, string pMaCV, string pDiaChiNV, string pDienThoaiNV, string pGioiTinh, string pNgayVaoLam) { if (string.IsNullOrEmpty(pMaNV) || string.IsNullOrEmpty(pTenNV)) { return(Result.EMPTY); } return(nv.InsertNV(pMaNV, pTenNV, pMaCV, pDiaChiNV, pDienThoaiNV, pGioiTinh, pNgayVaoLam)); }