private void parseChildTreeData(Hashtable pHash, SMC_Unit parent_unit, SMC_UnitDao unitDao, SMC_UserListDao ulDao, List <Hashtable> objs, int RoleId) { IList <SMC_UserList> users = ulDao.QueryUserListByUnitID(parent_unit.Unit_ID); foreach (SMC_UserList u in users) { Hashtable uhash = new Hashtable(); uhash["id"] = "u_" + u.UL_ID; uhash["name"] = u.UL_Name; uhash["tp"] = "user"; uhash["checked"] = ulDao.IsUserListInRole(u.UL_ID, RoleId); objs.Add(uhash); pHash["open"] = true; } IList <SMC_Unit> units = unitDao.QueryChildUnitsByUnitID(parent_unit.Unit_ID, -1); if (units != null && units.Count > 0) { //QueryUserListByUnitID foreach (SMC_Unit unit in units) { Hashtable hash = new Hashtable(); hash["id"] = unit.Unit_ID; hash["name"] = unit.Unit_Name; hash["tp"] = "unit"; objs.Add(hash); List <Hashtable> _objs = new List <Hashtable>(); parseChildTreeData(hash, unit, unitDao, ulDao, _objs, RoleId); } } if (objs.Count > 0) { pHash["children"] = objs; } }
private void parseChildTreeData(Hashtable pHash, SMC_Unit parent_unit, SMC_UnitDao unitDao, SMC_UserListDao ulDao, List<Hashtable> objs, int RoleId) { IList<SMC_UserList> users = ulDao.QueryUserListByUnitID(parent_unit.Unit_ID); foreach (SMC_UserList u in users) { Hashtable uhash = new Hashtable(); uhash["id"] = "u_" + u.UL_ID; uhash["name"] = u.UL_Name; uhash["tp"] = "user"; uhash["checked"] = ulDao.IsUserListInRole(u.UL_ID, RoleId); objs.Add(uhash); pHash["open"] = true; } IList<SMC_Unit> units = unitDao.QueryChildUnitsByUnitID(parent_unit.Unit_ID, -1); if (units != null && units.Count > 0) { //QueryUserListByUnitID foreach (SMC_Unit unit in units) { Hashtable hash = new Hashtable(); hash["id"] = unit.Unit_ID; hash["name"] = unit.Unit_Name; hash["tp"] = "unit"; objs.Add(hash); List<Hashtable> _objs = new List<Hashtable>(); parseChildTreeData(hash, unit, unitDao, ulDao, _objs, RoleId); } } if (objs.Count > 0) { pHash["children"] = objs; } }
public virtual Hashtable QueryPersonsTreeDataByUnit(string Unit_ID, int Role_ID) { try { Hashtable result = new Hashtable(); SMC_UserListDao ulDao = new SMC_UserListDao(AppConfig.statisticDBKey); SMC_UnitDao unitDao = new SMC_UnitDao(AppConfig.statisticDBKey); IList <SMC_UserList> ulList = ulDao.QueryUserListByUnitID(Unit_ID); SMC_Unit tunit = null; if (!String.IsNullOrEmpty(Unit_ID)) { tunit = unitDao.Get(Unit_ID); } List <Hashtable> hashs = new List <Hashtable>(); if (ulList.Count > 0) { List <Hashtable> objs = new List <Hashtable>(); foreach (SMC_UserList u in ulList) { Hashtable uhash = new Hashtable(); uhash["id"] = "u_" + u.UL_ID; uhash["name"] = u.UL_Name; uhash["tp"] = "user"; uhash["checked"] = ulDao.IsUserListInRole(u.UL_ID, Role_ID); hashs.Add(uhash); } //hash["children"] = objs; } IList <SMC_Unit> units = unitDao.QueryChildUnitsByUnitID(Unit_ID, 0); result["children"] = hashs; if (units != null && units.Count > 0) { foreach (SMC_Unit unit in units) { Hashtable hash = new Hashtable(); //bool isFnInRole = frDao.IsUserInRole(fn.FN_ID, Role_ID); hash["id"] = unit.Unit_ID; hash["name"] = unit.Unit_Name; hash["open"] = true; //hash["checked"] = isFnInRole; List <Hashtable> objs = new List <Hashtable>(); parseChildTreeData(hash, unit, unitDao, ulDao, objs, Role_ID); hashs.Add(hash); } } //if (tunit != null) { result["id"] = String.IsNullOrEmpty(Unit_ID) ? Unit_ID : tunit.Unit_ID; result["name"] = String.IsNullOrEmpty(Unit_ID) ? "全局" : tunit.Unit_Name; result["open"] = true; } return(result); } catch (DalException ex) { throw new BOException("QueryFunctionsByUnitID", ex); } }
public virtual Hashtable QueryPersonsTreeDataByUnit(string Unit_ID, int Role_ID) { try { Hashtable result = new Hashtable(); SMC_UserListDao ulDao = new SMC_UserListDao(AppConfig.statisticDBKey); SMC_UnitDao unitDao = new SMC_UnitDao(AppConfig.statisticDBKey); IList<SMC_UserList> ulList = ulDao.QueryUserListByUnitID(Unit_ID); SMC_Unit tunit = null; if (!String.IsNullOrEmpty(Unit_ID)) tunit = unitDao.Get(Unit_ID); List<Hashtable> hashs = new List<Hashtable>(); if (ulList.Count > 0) { List<Hashtable> objs = new List<Hashtable>(); foreach (SMC_UserList u in ulList) { Hashtable uhash = new Hashtable(); uhash["id"] = "u_" + u.UL_ID; uhash["name"] = u.UL_Name; uhash["tp"] = "user"; uhash["checked"] = ulDao.IsUserListInRole(u.UL_ID, Role_ID); hashs.Add(uhash); } //hash["children"] = objs; } IList<SMC_Unit> units = unitDao.QueryChildUnitsByUnitID(Unit_ID, 0); result["children"] = hashs; if (units != null && units.Count > 0) foreach (SMC_Unit unit in units) { Hashtable hash = new Hashtable(); //bool isFnInRole = frDao.IsUserInRole(fn.FN_ID, Role_ID); hash["id"] = unit.Unit_ID; hash["name"] = unit.Unit_Name; hash["open"] = true; //hash["checked"] = isFnInRole; List<Hashtable> objs = new List<Hashtable>(); parseChildTreeData(hash, unit, unitDao, ulDao, objs, Role_ID); hashs.Add(hash); } //if (tunit != null) { result["id"] = String.IsNullOrEmpty(Unit_ID) ? Unit_ID : tunit.Unit_ID; result["name"] = String.IsNullOrEmpty(Unit_ID) ? "ȫ��" : tunit.Unit_Name; result["open"] = true; } return result; } catch (DalException ex) { throw new BOException("QueryFunctionsByUnitID", ex); } }