private void LoadComboboxTenNhanVien() { BLL.NhanVienBLL nhanVien = new BLL.NhanVienBLL(); cbbTenNhanVienTK.DataSource = nhanVien.LoadCbbManager(); cbbTenNhanVienTK.ValueMember = "MANV"; cbbTenNhanVienTK.DisplayMember = "HOTENNV"; }
private void btnCapNhatNV_Click(object sender, EventArgs e) { if (rbNamNV.Checked == true || rbNuNV.Checked == true) { if (txtMaNhanVienNV.Text != "" && txtHoNhanVienNV.Text != "" && txtTenNhanVienNV.Text != "" && txtDiaChiNV.Text != "" && txtDienThoaiNV.Text != "" && dtpNgaySinhNV.Text != "" && dtpNgayVaoLamNV.Text != "") { BLL.NhanVienBLL nhanVien = new BLL.NhanVienBLL(); if (rbNamNV.Checked == true) { if (nhanVien.Update(txtMaNhanVienNV.Text, txtHoNhanVienNV.Text, txtTenNhanVienNV.Text, dtpNgaySinhNV.Text, true, txtDiaChiNV.Text, txtDienThoaiNV.Text, txtCMNDNV.Text, txtQueQuanNV.Text, dtpNgayVaoLamNV.Text) == true) { MessageBox.Show("Cập nhật thành công ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LamMoiNhanVien(); LoadNhanVien(); LoadComboboxTenNhanVien(); } else { MessageBox.Show("Lỗi xảy ra trong quá trình thực hiện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (nhanVien.Update(txtMaNhanVienNV.Text, txtHoNhanVienNV.Text, txtTenNhanVienNV.Text, dtpNgaySinhNV.Text, false, txtDiaChiNV.Text, txtDienThoaiNV.Text, txtCMNDNV.Text, txtQueQuanNV.Text, dtpNgayVaoLamNV.Text) == true) { MessageBox.Show("Cập nhật thành công ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LamMoiNhanVien(); LoadNhanVien(); LoadComboboxTenNhanVien(); } else { MessageBox.Show("Lỗi xảy ra trong quá trình thực hiện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Nhập đầy đủ thông tin nhân viên trước khi thêm !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
//============================ private void LoadThongTinTaiKhoan() { BLL.NhanVienBLL nhanVienBLL = new BLL.NhanVienBLL(); DTO.NhanVienDTO nhanVien = nhanVienBLL.LoadThongTinTaiKhoan(this.UserName); txtHoNhanVien.Text = nhanVien.HoNV; txtTenNhanVien.Text = nhanVien.TenNV; dtpNgaySinhNhanVien.Text = nhanVien.NgaySinh; dtpNgayVaoLamNhanVien.Text = nhanVien.NgayVaoLam; if (nhanVien.GioiTinh == true) { rbNamNhanVien.Checked = true; } else { rbNuNhanVien.Checked = true; } txtUserName.Text = nhanVien.UserName; txtMaNV.Text = nhanVien.MaNV; txtCMNDNhanVien.Text = nhanVien.CmndNV; txtDienThoaiNhanVien.Text = nhanVien.DienThoai; txtUserName1.Text = nhanVien.UserName; }
private void btnXoaNV_Click(object sender, EventArgs e) { if (txtMaNhanVienNV.Text != "") { BLL.NhanVienBLL nhanVien = new BLL.NhanVienBLL(); if (nhanVien.Delete(txtMaNhanVienNV.Text) == true) { MessageBox.Show("Xóa thành công nhân viên và tài khoản cấp phát cho nhân viên MNV : " + txtMaNhanVienNV.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LamMoiNhanVien(); LoadNhanVien(); LoadComboboxTenNhanVien(); } else { MessageBox.Show("Lỗi xảy ra trong quá trình thực hiện", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Kiểm tra thông tin mã nhân viên chưa được nhập!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void LoadThongTinNhanVien() { BLL.NhanVienBLL nv = new BLL.NhanVienBLL(); nhanVien = nv.GetNhanVienByMaNV(this.maNV); txtCMNDNhanVien.Text = nhanVien.Cmnd; txtDiaChiNhanVien.Text = nhanVien.DiaChi; txtDienThoaiNhanVien.Text = nhanVien.DienThoai; txtHoNhanVien.Text = nhanVien.HoNV; txtTenNhanVien.Text = nhanVien.TenNV; txtQueQuanNhanVien.Text = nhanVien.QueQuan; txtMaNV.Text = this.maNV; dtpNgayVaoLamNhanVien.Text = nhanVien.NgayVaoLam; dtpNgaySinhNhanVien.Text = nhanVien.NgaySinh; txtTenTaiKhoan.Text = nhanVien.MaNhanVien; if (nhanVien.GioiTinh == true) { rbNamNhanVien.Checked = true; } else { rbNuNhanVien.Checked = true; } }
private void LoadNhanVien() { BLL.NhanVienBLL nv = new BLL.NhanVienBLL(); dgvNV.DataSource = nv.Load(); }