private void HienThiDSNhom(string sidnhanvien) { nhom_nhanvienBL ctr = new nhom_nhanvienBL(); DataTable dt = new DataTable(); dt = ctr.GetByIDNhanVien(sidnhanvien); UncheckAllNodes(treeNhom.Nodes); for (int i = 0; i < dt.Rows.Count; i++) { TreeNode[] arr = treeNhom.Nodes.Find(dt.Rows[i]["idnhom"].ToString().Trim(), true); if (arr.Length > 0) { arr[0].Checked = true; } } try { string sidnhom = ""; sidnhom = dt.Rows[0]["idnhom"].ToString().Trim(); DataTable dtquyennhom = new DataTable(); quyen_nhomBL ctrquyennhom = new quyen_nhomBL(); dtquyennhom = ctrquyennhom.GetByIDNhom(sidnhom); int iidmenu = 0; iidmenu = Convert.ToInt32(dtquyennhom.Rows[0]["menuid"].ToString().Trim()); DataTable dtquyennd = new DataTable(); quyennguoidungBL ctrquyennguoidung = new quyennguoidungBL(); dtquyennd = ctrquyennguoidung.GetByIDNhanVien(sidnhanvien); string squyendl = ""; for (int j = 0; j < dtquyennd.Rows.Count; j++) { if (dtquyennd.Rows[j]["idmenu"].ToString().Trim().Equals(iidmenu.ToString()) == true) { squyendl = dtquyennd.Rows[0]["quyendl"].ToString().Trim(); break; } } string[] arrquyendl = squyendl.Split(';'); if (arrquyendl[0].Trim().Equals("EDIT") == true) { chbEdit.Checked = true; } else { chbEdit.Checked = false; } if (arrquyendl[1].Trim().Equals("DEL") == true) { chbDel.Checked = true; } else { chbDel.Checked = false; } } catch { } }
private void HienThiDSQuyen(string sidnhanvien) { treeQuyen.Enabled = false; quyennguoidungBL ctr = new quyennguoidungBL(); DataTable dt = new DataTable(); dt = ctr.GetByIDNhanVien(sidnhanvien); UncheckAllNodes(treeQuyen.Nodes); for (int i = 0; i < dt.Rows.Count; i++) { TreeNode[] arr = treeQuyen.Nodes.Find(dt.Rows[i]["idmenu"].ToString().Trim(), true); if (arr.Length > 0) { arr[0].Checked = true; } } treeQuyen.Enabled = true; string squyendl = ""; try { squyendl = dt.Rows[0]["quyendl"].ToString().Trim(); string[] arrquyendl = squyendl.Split(';'); if (arrquyendl[0].Trim().Equals("EDIT") == true) { chbEdit.Checked = true; } else { chbEdit.Checked = false; } if (arrquyendl[1].Trim().Equals("DEL") == true) { chbDel.Checked = true; } else { chbDel.Checked = false; } } catch { } }
private void DisplayMenu() { try { DisableAllMenu(); quyennguoidungBL ctr = new quyennguoidungBL(); DataTable dt = new DataTable(); dt = ctr.GetByIDNhanVien(Data.iduse); for (int i = 0; i < dt.Rows.Count; i++) { #region QTHT if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsQTHT") == true) { tsQTHT.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsChucVu") == true) { tsChucVu.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsPhongBan") == true) { tsPhongBan.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsGroup") == true) { tsGroup.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsUserOfGroup") == true) { tsUserOfGroup.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsRoleOfUse") == true) { tsRoleOfUse.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsUsers") == true) { tsUsers.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsLog") == true) { tsLog.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsMenu") == true) { tsMenu.Visible = true; } #endregion #region Danh mục if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsDanhMuc") == true) { tsDanhMuc.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsHangSX") == true) { tsHangSX.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsLoaiMH") == true) { //tsLoaiMH.Visible = true; //tắt vì yêu cầu tsLoaiMH.Visible = false; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsKhachHang") == true) { tsKhachHang.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsMatHang") == true) { tsMatHang.Visible = true; } #endregion #region Hàng hóa if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsHangHoa") == true) { tsHangHoa.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsExport") == true) { tsExport.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsImport") == true) { tsImport.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsNhapHang") == true) { tsNhapHang.Visible = true; } #endregion #region Báo cáo - Thống kê if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsReport") == true) { tsReport.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsTKDoanhThu") == true) { tsTKDoanhThu.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsTKCongNo") == true) { tsTKCongNo.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsTKCongNoNhap") == true) { tsTKCongNoNhap.Visible = true; } if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsMatHangSapHet") == true) { tsMatHangSapHet.Visible = true; } #endregion #region Help if (dt.Rows[i]["kyhieucn"].ToString().Trim().Trim().Equals("tsHelp") == true) { tsHelp.Visible = true; } #endregion } } catch { } }