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


C# MerchantTribeApplication类代码示例

本文整理汇总了C#中MerchantTribeApplication的典型用法代码示例。如果您正苦于以下问题:C# MerchantTribeApplication类的具体用法?C# MerchantTribeApplication怎么用?C# MerchantTribeApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TemplateProcessor

 public TemplateProcessor(MerchantTribeApplication app, string template)
 {
     this.Handlers = new Dictionary<string, ITagHandler>();
     InitializeTagHandlers();
     this.MTApp = app;
     this.Template = template;
 }
开发者ID:tony722,项目名称:MerchantTribe,代码行数:7,代码来源:TemplateProcessor.cs

示例2: FriendlyDescription

 public override string FriendlyDescription(MerchantTribeApplication app)
 {
     string result = "";
     
     switch(HasMode)
     {
         case QualificationHasMode.HasAtLeast:
             result += "When order has AT LEAST ";
             break;
     }
     result += this.Quantity.ToString();
     switch(SetMode)
     {
         case QualificationSetMode.AllOfTheseItems:
             result += " of ALL of these products";
             break;
         case QualificationSetMode.AnyOfTheseItems:
             result += " of ANY of these products";
             break;
     }
     result += ":<ul>";
     
     foreach (string bvin in this.CurrentProductIds())
     {
         Catalog.Product p = app.CatalogServices.Products.Find(bvin);
         if (p != null)
         {
             result += "<li>[" + p.Sku + "] " + p.ProductName + "</li>";
         }
     }
     result += "</ul>";
     return result;
 }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:33,代码来源:OrderHasProducts.cs

示例3: 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);
            }
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:25,代码来源:UrlHelper.cs

示例4: ParseStoreFromUrl

        // Primary Method to Detect Store from Uri
        public static Accounts.Store ParseStoreFromUrl(System.Uri url, MerchantTribeApplication app)
        {
            var profiler = MvcMiniProfiler.MiniProfiler.Current;
            using (profiler.Step("UrlHelper.ParseStoreFromUrl"))
            {
                // Individual Mode
                if (WebAppSettings.IsIndividualMode)
                {
                    return app.AccountServices.FindOrCreateIndividualStore();
                }

                // Multi Mode
                Accounts.Store result = null;

                long storeid;
                using (profiler.Step("Parse Id"))
                {
                    storeid = ParseStoreId(url, app);
                }
                using (profiler.Step("Load Store"))
                {
                    if (storeid > 0)
                    {
                        result = app.AccountServices.Stores.FindById(storeid);
                    }
                }
                return result;
            }
        }
开发者ID:NightOwl888,项目名称:MerchantTribe,代码行数:30,代码来源:UrlHelper.cs

示例5: IsUrlInUse

        public static bool IsUrlInUse(string requestedUrl, string thisCustomUrlBvin, RequestContext context, MerchantTribeApplication app)
        {
            bool result = false;            
            string working = requestedUrl.ToLowerInvariant();

            // Check for Generic Page Use in a Flex Page
            if (IsCategorySlugInUse(working, thisCustomUrlBvin, context)) return true;

            // Check for Products
            if (IsProductSlugInUse(working, thisCustomUrlBvin, app)) return true;

            // Check Custom Urls
            Content.CustomUrl url = app.ContentServices.CustomUrls.FindByRequestedUrl(requestedUrl);
            if (url != null)
            {
                if (url.Bvin != string.Empty)
                {
                    if (url.Bvin != thisCustomUrlBvin)
                    {
                        return true;
                    }
                }
            }
            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:25,代码来源:UrlRewriter.cs

示例6: CategoryIconUrl

 public static string CategoryIconUrl(MerchantTribeApplication app, string categoryId, string imageName, bool isSecure)
 {
     string u = BaseUrlForSingleStore(app, isSecure);
     u += "categoryicons/" + categoryId.ToString() + "/small/";
     u += imageName;
     return u;
 }
开发者ID:NightOwl888,项目名称:MerchantTribe,代码行数:7,代码来源:DiskStorage.cs

示例7: CategoryBannerOriginalUrl

 public static string CategoryBannerOriginalUrl(MerchantTribeApplication app, string categoryId, string imageName, bool isSecure)
 {
     string u = BaseUrlForSingleStore(app, isSecure);
     u += "categorybanners/" + categoryId.ToString() + "/";
     u += imageName;
     return u;
 }
开发者ID:NightOwl888,项目名称:MerchantTribe,代码行数:7,代码来源:DiskStorage.cs

示例8: Process

        public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents)
        {
            this.App = app;
            this.Url = new System.Web.Mvc.UrlHelper(app.CurrentRequestContext.RoutingContext);
            CurrentCategory = app.CurrentRequestContext.CurrentCategory;
            if (CurrentCategory == null)
            {
                CurrentCategory = new Category();
                CurrentCategory.Bvin = "0";
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<div class=\"categorymenu\">");
            sb.Append("<div class=\"decoratedblock\">");

            string title = tag.GetSafeAttribute("title");
            if (title.Trim().Length > 0)
            {
                sb.Append("<h4>" + title + "</h4>");
            }

            sb.Append("<ul>");

            int maxDepth = 5;

            string mode = tag.GetSafeAttribute("mode");
            switch (mode.Trim().ToUpperInvariant())
            {
                case "ROOT":
                case "ROOTS":
                    // Root Categories Only
                    LoadRoots(sb);
                    break;
                case "ALL":
                    // All Categories
                    LoadAllCategories(sb, maxDepth);
                    break;
                case "":
                case "PEERS":
                    // Peers, Children and Parents
                    LoadPeersAndChildren(sb);
                    break;
                case "ROOTPLUS":
                    // Show root and expanded children
                    LoadRootPlusExpandedChildren(sb);
                    break;
                default:
                    // All Categories
                    LoadPeersAndChildren(sb);
                    break;
            }

            sb.Append("</ul>");

            sb.Append("</div>");
            sb.Append("</div>");

            return sb.ToString();
        }
开发者ID:tony722,项目名称:MerchantTribe,代码行数:60,代码来源:PageMenu.cs

示例9: 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();
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:26,代码来源:HtmlRendering.cs

示例10: CollectPaymentAndShipPendingOrders

        public static void CollectPaymentAndShipPendingOrders(MerchantTribeApplication app)
        {
            OrderSearchCriteria criteria = new OrderSearchCriteria();
            criteria.IsPlaced = true;
            criteria.StatusCode = OrderStatusCode.ReadyForPayment;
            int pageSize = 1000;            
            int totalCount = 0;

            List<OrderSnapshot> orders = app.OrderServices.Orders.FindByCriteriaPaged(criteria, 1, pageSize, ref totalCount);
            if (orders != null)
            {
                foreach (OrderSnapshot os in orders)
                {
                    Order o = app.OrderServices.Orders.FindForCurrentStore(os.bvin);
                    OrderPaymentManager payManager = new OrderPaymentManager(o, app);
                    payManager.CreditCardCompleteAllCreditCards();
                    payManager.PayPalExpressCompleteAllPayments();
                    if (o.PaymentStatus == OrderPaymentStatus.Paid ||
                        o.PaymentStatus == OrderPaymentStatus.Overpaid)
                    {
                        if (o.ShippingStatus == OrderShippingStatus.FullyShipped)
                        {
                            o.StatusCode = OrderStatusCode.Completed;
                            o.StatusName = "Completed";
                        }
                        else
                        {
                            o.StatusCode = OrderStatusCode.ReadyForShipping;
                            o.StatusName = "Ready for Shipping";
                        }
                        app.OrderServices.Orders.Update(o);
                    }
                }
            }
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:35,代码来源:OrderBatchProcessor.cs

示例11: 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;
        }
开发者ID:KimRossey,项目名称:MerchantTribe,代码行数:27,代码来源:Css.cs

示例12: 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 &copy;" + 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;
        }
开发者ID:tony722,项目名称:MerchantTribe,代码行数:27,代码来源:TagReplacer.cs

示例13: GetReplaceableTags

        public List<Content.HtmlTemplateTag> GetReplaceableTags(MerchantTribeApplication app)
        {
			List<Content.HtmlTemplateTag> result = new List<Content.HtmlTemplateTag>();
			result.Add(new Content.HtmlTemplateTag("[[VendorManufacturer.EmailAddress]]", this.EmailAddress));
			result.Add(new Content.HtmlTemplateTag("[[VendorManufacturer.Name]]", this.DisplayName));
			return result;
		}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:7,代码来源:VendorManufacturer.cs

示例14: LoadInstalledTheme

        public void LoadInstalledTheme(MerchantTribeApplication app, string themeId)
        {
            long storeId = app.CurrentStore.Id;
            string themePhysicalRoot = Storage.DiskStorage.BaseStoreThemePhysicalPath(storeId, themeId);

            if (!Directory.Exists(themePhysicalRoot))
            {
                return;
            }

            _Info = new ThemeInfo();
            if (File.Exists(Path.Combine(themePhysicalRoot,"bvtheme.xml")) )
            {
                _Info.LoadFromString(File.ReadAllText(Path.Combine(themePhysicalRoot,"bvtheme.xml")));
            }

            if (File.Exists(Path.Combine(themePhysicalRoot,".customized")))
            {
                _IsCustomized = true;
            }
            else
            {
                _IsCustomized = false;  
            }

            if (File.Exists(Path.Combine(themePhysicalRoot,"preview.png")))
            {
                _PreviewImageUrl = Storage.DiskStorage.BaseUrlForStoreTheme(app, themeId, true) + "preview.png";
            }
            else
            {
                _PreviewImageUrl = string.Empty;
            }
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:34,代码来源:ThemeView.cs

示例15: Process

        public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents)
        {
            StringBuilder sb = new StringBuilder();
            bool isSecureRequest = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection;
            bool textOnly = false;
            string textOnlyTag = tag.GetSafeAttribute("textonly").Trim().ToLowerInvariant();
            if (textOnlyTag == "1" || textOnlyTag == "y" || textOnlyTag == "yes" || textOnlyTag == "true") textOnly = true;

            string storeRootUrl = app.CurrentStore.RootUrl();
            string storeName = app.CurrentStore.Settings.FriendlyName;

            string logoImage = app.CurrentStore.Settings.LogoImageFullUrl(app, isSecureRequest);
            string logoText = app.CurrentStore.Settings.LogoText;

            sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\"");

            if (contents.Trim().Length > 0)
            {
                sb.Append(">");
                sb.Append(contents);
            }
            else if (app.CurrentStore.Settings.UseLogoImage && textOnly == false)
            {
                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();
        }
开发者ID:KimRossey,项目名称:MerchantTribe,代码行数:34,代码来源:Logo.cs


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