private void btnLuu_Click(object sender, EventArgs e) { RoleBUS role = new RoleBUS(); RoleNV roleID = role.getRoleID(cbbVaiTro.Text); // MessageBox.Show(roleID); nvBUS nvBus = new nvBUS(); NhanVien nv = new NhanVien(roleID.RoleId, txtMaNV.Text, txtUser.Text, txtPass.Text, txtTenNV.Text, txtCMND.Text, txtNgaySinh.Text, txtDiaChi.Text, txtEmail.Text, txtCaLamViec.Text); if (check == true) { if (nvBus.CheckUsername(txtUser.Text)) { MessageBox.Show(txtUser.Text + " đã tồn tại!!!"); } else { nvBus.addData(nv); disnable(); clear(); check = false; } } else { nvBus.edit(nv); disnable(); clear(); check = false; } grvNV.DataSource = nvBus.getData(); }
private void btnLuu_Click(object sender, EventArgs e) { RoleBUS role = new RoleBUS(); string roleID = role.getRoleID(cbbVaiTro.Text); // MessageBox.Show(roleID); nvBUS nvBus = new nvBUS(); NhanVien nv = new NhanVien(); nv.roleID = roleID; nv.idNV = txtMaNV.Text; nv.username = txtUser.Text; nv.password = txtPass.Text; nv.tenNV = txtTenNV.Text; nv.cmnd = txtCMND.Text; nv.ngaysinh = txtNgaySinh.Text; nv.diachi = txtDiaChi.Text; nv.email = txtEmail.Text; nv.calamviec = txtCaLamViec.Text; if (check == true) { nvBus.addData(nv); disnable(); clear(); check = false; } else { nvBus.edit(nv); disnable(); clear(); check = false; } grvNV.DataSource = nvBus.getData(); }