protected void ProductNavigator_Clicked(object sender, MerchantTribe.Commerce.Content.NotifyClickControl.ClickedEventArgs e)
 {
     if (!this.Save())
     {
         e.ErrorOccurred = true;
     }
 }
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            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>");

            actions.Add(new Actions.LiteralText(sb.ToString()));
        }
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<" + _tagName);

            string pathToTemplate = app.ThemeManager().ThemeFileUrl("",app) + "templates/";

            foreach (var att in tag.Attributes)
            {
                string name = att.Key;
                string val = att.Value;
                if (_attributesToFix.Contains(att.Key.ToLowerInvariant()))
                {
                    val = FixUpValue(val, pathToTemplate);
                }
                sb.Append(" " + name + "=\"" + val + "\"");
            }

            if (tag.IsSelfClosed)
            {
                sb.Append("/>");
            }
            else
            {
                sb.Append(">" + innerContents + "</" + _tagName + ">");
            }

            actions.Add(new Actions.LiteralText(sb.ToString()));
        }
Exemple #4
0
        private static void RenderNode(StringBuilder sb, MerchantTribe.Web.SiteMapNode node)
        {
            sb.Append("<li>");


            if (node.Url.Trim().Length > 0)
            {
                sb.Append("<a href=\"" + node.Url + "\">" + node.DisplayName + "</a>");
            }
            else
            {
                sb.Append("<strong>" + node.DisplayName + "</strong>");
            }

            if (node.Children.Count > 0)
            {
                sb.Append(System.Environment.NewLine);
                sb.Append("<ul>" + System.Environment.NewLine);

                foreach (MerchantTribe.Web.SiteMapNode child in node.Children)
                {
                    RenderNode(sb, child);
                }

                sb.Append("</ul>" + System.Environment.NewLine);
            }
            sb.Append("</li>" + System.Environment.NewLine);
        }
Exemple #5
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {            
            bool isSecureRequest = app.IsCurrentRequestSecure();            
            bool textOnly = !app.CurrentStore.Settings.UseLogoImage;
            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;

            LogoViewModel model = new LogoViewModel();
            model.InnerContent = innerContents.Trim();
            model.LinkUrl = storeRootUrl;
            model.LogoImageUrl = logoImage;
            model.LogoText = logoText;
            model.StoreName = storeName;
            model.UseTextOnly = textOnly;

            Render(output, model);            
        }
 public DomesticProvider(USPostalServiceGlobalSettings globalSettings, MerchantTribe.Web.Logging.ILogger logger)
 {
     _Logger = logger;
     this.GlobalSettings = globalSettings;            
     Settings = new USPostalServiceSettings();
     InitializeCodes();
 }        
        public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block)
        {
            ImageRotatorViewModel model = new ImageRotatorViewModel();

            if (block != null)
            {
                var imageList = block.Lists.FindList("Images");
                foreach (var listItem in imageList)
                {
                    ImageRotatorImageViewModel img = new ImageRotatorImageViewModel();
                    img.ImageUrl = ResolveUrl(listItem.Setting1, app);
                    img.Url = listItem.Setting2;
                    if (img.Url.StartsWith("~"))
                    {
                        img.Url = app.CurrentRequestContext.UrlHelper.Content(img.Url);
                    }
                    img.NewWindow = (listItem.Setting3 == "1");
                    img.Caption = listItem.Setting4;
                    model.Images.Add(img);
                }
                string cleanId = MerchantTribe.Web.Text.ForceAlphaNumericOnly(block.Bvin);
                model.CssId = "rotator" + cleanId;
                model.CssClass = block.BaseSettings.GetSettingOrEmpty("cssclass");

                model.Height = block.BaseSettings.GetIntegerSetting("Height");
                model.Width = block.BaseSettings.GetIntegerSetting("Width");

                if (block.BaseSettings.GetBoolSetting("ShowInOrder") == false)
                {
                    RandomizeList(model.Images);
                }
            }

            return RenderModel(model);
        }
Exemple #8
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            MiniPagerViewModel model = new MiniPagerViewModel();

            model.TotalPages = tag.GetSafeAttributeAsInteger("totalpages");
            if (model.TotalPages >= 1)
            {
                // manual load
                model.CurrentPage = tag.GetSafeAttributeAsInteger("currentpage");
                model.PagerUrlFormat = tag.GetSafeAttribute("urlformat");
                model.PagerUrlFormatFirst = tag.GetSafeAttribute("urlformatfirst");
                if (model.CurrentPage < 1) model.CurrentPage = GetPageFromRequest(app);
            }
            else
            {
                // find everything from current category
                model = FindModelForCurrentCategory(app, viewBag, tag);
            }
            
            Render(output, model);
        }
        public static ShippingRate RatePackage(FedExGlobalServiceSettings globals,
                                       MerchantTribe.Web.Logging.ILogger logger,
                                       FedExServiceSettings settings,
                                       IShipment package)
        {
            ShippingRate result = new ShippingRate();

                // Get ServiceType
                ServiceType currentServiceType = ServiceType.FEDEXGROUND;
                currentServiceType = (ServiceType)settings.ServiceCode;

                // Get PackageType
                PackageType currentPackagingType = PackageType.YOURPACKAGING;
                currentPackagingType = (PackageType)settings.Packaging;

                // Set max weight by service
                CarrierCodeType carCode = GetCarrierCode(currentServiceType);

                result.EstimatedCost = RateSinglePackage(globals, 
                                                        logger,
                                                        package, 
                                                        currentServiceType, 
                                                        currentPackagingType, 
                                                        carCode);

            return result;
        }
Exemple #10
0
 public void PopulateFromPaymentTransaction(MerchantTribe.Payment.Transaction t)
 {
     if (t != null)
     {
         TimeStampUtc = DateTime.UtcNow;
         Action = t.Action;
         Amount = t.Amount;
         if (t.Action == ActionType.CreditCardRefund)
         {
             Amount = (t.Amount * -1);
         }
         CreditCard = t.Card;
         Success = t.Result.Succeeded;
         Voided = false;
         RefNum1 = t.Result.ReferenceNumber;
         RefNum2 = t.Result.ReferenceNumber2;
         Messages = string.Empty;
         if (t.Result.Messages.Count > 0)
         {
             foreach (Message m in t.Result.Messages)
             {
                 Messages += m.Code + "::" + m.Description;
             }
         }
     }
 }
 public void Render(StringBuilder sb, MerchantTribe.Commerce.Catalog.Product p, MerchantTribeApplication app)
 {
     if (p == null) return;
     if (p.Bvin == string.Empty) return;
     var model = new SingleProductViewModel(p, app);
     RenderModel(sb, model, app);
 }
 public void PopulateFromPaymentTransaction(MerchantTribe.Payment.Transaction t)
 {
     if (t != null)
     {
         TimeStampUtc = DateTime.UtcNow;
         Action = t.Action;
         Amount = t.Amount;
         if (t.IsRefundTransaction)
         {
             Amount = (t.Amount * -1);
         }
         CreditCard = t.Card;
         Success = t.Result.Succeeded;
         Voided = false;
         RefNum1 = t.Result.ReferenceNumber;
         RefNum2 = t.Result.ReferenceNumber2;
         Messages = string.Empty;
         if (t.Result.Messages.Count > 0)
         {
             foreach (Message m in t.Result.Messages)
             {
                 Messages += ":: " + m.Code + " - " + m.Description + " ";
             }
         }
         this.CheckNumber = t.CheckNumber;
         this.PurchaseOrderNumber = t.PurchaseOrderNumber;
         this.GiftCardNumber = t.GiftCardNumber;
         this.CompanyAccountNumber = t.CompanyAccountNumber;                
     }
 }
        public void ShowMessage(string msg, MerchantTribe.Commerce.Content.DisplayMessageType msgType)
        {
            this.litMain.Text += "<div class=\"";
            switch (msgType)
            {
                case DisplayMessageType.Error:
                    this.litMain.Text += "flash-message-error";
                    break;
                case DisplayMessageType.Exception:
                    this.litMain.Text += "flash-message-exception";
                    break;
                case DisplayMessageType.Information:
                    this.litMain.Text += "flash-message-info";
                    break;
                case DisplayMessageType.Question:
                    this.litMain.Text += "flash-message-question";
                    break;
                case DisplayMessageType.Success:
                    this.litMain.Text += "flash-message-success";
                    break;
                case DisplayMessageType.Warning:
                    this.litMain.Text += "flash-message-warning";
                    break;
                case DisplayMessageType.Minor:
                    this.litMain.Text += "flash-message-minor";
                    break;
            }

            this.litMain.Text += "\">" + msg + "</div>";
        }
Exemple #14
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            string fileUrl = string.Empty;
            bool secure = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection;

            var 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\" />";
            actions.Add(new Actions.LiteralText(result));
        }
Exemple #15
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            output.Append("<" + _tagName);
            
            string pathToTemplate = app.ThemeManager().ThemeFileUrl("",app) + "templates/";
            if (pathToTemplate.StartsWith("http://"))
            {
                pathToTemplate = pathToTemplate.Replace("http://", "//");
            }

            foreach (var att in tag.Attributes)
            {
                string name = att.Key;
                string val = att.Value;
                if (_attributesToFix.Contains(att.Key.ToLowerInvariant()))
                {
                    val = FixUpValue(val, pathToTemplate);
                }
                output.Append(" " + name + "=\"" + val + "\"");                
            }
            
            if (tag.IsSelfClosed)
            {
                output.Append("/>");
            }
            else
            {
                output.Append(">" + innerContents + "</" + _tagName + ">");
            }                        
        }
 public ShippingRateDisplay(MerchantTribe.Shipping.IShippingRate rate)
 {
     this._DisplayName = rate.DisplayName;
     this._Rate = rate.EstimatedCost;
     this._ProviderId = rate.ServiceId;
     this._ProviderServiceCode = rate.ServiceCodes;
 }
Exemple #17
0
 private static void CallTasksOnStore(MerchantTribe.Commerce.Accounts.StoreDomainSnapshot snap)
 {
     string storekey = System.Configuration.ConfigurationManager.AppSettings["storekey"];
     string rootUrl = snap.RootUrl();
     string destination = rootUrl + "scheduledtasks/" + storekey;
     MerchantTribe.Commerce.Utilities.WebForms.SendRequestByPost(destination, string.Empty);
 }
Exemple #18
0
 public UPSService(UPSServiceGlobalSettings globalSettings, MerchantTribe.Web.Logging.ILogger logger)
 {
     _Logger = logger;
     GlobalSettings = globalSettings;
     Settings = new UPSServiceSettings();
     InitializeCodes();
 }
Exemple #19
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {            
            bool secure = app.IsCurrentRequestSecure();            
            string mode = tag.GetSafeAttribute("mode");

            if (mode == "system")
            {
                string baseScriptFolder = app.CurrentStore.RootUrl();
                if (secure) baseScriptFolder = app.CurrentStore.RootUrlSecure();
                if (baseScriptFolder.EndsWith("/") == false)
                {
                    baseScriptFolder += "/";
                }
                baseScriptFolder += "scripts/";

                bool useCDN = false;
                string cdn = tag.GetSafeAttribute("cdn");
                if (cdn == "1" || cdn == "true" || cdn == "y" || cdn == "Y") useCDN = true;

                if (useCDN)
                {
                    // CDN JQuery
                    if (secure)
                    {
                        output.Append("<script src='https://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                    }
                    else
                    {
                        output.Append("<script src='http://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                    }
                }
                else
                {
                    // Local JQuery
                    output.Append("<script src='" + baseScriptFolder + "jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                }
                output.Append(System.Environment.NewLine);

                output.Append("<script src='" + baseScriptFolder + "jquery-ui-1.8.7.custom/js/jquery-ui-1.8.7.custom.min.js' type=\"text/javascript\"></script>");
                output.Append("<script src='" + baseScriptFolder + "jquery.form.js' type=\"text/javascript\"></script>");
                output.Append(System.Environment.NewLine);
            }
            else
            {
                string src = tag.GetSafeAttribute("src");
                string fileName = tag.GetSafeAttribute("file");
                if (fileName.Trim().Length > 0)
                {
                    var tm = app.ThemeManager();
                    src = tm.ThemeFileUrl(fileName, app);
                }
                output.Append("<script src=\"" + src + "\" type=\"text/javascript\"></script>");
            }            
        }
 public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block)
 {
     ProductListViewModel model = new ProductListViewModel();
     model.Title = SiteTerms.GetTerm(SiteTermIds.RecentlyViewedItems);
     model.Items = LoadItems(app);
     
     return RenderModel(model, app);
 }
 public OrderTransaction(MerchantTribe.Payment.Transaction t)
 {
     Id = System.Guid.NewGuid();
     StoreId = 0;
     OrderId = string.Empty;
     LinkedToTransaction = string.Empty;
     PopulateFromPaymentTransaction(t);
 }
Exemple #22
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            
            int linksPerRow = 9;
            string tryLinksPerRow = tag.GetSafeAttribute("linksperrow");
            int temp1 = -1;
            if (int.TryParse(tryLinksPerRow, out temp1)) linksPerRow = temp1;
            if (linksPerRow < 1) linksPerRow = 1;

            int maxLinks = 9;
            int temp2 = -1;
            string tryMaxLinks = tag.GetSafeAttribute("maxlinks");
            if (int.TryParse(tryMaxLinks, out temp2)) maxLinks = temp2;
            if (maxLinks < 1) maxLinks = 1;

            int tabIndex = 0;
            string tryTabIndex = tag.GetSafeAttribute("tabindex");
            int.TryParse(tryTabIndex, out tabIndex);
            if (tabIndex < 0) tabIndex = 0;

            

            MainMenuViewModel model = new MainMenuViewModel();
            model.LinksPerRow = linksPerRow;
            model.MaxLinks = maxLinks;            

            //Find Categories to Display in Menu
            List<MerchantTribe.Commerce.Catalog.CategorySnapshot> categories = app.CatalogServices.Categories.FindForMainMenu();

            int tempTabIndex = 0;
            foreach (var c in categories)
            {
                var l = new MainMenuViewModelLink();
                l.AltText = c.MetaTitle;
                l.DisplayName = c.Name;
                l.TabIndex = tempTabIndex;
                l.Target = string.Empty;
                l.IsActive = false;
                l.Url = MerchantTribe.Commerce.Utilities.UrlRewriter.BuildUrlForCategory(c, app.CurrentRequestContext.RoutingContext);

                if (c.Bvin == SessionManager.CategoryLastId) l.IsActive = true;
                if (c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomLink ||
                    c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomPage)
                {
                    if (c.CustomPageOpenInNewWindow) l.Target = "_blank";
                }

                model.Links.Add(l);
                tempTabIndex += 1;
            }

            Render(output, model);            
        }
 public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
 {
     StringBuilder sb = new StringBuilder();
     foreach (string s in app.CurrentRequestContext.TempMessages)
     {
         sb.Append(s);
     }
     actions.Add(new Actions.LiteralText(sb.ToString()));
 }
        public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block)        
        {
            this.MTApp = app;
            this.ViewBag = viewBag;

            CategoryMenuViewModel model = new CategoryMenuViewModel();
            LoadMenu(model, block);
            return Render(model);
        }
Exemple #25
0
 public Transaction(MerchantTribe.Payment.Transaction t)
 {
     Id = 0;
     AccountId = 0;
     InvoiceReference = string.Empty;
     ExternalOrderNumber = string.Empty;
     LinkedToTransaction = 0;
     PopulateFromPaymentTransaction(t);
 }
Exemple #26
0
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag,
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {
    output.Append(MerchantTribe.Commerce.Utilities.HtmlRendering.PromoTag());
 }
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            SearchFormViewModel model = new SearchFormViewModel();
            string rootUrl = app.StoreUrl(false, true);
            model.SearchFormUrl = rootUrl + "search";
            model.ButtonImageUrl = app.ThemeManager().ButtonUrl("Go", app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);

            actions.Add(new Actions.PartialView("~/views/shared/_SearchForm.cshtml", model));
        }
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            string byParam = tag.GetSafeAttribute("by");

            dynamic model = new ExpandoObject();
            model.By = byParam;

            actions.Add(new Actions.PartialView("~/views/shared/_copyright.cshtml", model));
        }
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append((string)viewBag.analyticsbottom);
 }
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(Render(app, viewBag));
 }