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 List <quyennguoidung> GetListQuyen(string sidnhom) { quyen_nhomBL ctr = new quyen_nhomBL(); menuBL ctrmenu = new menuBL(); try { List <quyennguoidung> lst = new List <quyennguoidung>(); string sidnhanvien = ""; if (c1FlexGrid1.Rows.Count - 1 <= 0) { return(null); } try { sidnhanvien = c1FlexGrid1[c1FlexGrid1.RowSel, "idnhanvien"].ToString().Trim(); } catch { } DataTable dt = new DataTable(); dt = ctr.GetByIDNhom(sidnhom); for (int i = 0; i < dt.Rows.Count; i++) { menu objmenu = new menu(); objmenu = ctrmenu.GetByID(Convert.ToInt32(dt.Rows[i]["menuid"].ToString().Trim())); if (objmenu != null) { quyennguoidung objquyennd = new quyennguoidung(); objquyennd.idmenu = objmenu.menuid; objquyennd.idnhanvien = sidnhanvien; objquyennd.kyhieucn = objmenu.menulink; objquyennd.mota = objmenu.ghichu; string sEdit = ""; if (chbEdit.Checked == true) { sEdit = "EDIT"; } string sDel = ""; if (chbDel.Checked == true) { sDel = "DEL"; } objquyennd.quyendl = sEdit + ";" + sDel; objquyennd.status = Convert.ToBoolean(objmenu.status); objquyennd.tenquyendl = objmenu.menuname; lst.Add(objquyennd); } } return(lst); } catch { return(null); } }
private void HienThiDSQuyen(string sidnhom) { quyen_nhomBL ctr = new quyen_nhomBL(); DataTable dt = new DataTable(); dt = ctr.GetByIDNhom(sidnhom); UncheckAllNodes(treeQuyen.Nodes); for (int i = 0; i < dt.Rows.Count; i++) { TreeNode[] arr = treeQuyen.Nodes.Find(dt.Rows[i]["menuid"].ToString().Trim(), true); if (arr.Length > 0) { arr[0].Checked = true; } } }