public ActionResult _Menu_Main(string spaceKey)
        {
            long        groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            GroupEntity group   = groupService.Get(groupId);

            if (group == null)
            {
                return(Content(string.Empty));
            }

            ManagementOperationService managementOperationService = new ManagementOperationService();

            ViewData["ApplicationManagementOperations"] = managementOperationService.GetShortcuts(PresentAreaKeysOfBuiltIn.GroupSpace, false);

            NavigationService navigationService = new NavigationService();

            return(View(navigationService.GetRootNavigations(PresentAreaKeysOfBuiltIn.GroupSpace, group.GroupId)));
        }
        /// <summary>
        /// 专题空间主导航
        /// </summary>
        /// <param name="spaceKey">专题空间标识</param>
        /// <returns></returns>
        //[HttpGet]
        public ActionResult _Menu_Main(string spaceKey)
        {
            long        topicId = TopicIdToTopicKeyDictionary.GetTopicId(spaceKey);
            TopicEntity topic   = topicService.Get(topicId);

            if (topic == null)
            {
                return(Content(string.Empty));
            }

            ManagementOperationService managementOperationService = new ManagementOperationService();

            ViewData["ApplicationManagementOperations"] = managementOperationService.GetShortcuts(PresentAreaKeysOfExtension.TopicSpace, false);

            NavigationService navigationService = new NavigationService();

            return(View(navigationService.GetRootNavigations(PresentAreaKeysOfExtension.TopicSpace, topic.TopicId)));
        }
        public ActionResult _Menu_App(string spaceKey)
        {
            long        groupId = GroupIdToGroupKeyDictionary.GetGroupId(spaceKey);
            GroupEntity group   = groupService.Get(groupId);

            if (group == null)
            {
                return(Content(string.Empty));
            }

            int currentNavigationId = RouteData.Values.Get <int>("CurrentNavigationId", 0);


            NavigationService navigationService = new NavigationService();
            Navigation        navigation        = navigationService.GetNavigation(PresentAreaKeysOfBuiltIn.GroupSpace, currentNavigationId, group.GroupId);

            IEnumerable <Navigation> navigations = new List <Navigation>();

            if (navigation != null)
            {
                if (navigation.Depth >= 1 && navigation.Parent != null)
                {
                    navigations = navigation.Parent.Children;
                }
                else if (navigation.Depth == 0)
                {
                    navigations = navigation.Children;
                }


                ManagementOperationService managementOperationService = new ManagementOperationService();
                IEnumerable <ApplicationManagementOperation> applicationManagementOperations = managementOperationService.GetShortcuts(PresentAreaKeysOfBuiltIn.GroupSpace, false);
                if (applicationManagementOperations != null)
                {
                    ViewData["ApplicationManagementOperations"] = applicationManagementOperations.Where(n => n.ApplicationId == navigation.ApplicationId);
                }
            }

            return(View(navigations));
        }
Exemple #4
0
        /// <summary>
        /// 转换为ApplicationManagementOperation用于数据库存储
        /// </summary>
        /// <returns></returns>
        public ApplicationManagementOperation AsApplicationManagementOperation()
        {
            ApplicationManagementOperation operation = null;
            ManagementOperationService     managementOperationService = new ManagementOperationService();

            if (managementOperationService.Get(this.OperationId) == null)
            {
                operation             = new ApplicationManagementOperation();
                operation.OperationId = this.OperationId;

                operation.DisplayOrder = this.OperationId;
            }
            else
            {
                operation = managementOperationService.Get(this.OperationId);
            }
            if (this.AssociatedNavigationId.HasValue)
            {
                operation.AssociatedNavigationId = this.AssociatedNavigationId.Value;
            }
            operation.ApplicationId  = this.ApplicationId;
            operation.PresentAreaKey = this.PresentAreaKey;

            operation.OperationType = this.OperationType;

            //使用资源项
            if (this.IsUseResourceItem)
            {
                operation.ResourceName  = this.ResourceName;
                operation.OperationText = string.Empty;
            }
            else
            {
                operation.OperationText = this.OperationText;
                operation.ResourceName  = string.Empty;
            }

            //使用路由
            if (this.IsUseRoute)
            {
                operation.UrlRouteName  = this.UrlRouteName ?? string.Empty;
                operation.NavigationUrl = string.Empty;
            }
            else
            {
                operation.NavigationUrl = this.NavigationUrl ?? string.Empty;
                operation.UrlRouteName  = string.Empty;
            }

            if (IconNameOption)
            {
                operation.IconName = this.IconName;
                operation.ImageUrl = null;
            }
            else
            {
                operation.IconName = null;
                if (this.IsWholeLink)
                {
                    operation.ImageUrl = this.ImageUrl;
                }
                else
                {
                    if (this.ImageName != null)
                    {
                        operation.ImageUrl = "~/Uploads/NavigationImage/" + this.ImageName;
                    }
                    else
                    {
                        operation.ImageUrl = null;
                    }
                }
            }

            operation.NavigationTarget = this.NavigationTarget;


            operation.OnlyOwnerVisible = this.OnlyOwnerVisible;
            operation.IsEnabled        = this.IsEnabled;

            operation.IsLocked = this.IsLocked;
            return(operation);
        }