public ModuleMenu GetUserMenu(int userId) { Dictionary <int, Dictionary <int, int> > dic = dal.GetUserRights(); // dicUserRights 包含该用户所有的 moduleId=>rights Dictionary <int, int> dicUserRights = new Dictionary <int, int>(); if (dic.ContainsKey(userId)) { dicUserRights = dic[userId]; } if (dic.ContainsKey(0)) { foreach (KeyValuePair <int, int> kv in dic[0]) { if (!dicUserRights.ContainsKey(kv.Key)) { dicUserRights.Add(kv.Key, kv.Value); } } } return(ModuleMenu.BuildTree(dal.GetModuleListDict(), dicUserRights.Keys)); }
public ModuleMenu GetAllMenu() { return(ModuleMenu.BuildTree(dal.GetModuleListDict())); }