public static string RouteHccUrl(HccRoute route, object routeValues, string protocol)
        {
            var requestContext = Factory.HttpContext != null ? Factory.HttpContext.Request.RequestContext : null;

            return(RouteHccUrl(route, null, null, protocol, null, null, new RouteValueDictionary(routeValues),
                               RouteTable.Routes, requestContext, false));
        }
예제 #2
0
 public string RouteHccUrl(HccRoute route, string actionName, string controllerName, string protocol,
                           string hostName, string fragment, RouteValueDictionary routeValues, RouteCollection routeCollection,
                           RequestContext requestContext, bool includeImplicitMvcValues)
 {
     return(GenerateUrl(route, null, null, protocol, null, null, routeValues, routeCollection, requestContext,
                        false));
 }
        public static string RouteHccUrl(HccRoute route, RouteValueDictionary routeValues, string protocol,
                                         string hostName)
        {
            var requestContext = Factory.HttpContext != null ? Factory.HttpContext.Request.RequestContext : null;

            return(RouteHccUrl(route, null, null, protocol, hostName, null, routeValues, RouteTable.Routes,
                               requestContext, false));
        }
예제 #4
0
        private string GetRouteName(HccRoute route)
        {
            string routeName = null;

            switch (route)
            {
            case HccRoute.Product:
            case HccRoute.Category:
                routeName = HccRouteNames.Custom;
                break;

            case HccRoute.Cart:
                routeName = HccRouteNames.Cart;
                break;

            case HccRoute.ProductReview:
                routeName = HccRouteNames.ProductReview;
                break;

            case HccRoute.Checkout:
                routeName = HccRouteNames.Checkout;
                break;

            case HccRoute.CheckoutPayPal:
                routeName = HccRouteNames.CheckoutPayPal;
                break;

            case HccRoute.WishList:
                routeName = HccRouteNames.WishList;
                break;

            case HccRoute.Search:
                routeName = HccRouteNames.Search;
                break;

            case HccRoute.OrderHistory:
            case HccRoute.AddressBook:
                routeName = HccRouteNames.AccountDefault;
                break;

            case HccRoute.Login:
                routeName = HccRouteNames.Login;
                break;

            case HccRoute.Logoff:
                routeName = HccRouteNames.Logoff;
                break;

            case HccRoute.SendPassword:
                routeName = HccRouteNames.SendPassword;
                break;

            case HccRoute.Terms:
                routeName = HccRouteNames.Terms;
                break;
            }
            return(routeName);
        }
        private static string RouteHccUrl(HccRoute route, string actionName, string controllerName, string protocol,
                                          string hostName, string fragment, RouteValueDictionary routeValues, RouteCollection routeCollection,
                                          RequestContext requestContext, bool includeImplicitMvcValues)
        {
            var urlResolver = Factory.CreateHccUrlResolver();

            return(urlResolver.RouteHccUrl(route, null, null, protocol, null, null, routeValues, routeCollection,
                                           requestContext, false));
        }
예제 #6
0
        public static MvcForm BeginHccRouteForm(this HtmlHelper htmlHelper, HccRoute route,
                                                RouteValueDictionary routeValues, FormMethod method, IDictionary <string, object> htmlAttributes)
        {
            var urlResolver = Factory.CreateHccUrlResolver();
            var url         = urlResolver.RouteHccUrl(route, null, null, null, null, null, routeValues,
                                                      htmlHelper.RouteCollection, htmlHelper.ViewContext.RequestContext, false);
            var formRenderer = Factory.CreateHccFormRenderer();

            return(formRenderer.FormHelper(htmlHelper, url, method, htmlAttributes));
        }
예제 #7
0
        public string RouteHccUrl(HccRoute route, string actionName, string controllerName, string protocol,
                                  string hostName, string fragment, RouteValueDictionary routeValues, RouteCollection routeCollection,
                                  RequestContext requestContext, bool includeImplicitMvcValues)
        {
            var routeName = GetRouteName(route);

            if (string.IsNullOrEmpty(hostName))
            {
                hostName = GetHostName();
            }
            return(UrlHelper.GenerateUrl(routeName, null, null, protocol, hostName, null, routeValues, routeCollection,
                                         requestContext, false));
        }
 public static string RouteHccUrl(this UrlHelper urlHelper, HccRoute route, object routeValues, string protocol)
 {
     return(RouteHccUrl(route, null, null, protocol, null, null, new RouteValueDictionary(routeValues),
                        urlHelper.RouteCollection, urlHelper.RequestContext, false));
 }
 public static string RouteHccUrl(this UrlHelper urlHelper, HccRoute route, RouteValueDictionary routeValues)
 {
     return(urlHelper.RouteHccUrl(route, routeValues, null, null));
 }
 public static string RouteHccUrl(this UrlHelper urlHelper, HccRoute route, object routeValues)
 {
     return(urlHelper.RouteHccUrl(route, routeValues, null));
 }
 public static string RouteHccUrl(this UrlHelper urlHelper, HccRoute route)
 {
     return(urlHelper.RouteHccUrl(route, null));
 }
예제 #12
0
        private string GenerateUrl(HccRoute route, string actionName, string controllerName, string protocol,
                                   string hostName, string fragment, RouteValueDictionary routeValues, RouteCollection routeCollection,
                                   RequestContext requestContext, bool includeImplicitMvcValues)
        {
            // Code that search DNN module corresponding to concrete route have to be here
            // Route params have to be added to the url too.

            var urlInfo = new DnnUrlInfo();

            if (route == HccRoute.Login)
            {
                return(Globals.LoginURL((string)routeValues["returnUrl"], false));
            }
            if (route == HccRoute.Terms)
            {
                return(Globals.NavigateURL("Terms"));
            }
            if (route == HccRoute.Logoff)
            {
                return(Globals.NavigateURL("LogOff"));
            }
            if (route == HccRoute.SendPassword)
            {
                return(Globals.NavigateURL("SendPassword"));
            }
            if (route == HccRoute.UserProfile)
            {
                var userId = 0;
                if (int.TryParse((string)routeValues["userId"], out userId))
                {
                    return(Globals.UserProfileURL(userId));
                }
                throw new ApplicationException("UserId is not a number");
            }
            urlInfo = GetTabId(route);

            var paramsList = new List <string>();

            if (!string.IsNullOrEmpty(urlInfo.ControlKey))
            {
                var moduleCtl = new ModuleController();
                var mInfo     = moduleCtl.GetTabModules(urlInfo.TabId)
                                .Where(m => m.Value.DesktopModule.ModuleName == urlInfo.ModuleName)
                                .Select(m => m.Value)
                                .FirstOrDefault();

                if (mInfo != null)
                {
                    paramsList.Add("mid=" + mInfo.ModuleID);
                }
            }

            if (routeValues != null)
            {
                foreach (var newQueryItem in routeValues)
                {
                    var isParamValid = newQueryItem.Value != null;
                    if (newQueryItem.Value is string)
                    {
                        isParamValid = !string.IsNullOrWhiteSpace(newQueryItem.Value as string);
                    }

                    if (isParamValid)
                    {
                        var parameter = string.Format("{0}={1}", newQueryItem.Key, newQueryItem.Value);
                        paramsList.Add(parameter);
                    }
                }
            }

            var portalSettings = CurrentPortalSettings;
            var isSuperTab     = Globals.IsHostTab(urlInfo.TabId);
            var parameters     = paramsList.ToArray();

            var navigateUrl = string.Empty;

            if (PortalSettings.Current != null)
            {
                navigateUrl = Globals.NavigateURL(urlInfo.TabId, isSuperTab, portalSettings, urlInfo.ControlKey, null,
                                                  parameters);
            }
            else
            {
                navigateUrl = NavigateUrl(urlInfo.TabId, isSuperTab, portalSettings, urlInfo.ControlKey, parameters);
            }
            return(navigateUrl);
        }
예제 #13
0
 public static string RouteHccUrl(HccRoute route, object routeValues)
 {
     return(RouteHccUrl(route, routeValues, null));
 }
예제 #14
0
 public static string RouteHccUrl(HccRoute route, RouteValueDictionary routeValues)
 {
     return(RouteHccUrl(route, routeValues, null, null));
 }
예제 #15
0
 public static MvcForm BeginHccRouteForm(this HtmlHelper htmlHelper, HccRoute route, object routeValues)
 {
     return(htmlHelper.BeginHccRouteForm(route, new RouteValueDictionary(routeValues), FormMethod.Post,
                                         new RouteValueDictionary()));
 }
 public static string RouteHccUrl(this UrlHelper urlHelper, HccRoute route, RouteValueDictionary routeValues,
                                  string protocol, string hostName)
 {
     return(RouteHccUrl(route, null, null, protocol, hostName, null, routeValues, urlHelper.RouteCollection,
                        urlHelper.RequestContext, false));
 }
예제 #17
0
 public static MvcForm BeginHccRouteForm(this HtmlHelper htmlHelper, HccRoute route, object routeValues,
                                         FormMethod method, object htmlAttributes)
 {
     return(htmlHelper.BeginHccRouteForm(route, new RouteValueDictionary(routeValues), method,
                                         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)));
 }
예제 #18
0
 public static MvcForm BeginHccRouteForm(this HtmlHelper htmlHelper, HccRoute route,
                                         RouteValueDictionary routeValues, FormMethod method)
 {
     return(htmlHelper.BeginHccRouteForm(route, routeValues, method, new RouteValueDictionary()));
 }
예제 #19
0
 public static MvcForm BeginHccRouteForm(this HtmlHelper htmlHelper, HccRoute route, FormMethod method,
                                         IDictionary <string, object> htmlAttributes)
 {
     return(htmlHelper.BeginHccRouteForm(route, new RouteValueDictionary(), method, htmlAttributes));
 }
예제 #20
0
 public static string RouteHccUrl(HccRoute route)
 {
     return(RouteHccUrl(route, null));
 }
예제 #21
0
        private DnnUrlInfo GetTabId(HccRoute route)
        {
            StoreSettingsUrls urlStoreSettings = null;

            if (HccRequestContext.Current.CurrentStore != null)
            {
                urlStoreSettings = HccRequestContext.Current.CurrentStore.Settings.Urls;
            }

            var urlInfo = new DnnUrlInfo();

            switch (route)
            {
            case HccRoute.Cart:
                urlInfo.TabId = urlStoreSettings.CartTabId;
                break;

            case HccRoute.Product:
                urlInfo.TabId = urlStoreSettings.ProductTabId;
                break;

            case HccRoute.ProductReview:
                urlInfo.TabId = urlStoreSettings.ProductReviewTabId;
                break;

            case HccRoute.Category:
                urlInfo.TabId = urlStoreSettings.CategoryTabId;
                break;

            case HccRoute.Checkout:
                urlInfo.TabId = urlStoreSettings.CheckoutTabId;
                break;

            case HccRoute.CheckoutPayPal:
                urlInfo.TabId      = urlStoreSettings.CheckoutTabId;
                urlInfo.ControlKey = "PayPalCheckout";
                urlInfo.ModuleName = "Hotcakes.Checkout";
                break;

            case HccRoute.ThirdPartyPayment:
                urlInfo.TabId      = urlStoreSettings.CheckoutTabId;
                urlInfo.ControlKey = "ThirdPartyPayment";
                urlInfo.ModuleName = "Hotcakes.Checkout";
                break;

            case HccRoute.WishList:
                urlInfo.TabId = urlStoreSettings.WishListTabId;
                break;

            case HccRoute.Search:
                urlInfo.TabId = urlStoreSettings.SearchTabId;
                break;

            case HccRoute.OrderHistory:
                urlInfo.TabId = urlStoreSettings.OrderHistoryTabId;
                break;

            case HccRoute.AddressBook:
                urlInfo.TabId = urlStoreSettings.AddressBookTabId;
                break;

            case HccRoute.EditUserProfile:
                urlInfo.TabId      = CurrentPortalSettings.UserTabId;
                urlInfo.ControlKey = "Profile";
                break;

            case HccRoute.AffiliateRegistration:
                urlInfo.TabId = GetTabIdByModuleName("Hotcakes.AffiliateRegistration");
                break;

            case HccRoute.AffiliateDashboard:
                urlInfo.TabId = GetTabIdByModuleName("Hotcakes.AffiliateDashboard");
                break;

            case HccRoute.Home:
                urlInfo.TabId = CurrentPortalSettings.HomeTabId;
                break;

            default:
                throw new NotImplementedException();
            }
            return(urlInfo);
        }