/// <summary> /// 更新模块子模块数 /// </summary> /// <param name="m">模块实体类</param> static void setModuleTreeCache(sys_ModuleTable m) { if (m.M_ParentID != 0) { if (Sys_moduleTreeCache.ContainsKey(m.M_ParentID)) { Sys_moduleTreeCache[m.M_ParentID].Add(m); } } }
/// <summary> /// 读取系统模块 /// </summary> /// <param name="moduledelegate">所有菜单读取缓存处理</param> /// <param name="topmoduledelegate">一级菜单读取缓存处理</param> /// <param name="treemoduledelegate">二级菜单读取类</param> /// <param name="isDelegate">是否异步读取数据</param> static void LoadsysModuleId(sysModuleCacheDelegate moduledelegate, sysModuleCacheDelegate topmoduledelegate, sysModuleCacheDelegate treemoduledelegate, bool isDelegate) { Sys_moduleCache.Clear(); Sys_moduletopCache.Clear(); Sys_moduleTreeCache.Clear(); init_moduletopCache(); int rint = 0; QueryParam qp = new QueryParam(); qp.Orderfld = " M_Applicationid,M_OrderLevel "; qp.OrderType = 0; qp.Where = " Where M_Close=0 "; qp.PageIndex = 1; qp.PageSize = int.MaxValue; ArrayList lst = BusinessFacade.sys_ModuleList(qp, out rint); foreach (sys_ModuleTable var in lst) { if (isDelegate) { moduledelegate(var); } else { setModuleCache(var); } } foreach (sys_ModuleTable var in lst) { if (isDelegate) { topmoduledelegate(var); treemoduledelegate(var); } else { setTopModuleCache(var); setModuleTreeCache(var); } } }
/// <summary> /// 设置模块缓存 /// </summary> /// <param name="m">设置模块</param> static void setModuleCache(sys_ModuleTable m) { Sys_moduleCache.Add(m.ModuleID, m); //初始化模块缓存 Sys_moduleTreeCache.Add(m.ModuleID, new List <sys_ModuleTable>()); //初始化树状模块缓存 }