/// <summary> /// 获取功能列表为ZTree /// </summary> static public void GetDepartmentInfoChild(List <Hashtable> list, DataRow[] allList, DataTable dt) { try { if (allList.Length > 0) { foreach (DataRow dr in allList) { bool isParent = false; DataRow[] allChild = dt.Select(string.Format("ParentID={0}", dr["DepartmentID"]), "DepartmentID ASC"); if (allChild != null && allChild.Length > 0) { isParent = true; } string className = ComPage.SafeToString(dr["DepartmentName"]); Hashtable child = new Hashtable(); child.Add("id", dr["DepartmentID"]); child.Add("name", className); child.Add("pId", dr["ParentID"]); child.Add("open", true); if (isParent) { GetDepartmentInfoChild(list, allChild, dt); } list.Add(child); } } } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } }
/// <summary> /// 获取左侧导航子菜单 /// </summary> static public void GetLeftMenuChild(List <Hashtable> list, DataRow[] allList, DataTable dt) { try { if (allList.Length > 0) { foreach (DataRow dr in allList) { bool isParent = false; DataRow[] allChild = dt.Select(string.Format("ClassId=0 and parentId={0}", dr["FunctionId"]), "OrderId ASC"); if (allChild != null && allChild.Length > 0) { isParent = true; } string className = ComPage.SafeToString(dr["FunctionName"]); Hashtable child = new Hashtable(); child.Add("id", dr["FunctionId"]); child.Add("name", className); child.Add("pId", dr["ParentId"]); child.Add("url", dr["ExternalLinkAddress"]); child.Add("code", dr["FunctionCode"]); if (isParent) { GetLeftMenuChild(list, allChild, dt); } list.Add(child); } } } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } }
/// <summary> /// 获取角色列表为ZTree /// </summary> static public Object GetDepartmentInfoListForZTree() { #region 开始 string result = string.Empty; try { int channelId = DNTRequest.GetInt("channelId", 7); int ParentId = DNTRequest.GetInt("ParentId", 0); DepartmentInfoBLL op = new DepartmentInfoBLL(); DepartmentInfo model = new DepartmentInfo(); DataSet ds = op.GetList(" RecordIsDelete=0 "); DataTable dt = null; if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } List <Hashtable> list = new List <Hashtable>(); if (dt != null && dt.Rows.Count > 0) { DataRow[] allList = dt.Select(string.Format("ParentId={0}", ParentId), "DepartmentID ASC"); if (allList.Length > 0) { foreach (DataRow dr in allList) { bool isParent = false; DataRow[] allChild = dt.Select(string.Format("ParentId={0}", dr["DepartmentID"]), "DepartmentID ASC"); if (allChild != null && allChild.Length > 0) { isParent = true; } #region inner001 string className = ComPage.SafeToString(dr["DepartmentName"]); Hashtable ht = new Hashtable(); ht.Add("id", dr["DepartmentID"]); ht.Add("name", className); ht.Add("pId", dr["ParentId"]); ht.Add("open", true); if (isParent) { GetDepartmentInfoChild(list, allChild, dt); } list.Add(ht); #endregion } } } result = DNTRequest.GetResultJson(true, "success", list); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, ex.Message, null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); #endregion end 开始 }
/// <summary> /// 获取左侧导航菜单 /// </summary> static public Object GetLeftMenu() { #region 开始 string result = string.Empty; try { int parentId = DNTRequest.GetInt("parentId", 0); FunctionBLL opFunctionBLL = new FunctionBLL(); Function modelFunction = new Function(); DataSet ds = opFunctionBLL.GetList("IsDeleted=0"); DataTable dt = null; if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } List <Hashtable> list = new List <Hashtable>(); if (dt != null && dt.Rows.Count > 0) { DataRow[] allList = dt.Select(string.Format("ClassId=0 and ParentId={0}", parentId), "OrderId ASC"); if (allList.Length > 0) { foreach (DataRow dr in allList) { bool isParent = false; DataRow[] allChild = dt.Select(string.Format("ClassId=0 and ParentId={0}", dr["FunctionId"]), "OrderId ASC"); if (allChild != null && allChild.Length > 0) { isParent = true; } string className = ComPage.SafeToString(dr["FunctionName"]); Hashtable ht = new Hashtable(); ht.Add("id", dr["FunctionId"]); ht.Add("name", className); ht.Add("pId", dr["ParentId"]); ht.Add("url", dr["ExternalLinkAddress"]); ht.Add("code", dr["FunctionCode"]); if (isParent) { GetLeftMenuChild(list, allChild, dt); } list.Add(ht); } } } result = DNTRequest.GetResultJson(true, "success", list); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, ex.Message, null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); #endregion end 开始 }