本文整理汇总了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/");
}
示例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/");
}
示例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/");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}