private void btnDangky_Click(object sender, EventArgs e) { if (txtManv.Text == "" || txtTentaikhoan.Text == "" || txtMatkhau.Text == "" || txtnhaplaimatkhau.Text == "") { if (txtManv.Text.Trim().Length == 0) { MessageBox.Show("Bạn phải nhập mã nhân viên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtManv.Focus(); return; } else { string sql = "select IdNV from NHAN_VIEN where IdNV ='" + txtManv.Text.Trim() + "'"; string id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNV"].ToString(); } } if (id == "") { MessageBox.Show("Mã nhân viên không tồn tại. Có thể nó chưa được thêm vào bảng 'Nhân viên'.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtManv.Focus(); return; } } if (txtTentaikhoan.Text.Length == 0) { MessageBox.Show("Bạn phải nhập tên tài khoản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtTentaikhoan.Focus(); return; } if (txtMatkhau.Text.Length == 0) { MessageBox.Show("Bạn phải nhập mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMatkhau.Focus(); return; } if (txtnhaplaimatkhau.Text.Length == 0) { MessageBox.Show("Bạn chưa xác nhận lại mật khẩu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtnhaplaimatkhau.Focus(); return; } } else { if (txtMatkhau.Text.Length < 6) { MessageBox.Show("Độ dài mật khẩu không hợp lệ!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMatkhau.Focus(); return; } if (txtMatkhau.Text != txtnhaplaimatkhau.Text) { MessageBox.Show("Xác nhận mật khẩu không đúng. Hãy xác nhận lại mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtnhaplaimatkhau.Focus(); return; } string sql = "", sql1 = "", tennd = "", TK = ""; string danhmuc, quyen = ""; sql = "select NHOM_QUYEN_HAN.DanhmucTC from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + txtmanhomnd.Text + "'"; danhmuc = Ctrl.GetFieldValues(sql); sql = "select NHOM_QUYEN_HAN.QuyenDM from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + txtmanhomnd.Text + "'"; quyen = Ctrl.GetFieldValues(sql); sql = "select TenNV from NHAN_VIEN where IdNV = '" + txtManv.Text.Trim() + "'"; tennd = Ctrl.GetFieldValues(sql); sql = "select TaiKhoan from NHAN_VIEN where IdNV = '" + txtManv.Text.Trim() + "'"; TK = Ctrl.GetFieldValues(sql); TK += txtTentaikhoan.Text.Trim() + ", "; // mã hoá mật khẩu bằng thuật toá 3DES với key là 123 string mk = EncryptDataByTripleDES(txtMatkhau.Text, "123"); sql = "insert into NGUOI_DUNG values('" + txtmanguoidung.Text.Trim() + "','" + txtmanhomnd.Text.Trim() + "','" + txtManv.Text.Trim() + "',N'" + tennd + "','" + txtTentaikhoan.Text.Trim() + "','" + mk + "','" + DateTime.Now + "',N'" + danhmuc + "',N'" + quyen + "')"; sql1 = "update NHAN_VIEN set Taikhoan = '" + TK + "' where IdNV = '" + txtManv.Text.Trim() + "'"; try { Ctrl.RunSQL(sql); Ctrl.RunSQL(sql1); MessageBox.Show("Đăng ký thành công!", "Congratulation!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Close(); } } }
private void txtManv_TextChanged(object sender, EventArgs e) { if (txtManv.Text.Length != 0) { string sql = "select * from NHAN_VIEN where IdNV ='" + txtManv.Text.Trim() + "'"; string id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNV"].ToString(); } } if (id != "") { erp.Clear(); txtTentaikhoan.Enabled = true; txtMatkhau.Enabled = true; txtnhaplaimatkhau.Enabled = true; btnDangky.Enabled = true; if (txtManv.Text.Substring(0, 3) == "NQT") { string str = ""; sql = "SELECT IdNND from NHOM_NGUOI_DUNG WHERE TenNND = N'Nhóm người dùng là nhân viên quản trị'"; id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNND"].ToString(); } } if (id != "") { txtmanhomnd.Text = id; txttennhomnd.Text = "Nhóm người dùng là nhân viên quản trị"; str = "SELECT IdNhomQH FROM NHOM_NGUOI_DUNG WHERE IdNND = '" + txtmanhomnd.Text + "'"; txtmanhomqh.Text = Ctrl.GetFieldValues(str); str = "SELECT TenNQH FROM NHOM_QUYEN_HAN WHERE IdNQH = '" + txtmanhomqh.Text + "'"; txttennhomqh.Text = Ctrl.GetFieldValues(str); } } if (txtManv.Text.Substring(0, 3) == "NKT") { string str = ""; sql = "SELECT IdNND from NHOM_NGUOI_DUNG WHERE TenNND = N'Nhóm người dùng là nhân viên kế toán'"; id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNND"].ToString(); } } if (id != "") { txtmanhomnd.Text = id; txttennhomnd.Text = "Nhóm người dùng là nhân viên kế toán"; str = "SELECT IdNhomQH FROM NHOM_NGUOI_DUNG WHERE IdNND = '" + txtmanhomnd.Text + "'"; txtmanhomqh.Text = Ctrl.GetFieldValues(str); str = "SELECT TenNQH FROM NHOM_QUYEN_HAN WHERE IdNQH = '" + txtmanhomqh.Text + "'"; txttennhomqh.Text = Ctrl.GetFieldValues(str); } } if (txtManv.Text.Substring(0, 3) == "NBH") { string str = ""; sql = "SELECT IdNND from NHOM_NGUOI_DUNG WHERE TenNND = N'Nhóm người dùng là nhân viên bán hàng'"; id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNND"].ToString(); } } if (id != "") { txtmanhomnd.Text = id; txttennhomnd.Text = "Nhóm người dùng là nhân viên bán hàng"; str = "SELECT IdNhomQH FROM NHOM_NGUOI_DUNG WHERE IdNND = '" + txtmanhomnd.Text + "'"; txtmanhomqh.Text = Ctrl.GetFieldValues(str); str = "SELECT TenNQH FROM NHOM_QUYEN_HAN WHERE IdNQH = '" + txtmanhomqh.Text + "'"; txttennhomqh.Text = Ctrl.GetFieldValues(str); } } if (txtManv.Text.Substring(0, 3) == "NTK") { string str = ""; sql = "SELECT IdNND from NHOM_NGUOI_DUNG WHERE TenNND = N'Nhóm người dùng là nhân viên thủ kho'"; id = ""; if (Ctrl.GetDataToTable(sql) != null) { foreach (DataRow dr in Ctrl.GetDataToTable(sql).Rows) { id = dr["IdNND"].ToString(); } } if (id != "") { txtmanhomnd.Text = id; txttennhomnd.Text = "Nhóm người dùng là nhân viên thủ kho"; str = "SELECT IdNhomQH FROM NHOM_NGUOI_DUNG WHERE IdNND = '" + txtmanhomnd.Text + "'"; txtmanhomqh.Text = Ctrl.GetFieldValues(str); str = "SELECT TenNQH FROM NHOM_QUYEN_HAN WHERE IdNQH = '" + txtmanhomqh.Text + "'"; txttennhomqh.Text = Ctrl.GetFieldValues(str); } } } else { erp.SetError(txtManv, "Mã nhân viên này không tồn tại. Có thể nhân viên chưa được thêm vào bảng 'Nhân viên'!"); erp.SetIconAlignment(txtManv, ErrorIconAlignment.MiddleRight); txtTentaikhoan.Enabled = false; txtMatkhau.Enabled = false; txtnhaplaimatkhau.Enabled = false; txtnhaplaimatkhau.Text = ""; txtTentaikhoan.Text = ""; txtMatkhau.Text = ""; txtmanhomnd.Text = ""; txttennhomnd.Text = ""; txttennhomqh.Text = ""; txtmanhomqh.Text = ""; lblmatkhau.Text = ""; btnDangky.Enabled = false; } } else { erp.SetError(txtManv, "Mã nhân viên không được để trống!"); erp.SetIconAlignment(txtManv, ErrorIconAlignment.MiddleRight); txtTentaikhoan.Enabled = false; txtMatkhau.Enabled = false; txtnhaplaimatkhau.Enabled = false; txtnhaplaimatkhau.Text = ""; txtTentaikhoan.Text = ""; txtMatkhau.Text = ""; txtmanhomnd.Text = ""; txttennhomnd.Text = ""; txttennhomqh.Text = ""; txtmanhomqh.Text = ""; lblmatkhau.Text = ""; btnDangky.Enabled = false; } }
private void XEMQUYEN_Load(object sender, EventArgs e) { NGUOIDUNG_QH nq = new NGUOIDUNG_QH(); if (NGUOIDUNG_QH.xacnhan == true) { string danhmuc, quyen = ""; string sql = "select NHOM_QUYEN_HAN.DanhmucTC from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + NGUOIDUNG_QH.manhomND + "'"; danhmuc = Ctrl.GetFieldValues(sql); sql = "select NHOM_QUYEN_HAN.QuyenDM from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + NGUOIDUNG_QH.manhomND + "'"; quyen = Ctrl.GetFieldValues(sql); string[] danhmuctmp = danhmuc.Split('|'); string[] quyentmp = quyen.Split('|'); for (int j = 0; j < danhmuctmp.Length; ++j) { if (danhmuctmp[j].Trim() == "Quản lý nhân viên") { chkqlnv.Checked = true; string[] nv; nv = quyentmp[j].Split(';'); if (nv != null) { foreach (string items in nv) { if (items.Trim() == "Xem (đọc)") { clbqlnv.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlnv.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlnv.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlnv.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý khách hàng") { chkqlkh.Checked = true; string[] kh; kh = quyentmp[j].Split(';'); if (kh != null) { foreach (string items in kh) { if (items.Trim() == "Xem (đọc)") { clbqlkh.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlkh.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlkh.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlkh.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý nhà cung ứng") { chkqlncu.Checked = true; string[] ncu; ncu = quyentmp[j].Split(';'); if (ncu != null) { foreach (string items in ncu) { if (items.Trim() == "Xem (đọc)") { clbqlncu.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlncu.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlncu.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlncu.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý sản phẩm") { chkqlsp.Checked = true; string[] sp; sp = quyentmp[j].Split(';'); if (sp != null) { foreach (string items in sp) { if (items.Trim() == "Xem (đọc)") { clbqlsp.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlsp.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlsp.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlsp.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý hoá đơn") { chkqlhd.Checked = true; string[] hd; hd = quyentmp[j].Split(';'); if (hd != null) { foreach (string items in hd) { if (items.Trim() == "Xem (đọc)") { clbqlhd.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlhd.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlhd.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlhd.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Thống kê, báo cáo") { chktkbc.Checked = true; string[] tk; tk = quyentmp[j].Split(';'); if (tk != null) { foreach (string items in tk) { if (items.Trim() == "Xem (đọc)") { clbqltkbc.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqltkbc.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqltkbc.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqltkbc.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản trị hệ thống (quản lý người dùng)") { chkQuantri.Checked = true; string[] qt; qt = quyentmp[j].Split(';'); if (qt != null) { foreach (string items in qt) { if (items.Trim() == "Xem (đọc)") { clbquantri.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbquantri.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbquantri.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbquantri.SetItemChecked(3, true); } } } } } NGUOIDUNG_QH.manhomND = ""; NGUOIDUNG_QH.xacnhan = false; } DANGKY dk = new DANGKY(); if (DANGKY.xn == true) { string danhmuc, quyen = ""; string sql = "select NHOM_QUYEN_HAN.DanhmucTC from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + DANGKY.manhomnd + "'"; danhmuc = Ctrl.GetFieldValues(sql); sql = "select NHOM_QUYEN_HAN.QuyenDM from NHOM_QUYEN_HAN, NHOM_NGUOI_DUNG where NHOM_QUYEN_HAN.IdNQH = NHOM_NGUOI_DUNG.IdNhomQH and IdNND = '" + DANGKY.manhomnd + "'"; quyen = Ctrl.GetFieldValues(sql); string[] danhmuctmp = danhmuc.Split('|'); string[] quyentmp = quyen.Split('|'); for (int j = 0; j < danhmuctmp.Length; ++j) { if (danhmuctmp[j].Trim() == "Quản lý nhân viên") { chkqlnv.Checked = true; string[] nv; nv = quyentmp[j].Split(';'); if (nv != null) { foreach (string items in nv) { if (items.Trim() == "Xem (đọc)") { clbqlnv.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlnv.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlnv.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlnv.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý khách hàng") { chkqlkh.Checked = true; string[] kh; kh = quyentmp[j].Split(';'); if (kh != null) { foreach (string items in kh) { if (items.Trim() == "Xem (đọc)") { clbqlkh.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlkh.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlkh.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlkh.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý nhà cung ứng") { chkqlncu.Checked = true; string[] ncu; ncu = quyentmp[j].Split(';'); if (ncu != null) { foreach (string items in ncu) { if (items.Trim() == "Xem (đọc)") { clbqlncu.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlncu.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlncu.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlncu.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý sản phẩm") { chkqlsp.Checked = true; string[] sp; sp = quyentmp[j].Split(';'); if (sp != null) { foreach (string items in sp) { if (items.Trim() == "Xem (đọc)") { clbqlsp.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlsp.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlsp.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlsp.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý hoá đơn") { chkqlhd.Checked = true; string[] hd; hd = quyentmp[j].Split(';'); if (hd != null) { foreach (string items in hd) { if (items.Trim() == "Xem (đọc)") { clbqlhd.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlhd.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlhd.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlhd.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Thống kê, báo cáo") { chktkbc.Checked = true; string[] tk; tk = quyentmp[j].Split(';'); if (tk != null) { foreach (string items in tk) { if (items.Trim() == "Xem (đọc)") { clbqltkbc.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqltkbc.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqltkbc.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqltkbc.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản trị hệ thống (quản lý người dùng)") { chkQuantri.Checked = true; string[] qt; qt = quyentmp[j].Split(';'); if (qt != null) { foreach (string items in qt) { if (items.Trim() == "Xem (đọc)") { clbquantri.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbquantri.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbquantri.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbquantri.SetItemChecked(3, true); } } } } } DANGKY.manhomnd = ""; DANGKY.xn = false; } MAIN xemq = new MAIN(); if (MAIN.xemquyen == true) { string[] danhmuctmp = DANGNHAP.Danhmuc.Split('|'); string[] quyentmp = DANGNHAP.Quyen.Split('|'); for (int j = 0; j < danhmuctmp.Length; ++j) { if (danhmuctmp[j].Trim() == "Quản lý nhân viên") { chkqlnv.Checked = true; string[] nv; nv = quyentmp[j].Split(';'); if (nv != null) { foreach (string items in nv) { if (items.Trim() == "Xem (đọc)") { clbqlnv.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlnv.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlnv.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlnv.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý khách hàng") { chkqlkh.Checked = true; string[] kh; kh = quyentmp[j].Split(';'); if (kh != null) { foreach (string items in kh) { if (items.Trim() == "Xem (đọc)") { clbqlkh.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlkh.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlkh.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlkh.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý nhà cung ứng") { chkqlncu.Checked = true; string[] ncu; ncu = quyentmp[j].Split(';'); if (ncu != null) { foreach (string items in ncu) { if (items.Trim() == "Xem (đọc)") { clbqlncu.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlncu.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlncu.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlncu.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý sản phẩm") { chkqlsp.Checked = true; string[] sp; sp = quyentmp[j].Split(';'); if (sp != null) { foreach (string items in sp) { if (items.Trim() == "Xem (đọc)") { clbqlsp.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlsp.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlsp.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlsp.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản lý hoá đơn") { chkqlhd.Checked = true; string[] hd; hd = quyentmp[j].Split(';'); if (hd != null) { foreach (string items in hd) { if (items.Trim() == "Xem (đọc)") { clbqlhd.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqlhd.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqlhd.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqlhd.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Thống kê, báo cáo") { chktkbc.Checked = true; string[] tk; tk = quyentmp[j].Split(';'); if (tk != null) { foreach (string items in tk) { if (items.Trim() == "Xem (đọc)") { clbqltkbc.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbqltkbc.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbqltkbc.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbqltkbc.SetItemChecked(3, true); } } } } else if (danhmuctmp[j].Trim() == "Quản trị hệ thống (quản lý người dùng)") { chkQuantri.Checked = true; string[] qt; qt = quyentmp[j].Split(';'); if (qt != null) { foreach (string items in qt) { if (items.Trim() == "Xem (đọc)") { clbquantri.SetItemChecked(0, true); } if (items.Trim() == "Thêm (tạo) bản ghi") { clbquantri.SetItemChecked(1, true); } if (items.Trim() == "Sửa (cập nhật) bản ghi") { clbquantri.SetItemChecked(2, true); } if (items.Trim() == "Xoá (huỷ) bản ghi") { clbquantri.SetItemChecked(3, true); } } } } } MAIN.xemquyen = false; } chkQuantri.Enabled = false; chkqlhd.Enabled = false; chkqlkh.Enabled = false; chkqlnv.Enabled = false; chkqlsp.Enabled = false; chktkbc.Enabled = false; chkqlncu.Enabled = false; clbqlhd.Enabled = false; clbqlkh.Enabled = false; clbqlnv.Enabled = false; clbqlsp.Enabled = false; clbqltkbc.Enabled = false; clbquantri.Enabled = false; clbqlncu.Enabled = false; }