private void btnlogin_Click(object sender, EventArgs e) { frmDashboard f = new frmDashboard(); nvBUS nvB = new nvBUS(); Account acc = nvB.login(txtUser.Text, txtPass.Text); if (acc == null) { MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu!!!"); } else { if (acc.Id == "ad") { isAdmin = true; } else { isAdmin = false; } this.Hide(); f.ShowDialog(); this.Show(); } }
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 btnTim_Click(object sender, EventArgs e) { nvBUS nvB = new nvBUS(); showNV sNV = nvB.displayFrmNV(txtMaNV.Text); if (txtMaNV.Text == "") { MessageBox.Show("Vui lòng nhập mã nhân viên!"); } else if (sNV == null) { MessageBox.Show("Mã nhân viên " + txtMaNV.Text + " không tồn tại!"); } else { txtMaNV.Text = sNV.Id; txtUser.Text = sNV.Username; txtPass.Text = sNV.Password; txtTenNV.Text = sNV.Fullname; txtCMND.Text = sNV.Cmnd; txtNgaySinh.Text = sNV.Dateofbirth; txtDiaChi.Text = sNV.Diachi; txtEmail.Text = sNV.Email; txtCaLamViec.Text = sNV.Calamviec; cbbVaiTro.Text = sNV.RoleName; } }
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(); }
private void btnSua_Click(object sender, EventArgs e) { enable(); check = false; nvBUS nvB = new nvBUS(); txtNguoiLap.Text = nvB.getFullNamebyUsername(Form1.username).TenNV; btnLuu.Enabled = true; }
public frmNV() { InitializeComponent(); nvBUS role = new nvBUS(); grvNV.DataSource = role.getData(); grvNV.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; btnLuu.Enabled = false; disnable(); }
private void btnThem_Click(object sender, EventArgs e) { enable(); clear(); nvBUS nvB = new nvBUS(); txtNguoiLap.Text = (nvB.getFullNamebyUsername(Form1.username).TenNV); check = true; btnLuu.Enabled = true; }
private void btnChange_Click(object sender, EventArgs e) { nvBUS nvB = new nvBUS(); if (txtNewPass.Text != txtNewPass1.Text || txtCurPass.Text != Form1.password) { MessageBox.Show("Fail!"); } else if (nvB.changePassword(Form1.username, txtNewPass.Text) == 1) { MessageBox.Show("Đổi mật khẩu thành công!"); this.Close(); } }
private void btnTim_Click(object sender, EventArgs e) { bdBUS bdB = new bdBUS(); nvBUS nvB = new nvBUS(); BanDoc bd = bdB.searchBD(txtMaSo.Text); txtMaSo.Text = bd.Id; txtTenBD.Text = bd.Name; txtDiaChi.Text = bd.Address; txtCMND.Text = bd.Cmnd; txtNgaySinh.Text = bd.Ngaysinh; txtEmail.Text = bd.Email; txtNgayLap.Text = bd.Ngaylap; txtNguoiLap.Text = nvB.getFullNamebyID(bd.Nguoilap).TenNV; }
private void btnLuu_Click(object sender, EventArgs e) { nvBUS nvB = new nvBUS(); bdBUS bdB = new bdBUS(); string IdNguoiLap = nvB.getIDbyUsername(Form1.username).IdNV; BanDoc bd = new BanDoc(txtMaSo.Text, txtTenBD.Text, txtDiaChi.Text, txtCMND.Text, txtNgaySinh.Text, txtEmail.Text, txtNgayLap.Text, IdNguoiLap); if (check == true) { bdB.addBD(bd); } else { bdB.editBD(bd); disable(); } grvBanDoc.DataSource = bdB.getData(); }