/// <summary> /// 获取当前页面的列表 /// </summary> /// <returns></returns> public static MvcHtmlString GetModuleColumnList(this HtmlHelper htmlHelper) { string currentUrl = (string)WebHelper.GetHttpItems("currentUrl"); BusinessLogic.SysManage.ISys_ModuleColumn _but = new Game.DataAccess.SysManage.Sys_ModuleColumnDAL(); IEnumerable <Game.Entity.SysManage.Sys_ModuleColumn> columnList = null; List <Entity.ModuleEntity> list = WebSecurityHelper.Passport.Current.MenuModuleList; Entity.ModuleEntity module = list.Find(t => t.F_UrlAddress == currentUrl); if (module == null) { columnList = new List <Entity.SysManage.Sys_ModuleColumn>(); } else { columnList = _but.GetColumnList(module.F_ModuleId); } //List<ModuleColumnEntity> columnList = new ModuleBLL().GetColumnListByUrl(currentUrl); Dictionary <string, string> dicColumn = new Dictionary <string, string>(); foreach (var item in columnList) { if (!dicColumn.ContainsKey(item.EnCode)) { dicColumn.Add(item.EnCode.ToLower(), item.FullName); } } string strColumnList = dicColumn.ToJson(); return(new MvcHtmlString("<script>var lrMouduleColumnList=" + strColumnList + "</script>")); }
/// <summary> /// 在执行操作方法后由 ASP.NET MVC 框架调用。 /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuted(ActionExecutedContext filterContext) { var areaName = filterContext.RouteData.DataTokens["area"] + "/"; //获取当前区域 var controllerName = filterContext.RouteData.Values["controller"] + "/"; //获取控制器 var action = filterContext.RouteData.Values["Action"]; //获取当前Action string currentUrl = "/" + areaName + controllerName + action; //拼接构造完整url ISys_MenuModule menu = new Sys_MenuModuleDAL(); Entity.ModuleEntity model = menu.GetMenuList(StructDictCode.状态.正常).Where(w => w.F_UrlAddress.Contains(currentUrl.Trim('/'))).FirstOrDefault(); switch (funType) { case StructDictCode.分类.访问: WebSecurityHelper.LogCommon.Current.WriteLog_Visit(model == null ? "" : model.F_FullName, currentUrl); break; } base.OnActionExecuted(filterContext); }
/// <summary> /// 获取当前页面的按钮 /// </summary> /// <returns></returns> public static MvcHtmlString GetModuleButtonList(this HtmlHelper htmlHelper) { string currentUrl = (string)WebHelper.GetHttpItems("currentUrl"); BusinessLogic.SysManage.ISys_ModuleButton _but = new DataAccess.SysManage.Sys_ModuleButtonDAL(); IEnumerable <Entity.SysManage.Sys_ModuleButton> buttonList = null; List <Entity.ModuleEntity> list = WebSecurityHelper.Passport.Current.MenuModuleList; Entity.ModuleEntity module = list.Find(t => t.F_UrlAddress == currentUrl); if (module == null) { buttonList = new List <Entity.SysManage.Sys_ModuleButton>(); } else { buttonList = _but.GetButtonList(module.F_ModuleId); //new ModuleBLL().GetButtonListByUrl(currentUrl); //查找 当前用户的权限->控件 BusinessLogic.SysManage.ISys_Authorize _authorize = new DataAccess.SysManage.Sys_AuthorizeDAL(); IEnumerable <Entity.SysManage.Sys_Authorize> authorizeList = _authorize.GetList(WebSecurityHelper.Passport.Current.UserId.ToString(), 2); } Dictionary <string, string> dicButton = new Dictionary <string, string>(); foreach (var item in buttonList) { if (!dicButton.ContainsKey(item.EnCode)) { dicButton.Add(item.EnCode, item.FullName); } } string strButtonList = dicButton.ToJson(); return(new MvcHtmlString("<script>var lrMouduleButtonList=" + strButtonList + "</script>")); }