Exemplo n.º 1
0
        protected string BuildPreviewLink(int skinId)
        {
            int storeId;

            if (!int.TryParse(StoreSelector.SelectedValue, out storeId))
            {
                return(string.Empty);
            }

            //If on the current store, we can figure out the URL regardless of virtual directories.  If previewing for another store, this will only work
            //without a virtual directory.
            if (storeId == AppLogic.StoreID())
            {
                return(AppLogic.ResolveUrl(string.Format("~/default.aspx?previewskinid={0}", skinId)));
            }
            else
            {
                //Figure out what 'type' of store we're on right now
                StoreUrlType currentType = Store.DetermineCurrentUrlType();

                //Get the matching type URL for the chosen store
                string chosenStoreUrl = Store.GetStoreUrlByType(currentType, storeId);

                if (!String.IsNullOrEmpty(chosenStoreUrl))
                {
                    string previewUrl = "http://{0}/default.aspx?previewskinid={1}";
                    return(string.Format(previewUrl, chosenStoreUrl, skinId));
                }
                else
                {
                    return(string.Empty);
                }
            }
        }
Exemplo n.º 2
0
        public static string GetStoreUrlByType(StoreUrlType urlType, int storeId)
        {
            Store store = GetStoreById(storeId);

            switch (urlType)
            {
            case StoreUrlType.Production:
                return(store.ProductionURI);

            case StoreUrlType.Development:
                return(store.DevelopmentURI);

            case StoreUrlType.Staging:
                return(store.StagingURI);
            }

            return(string.Empty);
        }