当前位置: 首页>>代码示例>>C#>>正文


C# IWebHelper.GetStoreLocation方法代码示例

本文整理汇总了C#中IWebHelper.GetStoreLocation方法的典型用法代码示例。如果您正苦于以下问题:C# IWebHelper.GetStoreLocation方法的具体用法?C# IWebHelper.GetStoreLocation怎么用?C# IWebHelper.GetStoreLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWebHelper的用法示例。


在下文中一共展示了IWebHelper.GetStoreLocation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_get_storeLocation_in_virtual_directory

 public void Can_get_storeLocation_in_virtual_directory()
 {
     var serverVariables = new NameValueCollection();
     serverVariables.Add("HTTP_HOST", "www.example.com");
     _httpContext = new FakeHttpContext("~/SmartStoreNETpath", "GET", null, null, null, null, null, serverVariables);
     _webHelper = new WebHelper(_httpContext);
     _webHelper.GetStoreLocation(false).ShouldEqual("http://www.example.com/smartstorenetpath/");
 }
开发者ID:boatengfrankenstein,项目名称:SmartStoreNET,代码行数:8,代码来源:WebHelperTests.cs

示例2: Get_storeLocation_should_return_lowerCased_result

 public void Get_storeLocation_should_return_lowerCased_result()
 {
     var serverVariables = new NameValueCollection();
     serverVariables.Add("HTTP_HOST", "www.Example.com");
     _httpContext = new FakeHttpContext("~/", "GET", null, null, null, null, null, serverVariables);
     _webHelper = new WebHelper(_httpContext);
     _webHelper.GetStoreLocation(false).ShouldEqual("http://www.example.com/");
 }
开发者ID:boatengfrankenstein,项目名称:SmartStoreNET,代码行数:8,代码来源:WebHelperTests.cs

示例3: Can_get_storeLocation_without_ssl

 public void Can_get_storeLocation_without_ssl()
 {
     var serverVariables = new NameValueCollection();
     serverVariables.Add("HTTP_HOST", "www.example.com");
     _httpContext = new FakeHttpContext("~/", "GET", null, null, null, null, null, serverVariables);
     _webHelper = new WebHelper(_httpContext);
     _webHelper.GetStoreLocation(false).ShouldEqual("http://www.example.com/");
 }
开发者ID:boatengfrankenstein,项目名称:SmartStoreNET,代码行数:8,代码来源:WebHelperTests.cs

示例4: GetLogoUrl

        /// <summary>
        /// Trả về đường dẫn file logo của plugin ( qui ước đó là file "logo.jpg" nằm trong thư mục gốc của plugin )
        /// </summary>
        public static string GetLogoUrl(this PluginDescriptor pluginDescriptor, IWebHelper webHelper)
        {
            if (pluginDescriptor == null) throw new ArgumentNullException("pluginDescriptor");
            if (webHelper == null) throw new ArgumentNullException("webHelper");
            if (pluginDescriptor.OriginalAssemblyFile == null || pluginDescriptor.OriginalAssemblyFile.Directory == null)
                return null;

            var pluginDirectory = pluginDescriptor.OriginalAssemblyFile.Directory;
            string logoLocalPath = Path.Combine(pluginDirectory.FullName, "logo.jpg");
            if(!File.Exists(logoLocalPath)) return null;

            return string.Format("{0}plugins/{1}/logo.jpg", webHelper.GetStoreLocation(), pluginDirectory.Name);
        }
开发者ID:sounj142,项目名称:NopResearch,代码行数:16,代码来源:PluginExtensions.cs

示例5: GenerateUrl

        /// <summary>
        /// Generate affilaite URL
        /// </summary>
        /// <param name="affiliate">Affiliate</param>
        /// <param name="webHelper">Web helper</param>
        /// <returns>Generated affilaite URL</returns>
        public static string GenerateUrl(this Affiliate affiliate, IWebHelper webHelper = null)
        {
            if (webHelper == null)
                webHelper = EngineContext.Current.Resolve<IWebHelper>();

            string storeUrl = webHelper.GetStoreLocation(false);
            if (!string.IsNullOrWhiteSpace(affiliate.FriendlyUrlName))
                storeUrl = webHelper.ModifyQueryString(storeUrl,
                    string.Format("{0}={1}", Affiliate.AFFILIATE_FRIENDLYURLNAME_QUERY_PARAMETER_NAME,
                        affiliate.FriendlyUrlName), null);
            else
                storeUrl = webHelper.ModifyQueryString(storeUrl,
                    string.Format("{0}={1}", Affiliate.AFFILIATE_ID_QUERY_PARAMETER_NAME, affiliate.Id), null);
            return storeUrl;
        }
开发者ID:sounj142,项目名称:aaabbb,代码行数:21,代码来源:AffiliateExtensions.cs

示例6: GenerateUrl

        /// <summary>
        /// Generate affilaite URL
        /// </summary>
        /// <param name="affiliate">Affiliate</param>
        /// <param name="webHelper">Web helper</param>
        /// <returns>Generated affilaite URL</returns>
        public static string GenerateUrl(this Affiliate affiliate, IWebHelper webHelper)
        {
            if (affiliate == null)
                throw new ArgumentNullException("affiliate");

            if (webHelper == null)
                throw new ArgumentNullException("webHelper");

            var storeUrl = webHelper.GetStoreLocation(false);
            var url = !String.IsNullOrEmpty(affiliate.FriendlyUrlName) ?
                //use friendly URL
                webHelper.ModifyQueryString(storeUrl, "affiliate=" + affiliate.FriendlyUrlName, null):
                //use ID
                webHelper.ModifyQueryString(storeUrl, "affiliateid=" + affiliate.Id, null);

            return url;
        }
开发者ID:shuangyu1937,项目名称:nopCommerce,代码行数:23,代码来源:AffiliateExtensions.cs

示例7: GetLogoUrl

        public static string GetLogoUrl(this PluginDescriptor pluginDescriptor, IWebHelper webHelper)
        {
            if (pluginDescriptor == null)
                throw new ArgumentNullException("pluginDescriptor");

            if (webHelper == null)
                throw new ArgumentNullException("webHelper");

            if (pluginDescriptor.OriginalAssemblyFile == null || pluginDescriptor.OriginalAssemblyFile.Directory == null)
            {
                return null;
            }

            var pluginDirectory = pluginDescriptor.OriginalAssemblyFile.Directory;

           var logoExtension = SupportedLogoImageExtensions.FirstOrDefault(ext => File.Exists(Path.Combine(pluginDirectory.FullName, "logo." + ext)));

            if (string.IsNullOrWhiteSpace(logoExtension)) return null; //No logo file was found with any of the supported extensions.

            string logoUrl = string.Format("{0}plugins/{1}/logo.{2}", webHelper.GetStoreLocation(), pluginDirectory.Name, logoExtension);
            return logoUrl;
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:22,代码来源:PluginExtensions.cs


注:本文中的IWebHelper.GetStoreLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。