public ActionResult _CreateOperation(ManagementOperationType operationType, string presentAreaKey = PresentAreaKeysOfBuiltIn.Channel) { IEnumerable<ApplicationBase> applications = appService.GetAll().Where(n => appService.IsAvailable(presentAreaKey, n.ApplicationId)); ViewData["ApplicationId"] = new SelectList(applications.Select(n => new { text = n.Config.ApplicationName, value = n.ApplicationId }), "value", "text"); return View(); }
/// <summary> /// 管理快捷导航 /// </summary> public ActionResult ManageQuickOperations(string presentAreaKey = PresentAreaKeysOfBuiltIn.Channel, ManagementOperationType operationType = ManagementOperationType.Shortcut) { pageResourceManager.InsertTitlePart("快捷操作管理"); Dictionary<string, IEnumerable<ApplicationManagementOperation>> items = new Dictionary<string, IEnumerable<ApplicationManagementOperation>>(); if (operationType == ManagementOperationType.Shortcut) { IEnumerable<ApplicationManagementOperation> shortCuts = operationService.GetShortcuts(presentAreaKey, false); //取到应用Id并去重 List<int> appId = new List<int>(); appId = shortCuts.Select(n => n.ApplicationId).Distinct().ToList(); foreach (int applicationId in appId) { List<ApplicationManagementOperation> currentshortCuts = shortCuts.Where(n => n.ApplicationId == applicationId).ToList(); if (applicationId != 0) { items.Add(appService.Get(applicationId).Config.ApplicationName, currentshortCuts); } else { items.Add("未设置应用", currentshortCuts); } } } else { IEnumerable<ApplicationManagementOperation> managementMenus = operationService.GetManagementMenus(presentAreaKey, false); //取到应用Id并去重 List<int> appId = new List<int>(); appId = managementMenus.Select(n => n.ApplicationId).Distinct().ToList(); foreach (int applicationId in appId) { List<ApplicationManagementOperation> currentManagementMenus = managementMenus.Where(n => n.ApplicationId == applicationId).ToList(); if (applicationId != 0) { items.Add(appService.Get(applicationId).Config.ApplicationName, currentManagementMenus); } else { items.Add("未设置应用", currentManagementMenus); } } } return View(items); }
/// <summary> /// 获取指定呈现区域指定类型的管理操作 /// </summary> /// <param name="presentAreaKey">呈现区域标识</param> /// <param name="operationType">管理操作类型</param> /// <param name="onlyEnabled">是否仅返回启用状态的</param> /// <returns>获取呈现区域满足条件的管理操作</returns> private IEnumerable<ApplicationManagementOperation> GetManagementOperations(string presentAreaKey, ManagementOperationType operationType, bool onlyEnabled = true) { IEnumerable<ApplicationManagementOperation> allOperations = repository.GetAll("DisplayOrder"); IEnumerable<ApplicationManagementOperation> operationsOfPresentArea = allOperations.Where(n => n.OperationType == operationType && n.PresentAreaKey.Equals(presentAreaKey, StringComparison.InvariantCultureIgnoreCase)); if (onlyEnabled) return operationsOfPresentArea.Where(n => n.IsEnabled); else return operationsOfPresentArea; }
/// <summary> /// 获取指定呈现区域指定类型的管理操作 /// </summary> /// <param name="presentAreaKey">呈现区域标识</param> /// <param name="operationType">管理操作类型</param> /// <param name="onlyEnabled">是否仅返回启用状态的</param> /// <returns>获取呈现区域满足条件的管理操作</returns> private IEnumerable <ApplicationManagementOperation> GetManagementOperations(string presentAreaKey, ManagementOperationType operationType, bool onlyEnabled = true) { IEnumerable <ApplicationManagementOperation> allOperations = repository.GetAll("DisplayOrder"); IEnumerable <ApplicationManagementOperation> operationsOfPresentArea = allOperations.Where(n => n.OperationType == operationType && n.PresentAreaKey.Equals(presentAreaKey, StringComparison.InvariantCultureIgnoreCase)); if (onlyEnabled) { return(operationsOfPresentArea.Where(n => n.IsEnabled)); } else { return(operationsOfPresentArea); } }
/// <summary> /// 创建快捷操作 /// </summary> /// <param name="presentAreaKey"></param> /// <returns></returns> public string _CreateOperation(ManagementOperationType? operationType, string presentAreaKey = PresentAreaKeysOfBuiltIn.Channel) { RouteValueDictionary dic = new RouteValueDictionary(); dic.Add("presentAreaKey", presentAreaKey); dic.Add("operationType", operationType); return CachedUrlHelper.Action("_CreateOperation", "ControlPanelSettings", CommonAreaName, dic); }
/// <summary> /// 快捷操作 /// </summary> public string ManageQuickOperations(ManagementOperationType? operationType = null, string presentAreaKey = null) { RouteValueDictionary dic = new RouteValueDictionary(); if (operationType != null) { dic.Add("operationType", operationType); } if (presentAreaKey != null) { dic.Add("presentAreaKey", presentAreaKey); } return CachedUrlHelper.Action("ManageQuickOperations", "ControlPanelSettings", CommonAreaName, dic); }