/// <summary>
        /// 获取导航Url
        /// </summary>
        /// <param name="presentAreaNavigation">被扩展的navigation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据集合</param>
        /// <returns></returns>
        public static string GetUrl(this PresentAreaNavigation presentAreaNavigation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            if (presentAreaNavigation.NavigationUrl != null && !string.IsNullOrEmpty(presentAreaNavigation.NavigationUrl.Trim()))
            {
                return(presentAreaNavigation.NavigationUrl);
            }

            RouteValueDictionary routeDatas = null;

            if (!string.IsNullOrEmpty(presentAreaNavigation.RouteDataName) && routeValueDictionary != null)
            {
                string[] routeNames = presentAreaNavigation.RouteDataName.Split(',');
                routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));

                if (!routeNames.Contains("userName") && !routeNames.Contains("spaceKey"))
                {
                    routeDatas.AddOrReplace("sapceKey", spaceKey);
                }

                return(CachedUrlHelper.RouteUrl(presentAreaNavigation.UrlRouteName, routeDatas));
            }

            routeDatas = new RouteValueDictionary()
            {
                { "spaceKey", spaceKey }
            };

            return(CachedUrlHelper.RouteUrl(presentAreaNavigation.UrlRouteName, routeDatas));
        }
예제 #2
0
        /// <summary>
        /// 获取导航Url
        /// </summary>
        /// <param name="presentAreaNavigation">被扩展的navigation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据集合</param>
        /// <returns></returns>
        public static string GetUrl(this PresentAreaNavigation presentAreaNavigation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            RouteValueDictionary routeDatas = null;
            if (!string.IsNullOrEmpty(presentAreaNavigation.UrlRouteName))
            {
                if (!string.IsNullOrEmpty(presentAreaNavigation.RouteDataName) && routeValueDictionary != null)
                {
                    string[] routeNames = presentAreaNavigation.RouteDataName.Split(',');
                    routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));

                    if (!routeNames.Contains("userName") && !routeNames.Contains("spaceKey"))
                    {
                        routeDatas.AddOrReplace("sapceKey", spaceKey);
                    }
                }
                else
                    routeDatas = new RouteValueDictionary() { { "spaceKey", spaceKey } };
                return CachedUrlHelper.RouteUrl(presentAreaNavigation.UrlRouteName, routeDatas);
            }

            if (presentAreaNavigation.NavigationUrl != null && !string.IsNullOrEmpty(presentAreaNavigation.NavigationUrl.Trim()))
            {
                return presentAreaNavigation.NavigationUrl;
            }
            return string.Empty;
        }
예제 #3
0
        /// <summary>
        /// 获取导航Url
        /// </summary>
        /// <param name="navigation">被扩展的navigation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据集合</param>
        /// <returns></returns>
        public static string GetUrl(this Navigation navigation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            if (!string.IsNullOrEmpty(navigation.UrlRouteName))
            {
                RouteValueDictionary routeDatas = null;
                if (!string.IsNullOrEmpty(navigation.RouteDataName) && routeValueDictionary != null)
                {
                    string[] routeNames = navigation.RouteDataName.Split(',');
                    routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));
                    routeDatas.AddOrReplace("spaceKey", spaceKey);
                }
                else
                {
                    routeDatas = new RouteValueDictionary()
                    {
                        { "spaceKey", spaceKey }
                    }
                };

                return(CachedUrlHelper.RouteUrl(navigation.UrlRouteName, routeDatas));
            }
            if (navigation.NavigationUrl != null && !string.IsNullOrEmpty(navigation.NavigationUrl.Trim()))
            {
                return(navigation.NavigationUrl);
            }
            return(string.Empty);
        }
 public static RouteValueDictionary CreateFromRequestContext(RequestContext requestContext)
 {
     RouteValueDictionary routeValues = new RouteValueDictionary(requestContext.RouteData.Values);
     foreach (string key in requestContext.HttpContext.Request.QueryString.AllKeys)
     {
         routeValues.AddOrReplace(key, requestContext.HttpContext.Request.QueryString[key]);
     }
     return routeValues;
 }
        /// <summary>
        /// 获取快捷操作Url
        /// </summary>
        /// <param name="applicationManagementOperation">被扩展的applicationManagementOperation</param>
        /// <param name="spaceKey">空间标识</param>
        /// <param name="routeValueDictionary">路由数据字典</param>
        /// <returns></returns>
        public static string GetUrl(this ApplicationManagementOperation applicationManagementOperation, string spaceKey, RouteValueDictionary routeValueDictionary = null)
        {
            if (applicationManagementOperation.NavigationUrl != null && !string.IsNullOrEmpty(applicationManagementOperation.NavigationUrl.Trim()))
            {
                return applicationManagementOperation.NavigationUrl;
            }

            RouteValueDictionary routeDatas = null;
            if (!string.IsNullOrEmpty(applicationManagementOperation.RouteDataName) && routeValueDictionary != null)
            {
                string[] routeNames = applicationManagementOperation.RouteDataName.Split(',');
                routeDatas = new RouteValueDictionary(routeValueDictionary.Where(n => routeNames.Contains(n.Key)).ToDictionary(n => n.Key, n => n.Value));
                routeDatas.AddOrReplace("sapceKey", spaceKey);
                return CachedUrlHelper.RouteUrl(applicationManagementOperation.UrlRouteName, routeDatas);
            }

            RouteValueDictionary routeValues = new RouteValueDictionary() { { "spaceKey", spaceKey } };

            return CachedUrlHelper.RouteUrl(applicationManagementOperation.UrlRouteName, routeValues);
        }