Esempio n. 1
0
        public ActionResult PreviewBar()
        {
            var profile = HttpContext.Profile;

            //return early if we are not previewing
            if (profile == null ||
                profile.PropertyValues["PreviewSkinID"] == null ||
                !CommonLogic.IsInteger(profile.GetPropertyValue("PreviewSkinID").ToString()))
            {
                return(Content(String.Empty));
            }

            var customer = HttpContext.GetCustomer();

            var previewSkinId   = int.Parse(HttpContext.Profile.GetPropertyValue("PreviewSkinID").ToString());
            var previewSkin     = new SkinProvider().GetSkinById(previewSkinId);
            var previewSkinName = !String.IsNullOrEmpty(previewSkin.DisplayName)
                                ? previewSkin.DisplayName
                                : previewSkin.Name;

            var previewBarViewModel = new PreviewBarViewModel
            {
                PreviewText       = String.Format(AppLogic.GetString("admin.skinselector.PreviewWarning", customer.LocaleSetting), previewSkinName),
                PreviewBarCssPath = "~/App_Templates/Admin_Default/previewstyles.css"
            };

            return(PartialView(ViewNames.PreviewBarPartial, previewBarViewModel));
        }
Esempio n. 2
0
        public override void DataBind()
        {
            base.DataBind();

            cmbSkinID.Items.Clear();
            ISkinProvider skinProvider = new SkinProvider();
            var           allSkins     = skinProvider.GetSkins();
            //exclude mobile skins from the options
            var skins = allSkins.Where(s => !s.IsMobile);

            foreach (var skin in skins)
            {
                var displayName = String.IsNullOrEmpty(skin.DisplayName) ? skin.Name : skin.DisplayName;
                cmbSkinID.Items.Add(new ListItem(displayName, skin.Id.ToString()));
            }

            var store = this.Datasource;

            if (cmbSkinID.Items.FindByValue(store.SkinID.ToString()) != null)
            {
                cmbSkinID.SelectedValue = store.SkinID.ToString();
            }

            phRegisterWithBuySafe.Visible = cbxBuySafe.Checked = store.StoreID < 1;

            extEditStorePanel.TargetControlID = this.PopupTargetControlID;

            if (this.CloneMode)
            {
                txtStoreName.Text = "{0} - Clone".FormatWith(Datasource.Name);
            }
        }
Esempio n. 3
0
        public ActionResult PreviewBar()
        {
            var profile = HttpContext.Profile;

            //return early if we are not previewing
            if (profile == null ||
                profile.PropertyValues["PreviewSkinID"] == null ||
                !CommonLogic.IsInteger(profile.GetPropertyValue("PreviewSkinID").ToString()))
            {
                return(Content(String.Empty));
            }

            var customer = HttpContext.GetCustomer();

            var previewSkinId   = int.Parse(HttpContext.Profile.GetPropertyValue("PreviewSkinID").ToString());
            var previewSkin     = new SkinProvider().GetSkinById(previewSkinId);
            var previewSkinName = !String.IsNullOrEmpty(previewSkin.DisplayName)
                                ? previewSkin.DisplayName
                                : previewSkin.Name;

            var previewBarViewModel = new PreviewBarViewModel
            {
                PreviewText       = String.Format("You are previewing the <span class=\"preview - skin - name\">{0}</span> skin.  Click the button to the right to end the preview.", previewSkinName),
                PreviewBarCssPath = "~/App_Templates/Admin_Default/previewstyles.css"
            };

            return(PartialView(ViewNames.PreviewBarPartial, previewBarViewModel));
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Customer thisCustomer  = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;
            int      previewSkinId = int.Parse(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString());

            Skin previewSkin = new SkinProvider().GetSkinById(previewSkinId);

            string previewSkinName = !String.IsNullOrEmpty(previewSkin.DisplayName) ? previewSkin.DisplayName : previewSkin.Name;

            litPreviewText.Text = String.Format(AppLogic.GetString("admin.skinselector.PreviewWarning", thisCustomer.LocaleSetting), previewSkinName);
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreditCardPanel"/> class.
        /// </summary>
        public CreditCardPanel()
        {
            AssignClientReferenceIDs();
            DisableAutoComplete();
            AssignDatasource();
            AssignDefaults();

            _hlnkWhat.NavigateUrl            = "javascript:void(0);";
            _pnlWhatsThisContainer.CssClass += " whatsThisLink ";
            SkinProvider = new SkinProvider();
        }
Esempio n. 6
0
        public Topics()
        {
            Url = DependencyResolver.Current.GetService <UrlHelper>();

            // Use a dictionary to map the string command names to handler methods
            CommandHandlerMappings = new Dictionary <string, CommandEventHandler>
            {
                { DeleteTopicCommand, (o, e) => DeleteTopicCommandHandler(o, e, deleted: true, successStringResource: "admin.topicgrid.Deleted") },
                { UndeleteTopicCommand, (o, e) => DeleteTopicCommandHandler(o, e, deleted: false, successStringResource: "admin.topicgrid.UnDeleted") },
            };
            SkinProvider = new SkinProvider();
        }
Esempio n. 7
0
        public ActionResult CreditCardDetail()
        {
            var customer = HttpContext.GetCustomer();

            var showCardStartDateFields = AppLogic.AppConfigBool("ShowCardStartDateFields");

            var walletsAreEnabled  = customer.IsRegistered && WalletProvider.WalletsAreEnabled();
            var displayWalletCards = walletsAreEnabled && WalletProvider.GetPaymentProfiles(customer).Any();

            string name           = customer.FullName(),
                   number         = null,
                   cardType       = null,
                   expirationDate = null,
                   startDate      = null;

            var checkoutContext = PersistedCheckoutContextProvider.LoadCheckoutContext(customer);

            if (checkoutContext.CreditCard != null)
            {
                name = checkoutContext.CreditCard.Name ?? customer.FullName();

                number = GetCreditCardNumberForDisplay(checkoutContext.CreditCard.Number);

                cardType = checkoutContext.CreditCard.CardType;

                expirationDate = GetCreditCardDateForDisplay(checkoutContext.CreditCard.ExpirationDate);

                startDate = GetCreditCardDateForDisplay(checkoutContext.CreditCard.StartDate);
            }

            var skinProvider = new SkinProvider();

            return(PartialView(ViewNames.CreditCardDetailPartial, new CheckoutCreditCardViewModel
            {
                Name = name,
                Number = number,
                CardType = cardType,
                ExpirationDate = expirationDate,
                StartDate = startDate,
                ShowStartDate = showCardStartDateFields,
                WalletsAreEnabled = walletsAreEnabled,
                DisplayWalletCards = displayWalletCards,
                LastFour = (!string.IsNullOrEmpty(number) && number.Length > 4)
                                        ? number.Substring(number.Length - 4)
                                        : null,
                CardImage = !string.IsNullOrEmpty(cardType)
                                        ? DisplayTools.GetCardImage(
                    imagePath: Url.SkinUrl("images/"),
                    cardName: cardType)
                                        : null
            }));
        }
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.RouteData.Values.ContainsKey(RouteDataKeys.SkinId))
            {
                return;
            }

            var customer     = Customer.Current;
            var skinName     = SkinProvider.DefaultSkinName;
            var skinProvider = new SkinProvider();
            var skinId       = AppLogic.GetStoreSkinID(AppLogic.StoreID());

            // Have to call GetPropertyValue once before you actually need it to initialize the PropertyValues collection
            if (HttpContext.Current.Profile != null)
            {
                HttpContext.Current.Profile.GetPropertyValue("SkinID");
            }

            // Skin querystring
            var skinNameQuerystring = CommonLogic.QueryStringCanBeDangerousContent("skin");

            if (!String.IsNullOrEmpty(skinNameQuerystring))
            {
                skinName = skinNameQuerystring;
                skinId   = skinProvider.GetSkinIdByName(skinName);

                // Customer has a querystring so save this to the profile.
                if (HttpContext.Current.Profile != null)
                {
                    HttpContext.Current.Profile.SetPropertyValue("SkinID", skinId.ToString());
                }
            }
            // SkinId querystring
            else if (CommonLogic.QueryStringUSInt("skinid") > 0)
            {
                skinId = CommonLogic.QueryStringUSInt("skinid");

                // Customer has a querystring so save this to the profile.
                if (HttpContext.Current.Profile != null)
                {
                    HttpContext.Current.Profile.SetPropertyValue("SkinID", skinId.ToString());
                }
            }
            // Check to see if we are previewing the skin
            else if (CommonLogic.QueryStringUSInt("previewskinid") > 0)
            {
                skinId = CommonLogic.QueryStringUSInt("previewskinid");

                //Customer has a preview querystring so save this to the profile.
                if (HttpContext.Current.Profile != null)
                {
                    HttpContext.Current.Profile.SetPropertyValue("PreviewSkinID", skinId.ToString());
                }
            }
            // Use the preview profile value if we have one
            else if (HttpContext.Current.Profile != null &&
                     HttpContext.Current.Profile.PropertyValues["PreviewSkinID"] != null &&
                     CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString()))
            {
                int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString());
                if (skinFromProfile > 0)
                {
                    skinId = skinFromProfile;
                }
            }
            // Pull the skinid from the current profile
            else if (HttpContext.Current.Profile != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()))
            {
                int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString());
                if (skinFromProfile > 0)
                {
                    skinId = skinFromProfile;
                }
            }

            // Now save the skinID to the customer record.  This is not used OOB.
            if (customer.SkinID != skinId)
            {
                customer.SkinID = skinId;
                customer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", skinId) });
            }

            filterContext.RouteData.Values.Add(RouteDataKeys.SkinId, skinId);
        }
Esempio n. 9
0
 public Vbv(SkinProvider skinProvider)
 {
     SkinProvider = skinProvider;
 }