本文整理汇总了C#中MerchantTribeApplication.StoreUrl方法的典型用法代码示例。如果您正苦于以下问题:C# MerchantTribeApplication.StoreUrl方法的具体用法?C# MerchantTribeApplication.StoreUrl怎么用?C# MerchantTribeApplication.StoreUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MerchantTribeApplication
的用法示例。
在下文中一共展示了MerchantTribeApplication.StoreUrl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HeaderLinks
public static string HeaderLinks(MerchantTribeApplication app, string currentUserId)
{
StringBuilder sb = new StringBuilder();
string rootUrl = app.StoreUrl(false, true);
string rootUrlSecure = app.StoreUrl(true, false);
sb.Append("<ul>");
sb.Append("<li><a class=\"myaccountlink\" href=\"" + rootUrlSecure + "account\"><span>");
sb.Append("My Account");
sb.Append("</span></a></li>");
sb.Append("<li><a class=\"signinlink\"");
if (currentUserId == string.Empty)
{
sb.Append(" href=\"" + rootUrlSecure + "SignIn\"><span>");
sb.Append("Sign In");
}
else
{
string name = string.Empty;
MerchantTribe.Commerce.Membership.CustomerAccount a = app.MembershipServices.Customers.Find(currentUserId);
if (a != null)
{
name = a.Email;
}
sb.Append(" href=\"" + rootUrlSecure + "SignOut\" title=\"" + System.Web.HttpUtility.HtmlEncode(name) + "\"><span>");
sb.Append("Sign Out");
}
sb.Append("</span></a></li>");
//sb.Append("<li><a class=\"orderstatuslink\" href=\"" + rootUrlSecure + "OrderStatus\"><span>");
//sb.Append("Order Status");
//sb.Append("</span></a></li>");
//sb.Append("<li><a class=\"emailsignuplink\" href=\"" + rootUrl + "EmailSignUp\"><span>");
//sb.Append("Email Sign Up");
//sb.Append("</span></a></li>");
//sb.Append("<li><a class=\"giftcardslink\" href=\"" + rootUrl + "GiftCards\"><span>");
//sb.Append("Gift Cards");
//sb.Append("</span></a></li>");
//sb.Append("<li><a class=\"contactlink\" href=\"" + rootUrl + "Contact\"><span>");
//sb.Append("Contact Us");
//sb.Append("</span></a></li>");
sb.Append("<li><a class=\"contactlink\" href=\"" + rootUrl + "Checkout\"><span>");
sb.Append("Checkout");
sb.Append("</span></a></li>");
sb.Append("</ul>");
return sb.ToString();
}
示例2: Logo
public static string Logo(MerchantTribeApplication app, bool isSecureRequest)
{
string storeRootUrl = app.StoreUrl(isSecureRequest, false);
string storeName = app.CurrentStore.Settings.FriendlyName;
string logoImage = app.CurrentStore.Settings.LogoImageFullUrl(app, isSecureRequest);
string logoText = app.CurrentStore.Settings.LogoText;
StringBuilder sb = new StringBuilder();
sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\"");
if (app.CurrentStore.Settings.UseLogoImage)
{
sb.Append("><img src=\"" + logoImage + "\" alt=\"" + storeName + "\" />");
}
else
{
sb.Append(" class=\"logo\">");
sb.Append(System.Web.HttpUtility.HtmlEncode(logoText));
}
sb.Append("</a>");
return sb.ToString();
}
示例3: Process
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents)
{
string fileUrl = string.Empty;
bool secure = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection;
ThemeManager tm = app.ThemeManager();
string mode = tag.GetSafeAttribute("mode");
if (mode == "legacy")
{
fileUrl = tm.CurrentStyleSheet(app, secure);
}
else if (mode == "system")
{
string cssFile = tag.GetSafeAttribute("file");
fileUrl = app.StoreUrl(secure, false) + cssFile.TrimStart('/');
}
else
{
string fileName = tag.GetSafeAttribute("file");
fileUrl = tm.ThemeFileUrl(fileName, app);
}
string result = string.Empty;
result = "<link href=\"" + fileUrl + "\" rel=\"stylesheet\" type=\"text/css\" />";
return result;
}
示例4: ReplaceContentTags
public static string ReplaceContentTags(string source, MerchantTribeApplication app, string itemCount, bool isSecureRequest)
{
Accounts.Store currentStore = app.CurrentStore;
string currentUserId = SessionManager.GetCurrentUserId(app.CurrentStore);
string output = source;
RouteCollection r = System.Web.Routing.RouteTable.Routes;
//VirtualPathData homeLink = r.GetVirtualPath(requestContext.RoutingContext, "homepage", new RouteValueDictionary());
output = output.Replace("{{homelink}}", app.StoreUrl(isSecureRequest, false));
output = output.Replace("{{logo}}", HtmlRendering.Logo(app, isSecureRequest));
output = output.Replace("{{logotext}}", HtmlRendering.LogoText(app));
output = output.Replace("{{headermenu}}", HtmlRendering.HeaderMenu(app.CurrentRequestContext.RoutingContext, app.CurrentRequestContext));
output = output.Replace("{{cartlink}}", HtmlRendering.CartLink(app, itemCount));
output = output.Replace("{{copyright}}", "<span class=\"copyright\">Copyright ©" + DateTime.Now.Year.ToString() + "</span>");
output = output.Replace("{{headerlinks}}", HtmlRendering.HeaderLinks(app, currentUserId));
output = output.Replace("{{searchform}}", HtmlRendering.SearchForm(app));
output = output.Replace("{{assets}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForStoreTheme(app, currentStore.Settings.ThemeId, isSecureRequest) + "assets/");
output = output.Replace("{{img}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest));
output = output.Replace("{{storeassets}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest));
output = output.Replace("{{sitefiles}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForSingleStore(app, isSecureRequest));
output = output.Replace("{{storeaddress}}", app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString());
return output;
}
示例5: RedirectToMainStoreUrl
public static void RedirectToMainStoreUrl(long storeId, System.Uri requestedUrl, MerchantTribeApplication app)
{
Accounts.Store store = app.AccountServices.Stores.FindById(storeId);
if (store == null) return;
app.CurrentStore = store;
string host = requestedUrl.Authority;
string relativeRoot = "http://" + host;
bool secure = false;
if (requestedUrl.ToString().ToLowerInvariant().StartsWith("https://")) secure = true;
string destination = app.StoreUrl(secure, false);
string pathAndQuery = requestedUrl.PathAndQuery;
// Trim starting slash because root URL already has this
pathAndQuery = pathAndQuery.TrimStart('/');
destination = System.IO.Path.Combine(destination, pathAndQuery);
// 301 redirect to main url
if (System.Web.HttpContext.Current != null)
{
System.Web.HttpContext.Current.Response.RedirectPermanent(destination);
}
}
示例6: CartLink
public static string CartLink(MerchantTribeApplication app, string itemCount)
{
string storeRootUrl = app.StoreUrl(false, true);
StringBuilder sb = new StringBuilder();
sb.Append("<a href=\"" + storeRootUrl + "cart/\"><span>View Cart: ");
sb.Append(itemCount);
sb.Append(" items</span></a>");
return sb.ToString();
}
示例7: Process
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents)
{
StringBuilder sb = new StringBuilder();
string rootUrl = app.StoreUrl(false, true);
string buttonUrl = app.ThemeManager().ButtonUrl("Go", app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);
sb.Append("<form class=\"searchform\" action=\"" + rootUrl + "search\" method=\"get\">");
sb.Append("<input type=\"text\" name=\"q\" class=\"searchinput\" /> <input class=\"searchgo\" type=\"image\" src=\"" + buttonUrl + "\" alt=\"Search\" />");
sb.Append("</form>");
return sb.ToString();
}
示例8: LogoText
public static string LogoText(MerchantTribeApplication app)
{
string storeRootUrl = app.StoreUrl(false, true);
string storeName = app.CurrentStore.Settings.FriendlyName;
string logoText = app.CurrentStore.Settings.LogoText;
StringBuilder sb = new StringBuilder();
sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\"");
sb.Append(" class=\"logo\">");
sb.Append(System.Web.HttpUtility.HtmlEncode(logoText));
sb.Append("</a>");
return sb.ToString();
}
示例9: ReplaceContentTags
public static string ReplaceContentTags(string source, MerchantTribeApplication app, string itemCount)
{
var profiler = MiniProfiler.Current;
using (profiler.Step("Tag Replacer"))
{
if (source.Contains("{{"))
{
bool isSecureRequest = app.IsCurrentRequestSecure();
Accounts.Store currentStore = app.CurrentStore;
string currentUserId = app.CurrentCustomerId;
string output = source;
RouteCollection r = System.Web.Routing.RouteTable.Routes;
output = output.Replace("{{homelink}}", app.StoreUrl(isSecureRequest, false));
output = output.Replace("{{logo}}", HtmlRendering.Logo(app, isSecureRequest));
output = output.Replace("{{logotext}}", HtmlRendering.LogoText(app));
output = output.Replace("{{headermenu}}", HtmlRendering.HeaderMenu(app));
output = output.Replace("{{cartlink}}", HtmlRendering.CartLink(app, itemCount));
output = output.Replace("{{copyright}}", "<span class=\"copyright\">Copyright ©" + DateTime.Now.Year.ToString() + "</span>");
output = output.Replace("{{headerlinks}}", HtmlRendering.HeaderLinks(app, currentUserId));
output = output.Replace("{{searchform}}", HtmlRendering.SearchForm(app));
output = output.Replace("{{assets}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForStoreTheme(app, currentStore.Settings.ThemeId, isSecureRequest) + "assets/");
output = output.Replace("{{img}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest));
output = output.Replace("{{storeassets}}", MerchantTribe.Commerce.Storage.DiskStorage.StoreAssetUrl(app, string.Empty, isSecureRequest));
output = output.Replace("{{sitefiles}}", MerchantTribe.Commerce.Storage.DiskStorage.BaseUrlForSingleStore(app, isSecureRequest));
output = output.Replace("{{storeaddress}}", app.ContactServices.Addresses.FindStoreContactAddress().ToHtmlString());
return output;
}
else
{
return source;
}
}
}
示例10: StandardFooter
public static string StandardFooter(MerchantTribeApplication app)
{
return "{{copyright}} | <a href=\""
+ app.StoreUrl(false, true)
+ "SiteMap\"><span>SiteMap</span></a> ";
}
示例11: FullCss
public string FullCss(MerchantTribeApplication app, bool isSecure)
{
string defaultCss = "/content/themes/theme-" + DefaultThemeGuid + "/styles.css";
if (MTApp.CurrentStore == null) return defaultCss;
string result = app.StoreUrl(isSecure, false);
result += "css/theme-" + MTApp.CurrentStore.Settings.ThemeId + "/styles.css";
return result;
}
示例12: SSLRedirect
public static void SSLRedirect(MerchantTribeApplication app, Accounts.Store currentStore, SSLRedirectTo RedirectTo)
{
string CurrentUrl = app.CurrentRequestContext.RoutingContext.HttpContext.Request.RawUrl.ToLower(); //UrlRewriter.GetRewrittenUrlFromRequest(page.Request).ToLower();
string StandardURL = app.StoreUrl(false, true).ToLowerInvariant();
string SecureURL = app.StoreUrl(true, false).ToLowerInvariant();
string sessionId = WebAppSettings.SessionId;
string cartId = WebAppSettings.CartId;
string currentSessionId = SessionManager.GetCurrentUserId(currentStore);
string currentCartId = SessionManager.GetCurrentCartID(currentStore);
string url = BuildUrlForRedirect(CurrentUrl, StandardURL, SecureURL, RedirectTo, sessionId, cartId, currentSessionId, currentCartId, false
);
//if the urls match, then for some reason we aren't replacing anything
//so if we redirect then we will go into a loop
if (url != CurrentUrl) {
app.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect(url);
}
}
示例13: BuildEditor
private string BuildEditor(Catalog.Category containerCategory, string message, MerchantTribeApplication app){
MerchantTribe.Commerce.RequestContext context = app.CurrentRequestContext;
long versionId = containerCategory.GetCurrentVersion().Id;
ImageDisplayFile img = new ImageDisplayFile();
if (this.Images.Count > 0) img = this.Images[0];
string previewUrl = "";
string alt = string.Empty;
previewUrl = System.Web.VirtualPathUtility.ToAbsolute("~/images/system/flexedit/imagePlaceholder.png");
if (this.Images.Count > 0)
{
alt = this.Images[0].AltText;
if (this.Images[0].FileName.Trim().Length > 0)
{
previewUrl = Storage.DiskStorage.FlexPageImageUrl(app, containerCategory.Bvin, versionId.ToString(), img.FileName, false);
}
}
StringBuilder sb = new StringBuilder();
sb.Append("<div class=\"flexeditarea\">");
sb.Append("<div id=\"uploadimagemessage\">" + message + "</div>");
sb.Append("<table width=\"100%\">");
sb.Append("<tr><td class=\"formlabel\">Image:</td><td class=\"formfield\">");
sb.Append("<img width=\"200px\" height=\"200px\" src=\"" + previewUrl + "\" id=\"uploadimagepreview\" name=\"uploadimagepreview\" /><br />");
sb.Append("<div id=\"silverlightControlHost\">");
sb.Append("<object data=\"data:application/x-silverlight-2,\" type=\"application/x-silverlight-2\" width=\"100\" height=\"55\">");
string SilverLightUrl = System.Web.VirtualPathUtility.ToAbsolute("~/ClientBin/BVSoftware.SilverlightFileUpload.xap");
sb.Append("<param name=\"source\" value=\""+ SilverLightUrl + "\"/>");
sb.Append("<param name=\"background\" value=\"black\" />");
sb.Append("<param name=\"onError\" value=\"onSilverlightError\" />");
sb.Append("<param name=\"minRuntimeVersion\" value=\"4.0.50826.0\" />");
sb.Append("<param name=\"autoUpgrade\" value=\"true\" />");
sb.Append("<param name=\"initParams\" value=\"scriptname=ImageWasUploaded,uploadurl=");
// We have to pull the host out because the ToAbsolute of the virutal path utility
// will append sub folder name if the web site is not the root app in IIS
string currentFullRoot = app.StoreUrl(false, false);
Uri fullUri = new Uri(currentFullRoot);
string host = fullUri.DnsSafeHost;
sb.Append("http://" + host);
sb.Append(System.Web.VirtualPathUtility.ToAbsolute("~/fileuploadhandler/1/" + containerCategory.Bvin + "/" + versionId.ToString()));
sb.Append("\"/>");
sb.Append("<a href=\"http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0\" style=\"text-decoration:none\">");
sb.Append("<img src=\"http://go.microsoft.com/fwlink/?LinkId=161376\" alt=\"Get Microsoft Silverlight\" style=\"border-style:none\"/>");
sb.Append("</a>");
sb.Append("</object><iframe id=\"_sl_historyFrame\" style=\"visibility:hidden;height:0px;width:0px;border:0px\"></iframe>");
sb.Append("</div>");
sb.Append("</td></tr>");
sb.Append("<tr><td class=\"formlabel\">Alt. Text:</td><td class=\"formfield\">");
sb.Append("<input type=\"text\" id=\"altfield\" name=\"altfield\" value=\"" + System.Web.HttpUtility.HtmlEncode(alt) + "\" />");
sb.Append("</td></tr>");
sb.Append("</table>");
sb.Append("</div>");
sb.Append("<div class=\"flexeditbuttonarea\">");
sb.Append("<input type=\"hidden\" name=\"uploadedfilename\" id=\"uploadedfilename\" value=\"\" />");
sb.Append("<input type=\"hidden\" name=\"partaction\" class=\"editactionhidden\" value=\"saveedit\" />");
sb.Append("<input type=\"submit\" name=\"canceleditbutton\" value=\"Close\">");
sb.Append("<input type=\"submit\" name=\"savechanges\" value=\"Save Changes\">");
sb.Append("</div>");
return sb.ToString();
}
示例14: BaseUrl
internal static string BaseUrl(MerchantTribeApplication app, bool isSecure)
{
string u = app.StoreUrl(isSecure, false);
return u;
}