public static void Init() { Functions = new Dictionary<string,int >(); FunctionInts=new Dictionary<int, string>(); using (Context db = new Context()) { var query = (from o in db.Functions.AsNoTracking() select o) .ToList(); foreach(Function f in query) { if (f.ParentName != "-") f.Name = string.Format("{0}-{1}", f.ParentName, f.Name);//目前只支持2级权限 Functions.Add(f.Name, f.Id); FunctionInts.Add(f.Id,f.Name); } } }
public ActionResult Dictionary() { if (!UserInfo.CurUser.HasRight("系统管理-数据字典")) return Redirect("~/content/AccessDeny.htm"); var list = (from o in db.Dictionaries orderby o.Catalog select o).ToList(); System.Collections.Generic.Dictionary<string, List<Dictionary>> dictList = new Dictionary<string, List<Dictionary>>(); //OUDAL.Dictionary curDict = null; foreach (var dict in list) { if (!dictList.ContainsKey(dict.Catalog)) { dictList.Add(dict.Catalog, new List<Dictionary>()); } dictList[dict.Catalog].Add(dict); } return View(dictList); }