Esempio n. 1
0
        protected MvcHtmlString StoreFrontBreadcrumb(HtmlHelper htmlHelper, int?clientId, StoreFront storeFront, bool ShowAsLink = false)
        {
            RouteValueDictionary routeData = null;
            string name     = "(unknown)";
            bool   showLink = false;

            if (storeFront != null)
            {
                if (storeFront.StoreFrontId == 0)
                {
                    name = "New";
                }
                else
                {
                    showLink  = ShowAsLink;
                    routeData = new RouteValueDictionary(new { id = storeFront.StoreFrontId });
                    StoreFrontConfiguration config = storeFront.CurrentConfigOrAny();
                    name = (config == null ? "id [" + storeFront.StoreFrontId + "]" : "'" + config.Name + "' [" + storeFront.StoreFrontId + "]");
                }
            }

            return(new MvcHtmlString(
                       StoreFrontsBreadcrumb(htmlHelper, clientId, true).ToHtmlString()
                       + " -> "
                       + (showLink ? htmlHelper.ActionLink(name, "Details", "StoreFrontSysAdmin", routeData, null).ToHtmlString() : name)
                       ));
        }
        public List <SelectListItem> StoreFrontConfigList(StoreFront storeFront)
        {
            if (storeFront == null)
            {
                throw new ArgumentNullException("storeFront");
            }

            StoreFrontConfiguration currentConfig = storeFront.CurrentConfig();
            int currentconfigId = 0;

            if (currentConfig != null)
            {
                currentconfigId = currentConfig.StoreFrontConfigurationId;
            }

            List <SelectListItem>          list           = new List <SelectListItem>();
            List <StoreFrontConfiguration> orderedConfigs = storeFront.StoreFrontConfigurations.AsQueryable().ApplyDefaultSort().ToList();
            List <SelectListItem>          listItemQuery  = orderedConfigs.Select(c => new SelectListItem()
            {
                Value = c.StoreFrontConfigurationId.ToString(),
                Text  = (c.StoreFrontConfigurationId == currentconfigId ? " [Current Active] " : "")
                        + c.ConfigurationName + " [" + c.StoreFrontConfigurationId + "]"
                        + (c.IsPending ? " [INACTIVE]" : " [" + c.StartDateTimeUtc.ToLocalTime().ToShortDateString() + " to " + c.EndDateTimeUtc.ToLocalTime().ToShortDateString() + "]"),
                Selected = (c.StoreFrontConfigurationId == currentconfigId)
            }).ToList();

            list.AddRange(listItemQuery.ToList());

            return(list);
        }
Esempio n. 3
0
        public ActionResult DeliveryInfo()
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;
            Cart cart = config.StoreFront.GetCart(Session.SessionID, CurrentUserProfileOrNull);

            if (!cart.CartIsValidForCheckout(this))
            {
                return(RedirectToAction("Index", "Cart"));
            }

            if (!cart.StatusStartedCheckout)
            {
                return(RedirectToAction("Index"));
            }
            if (!cart.StatusSelectedLogInOrGuest)
            {
                return(RedirectToAction("LogInOrGuest"));
            }

            cart = cart.ValidateCartAndSave(this);

            if (cart.AllItemsAreDigitalDownload)
            {
                CheckoutDeliveryInfoDigitalOnlyViewModel viewModelDigitalOnly = new CheckoutDeliveryInfoDigitalOnlyViewModel(config, cart, RouteData.Action());
                return(View("DeliveryInfoDigitalOnly", viewModelDigitalOnly));
            }
            else
            {
                CheckoutDeliveryInfoShippingViewModel viewModelShipping = new CheckoutDeliveryInfoShippingViewModel(config, cart, RouteData.Action());
                return(View("DeliveryInfoShipping", viewModelShipping));
            }
        }
Esempio n. 4
0
        private static bool ProcessWebForm_ToEmail(BaseController controller, WebForm webForm, Page page)
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }

            StoreFrontConfiguration storeFrontConfiguration = controller.CurrentStoreFrontConfigOrThrow;
            UserProfile             userProfile             = controller.CurrentUserProfileOrNull;

            string toEmail = page.WebFormEmailToAddress;

            if (string.IsNullOrWhiteSpace(toEmail))
            {
                toEmail = storeFrontConfiguration.RegisteredNotify.Email;
            }
            string toName = page.WebFormEmailToName;

            if (string.IsNullOrWhiteSpace(toName))
            {
                toName = storeFrontConfiguration.RegisteredNotify.FullName;
            }

            string subject  = BuildFormSubject(controller, webForm, page);
            string bodyText = BuildFormBodyText(controller, webForm, page, false);
            string bodyHtml = bodyText.ToHtmlLines();

            return(controller.SendEmail(toEmail, toName, subject, bodyText, bodyHtml));
        }
Esempio n. 5
0
        public static bool ActivateStoreFrontConfigOnly(this SystemAdminBaseController controller, int storeConfigId)
        {
            StoreFrontConfiguration config = controller.GStoreDb.StoreFrontConfigurations.FindById(storeConfigId);

            if (config == null)
            {
                controller.AddUserMessage("Activate Store Config Failed!", "Store Config not found by id: " + storeConfigId, AppHtmlHelpers.UserMessageType.Danger);
                return(false);
            }

            if (config.IsActiveDirect())
            {
                controller.AddUserMessage("Store Config is already active.", "Store Config is already active. id: " + storeConfigId, AppHtmlHelpers.UserMessageType.Info);
                return(false);
            }

            config.IsPending        = false;
            config.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            config.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            config = controller.GStoreDb.StoreFrontConfigurations.Update(config);
            controller.GStoreDb.SaveChanges();
            controller.AddUserMessage("Activated Store Config", "Activated Store Config '" + config.ConfigurationName + "' [" + config.StoreFrontConfigurationId + "] for Store Front: '" + config.Name.ToHtml() + "' [" + config.StoreFrontId + "]" + " - Client '" + config.Client.Name.ToHtml() + "' [" + config.Client.ClientId + "]", AppHtmlHelpers.UserMessageType.Info);

            return(true);
        }
Esempio n. 6
0
 public CheckoutDeliveryInfoShippingViewModel(StoreFrontConfiguration config, Cart cart, string currentAction) : base(config, cart, currentAction)
 {
     this.EmailAddress = cart.Email;
     if (cart.DeliveryInfoShipping != null)
     {
         DeliveryInfoShipping info = cart.DeliveryInfoShipping;
         this.EmailAddress = info.EmailAddress;
         this.FullName     = info.FullName;
         this.AdddressL1   = info.AdddressL1;
         this.AdddressL2   = info.AdddressL2;
         this.City         = info.City;
         this.State        = info.State;
         this.PostalCode   = info.PostalCode;
         this.CountryCode  = info.CountryCode;
     }
     else if (cart.UserProfile != null)
     {
         this.FullName    = cart.UserProfile.FullName;
         this.AdddressL1  = cart.UserProfile.AddressLine1;
         this.AdddressL2  = cart.UserProfile.AddressLine2;
         this.City        = cart.UserProfile.City;
         this.State       = cart.UserProfile.State;
         this.PostalCode  = cart.UserProfile.PostalCode;
         this.CountryCode = cart.UserProfile.CountryCode;
     }
 }
Esempio n. 7
0
        public ActionResult Index()
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;
            Cart cart = config.StoreFront.GetCart(Session.SessionID, CurrentUserProfileOrNull);

            if (!cart.CartIsValidForCheckout(this))
            {
                return(RedirectToAction("Index", "Cart"));
            }

            if (cart.StatusStartedCheckout)
            {
                return(RedirectToAction("LogInOrGuest"));
            }

            cart = cart.ValidateCartAndSave(this);
            cart.StatusStartedCheckout = true;
            cart = GStoreDb.Carts.Update(cart);
            GStoreDb.SaveChanges();

            GStoreDb.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Checkout, UserActionActionEnum.Checkout_Started, "", true, cartId: cart.CartId);

            UserProfile profile = CurrentUserProfileOrNull;

            if (profile != null)
            {
                return(RedirectToAction("DeliveryInfo"));
            }
            return(RedirectToAction("LogInOrGuest"));
        }
Esempio n. 8
0
        public static void SetDefaultsForNew(this UserProfile profile, Client client, StoreFront storeFront)
        {
            if (client != null)
            {
                profile.Client     = client;
                profile.ClientId   = client.ClientId;
                profile.TimeZoneId = client.TimeZoneId;
            }

            if (storeFront != null)
            {
                profile.StoreFront   = storeFront;
                profile.StoreFrontId = storeFront.StoreFrontId;
                StoreFrontConfiguration storeFrontConfig = storeFront.CurrentConfigOrAny();
                if (storeFrontConfig != null)
                {
                    profile.TimeZoneId = storeFrontConfig.TimeZoneId;
                }
            }

            profile.EntryDateTime    = DateTime.UtcNow;
            profile.IsPending        = true;
            profile.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            profile.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
        }
Esempio n. 9
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (_actions == null || _actions.Count == 0)
            {
                throw new ApplicationException("AuthorizeGStoreAction was called with no action specified. You must specify at least one or more actions to the constructor.");
            }
            if (!httpContext.User.IsRegistered())
            {
                return(false);
            }

            if (httpContext.User.IsInRole("SystemAdmin"))
            {
                return(true);
            }

            IGstoreDb               db               = RepositoryFactory.StoreFrontRepository(httpContext);
            UserProfile             userProfile      = db.GetCurrentUserProfile(true, true);
            StoreFrontConfiguration storeFrontConfig = db.GetCurrentStoreFrontConfig(httpContext.Request, false, _treatInactiveStoreFrontAsActive);

            if (storeFrontConfig == null)
            {
                //no storefront,
                return(AuthorizationExtensions.Authorization_IsAuthorized(null, userProfile, _allowAnyMatch, _actions.ToArray()));
            }
            return(storeFrontConfig.StoreFront.Authorization_IsAuthorized(userProfile, _allowAnyMatch, _actions.ToArray()));
        }
Esempio n. 10
0
        public ActionResult ShareByEmail(string emailToAddress, string emailToName, string emailFromAddress, string emailFromName, string subject, string message)
        {
            this._logActionsAsPageViews = false;

            Page currentPage = CurrentPageOrThrow;

            CheckAccessAndRedirect();

            if (string.IsNullOrEmpty(emailToAddress))
            {
                return(HttpBadRequest("emailToAddress cannot be blank"));
            }
            if (string.IsNullOrEmpty(emailToName))
            {
                return(HttpBadRequest("emailToName cannot be blank"));
            }
            if (string.IsNullOrEmpty(emailFromAddress))
            {
                return(HttpBadRequest("emailFromAddress cannot be blank"));
            }
            if (string.IsNullOrEmpty(emailFromName))
            {
                return(HttpBadRequest("emailFromName cannot be blank"));
            }

            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;

            string url         = currentPage.UrlResolved(Url, true);
            string textDetails = "\r\n\r\n" + currentPage.PageTitle + "\r\n" + url + "\r\n";
            string htmlDetails = "\r\n\r\n<br/><br/>" + currentPage.PageTitle.ToHtml() + "\r\n<br/><a href=\"" + url + "\">View at " + Request.Url.Host.ToHtml() + "</a>\r\n<br/>";

            subject += " from " + emailFromName + " - " + emailFromAddress + " via " + Request.Url.Host;
            string fromLine = "\r\n\r\nSent to you from " + emailFromName + " - " + emailFromAddress;
            string textBody = message + textDetails + fromLine;
            string htmlBody = message.ToHtml() + htmlDetails + fromLine.ToHtmlLines();

            bool result = this.SendEmail(emailToAddress, emailToName, subject, textBody, htmlBody);

            if (result)
            {
                AddUserMessage("Email Sent!", "We have sent your message to '" + emailToName.ToHtml() + "' &lt;" + emailToAddress.ToHtml() + "&gt;", UserMessageType.Success);
            }
            else
            {
                if (!Settings.AppEnableEmail)
                {
                    AddUserMessage("Email Error", "Sorry, this server does not have email configured to send email to '" + emailToName.ToHtml() + "' &lt;" + emailToAddress.ToHtml() + "&gt;", UserMessageType.Danger);
                }
                else if (!config.Client.UseSendGridEmail)
                {
                    AddUserMessage("Email Error", "Sorry, this site does not have email configured to send email to '" + emailToName.ToHtml() + "' &lt;" + emailToAddress.ToHtml() + "&gt;", UserMessageType.Danger);
                }
                else
                {
                    AddUserMessage("Email Error", "Sorry, there was an unknown error sending your email to '" + emailToName.ToHtml() + "' &lt;" + emailToAddress.ToHtml() + "&gt;", UserMessageType.Danger);
                }
            }

            return(Redirect(currentPage.UrlResolved(Url)));
        }
Esempio n. 11
0
        public ActionResult PaymentInfo()
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;
            Cart cart = config.StoreFront.GetCart(Session.SessionID, CurrentUserProfileOrNull);

            if (!cart.CartIsValidForCheckout(this))
            {
                return(RedirectToAction("Index", "Cart"));
            }

            if (!cart.StatusStartedCheckout)
            {
                return(RedirectToAction("Index"));
            }
            if (!cart.StatusSelectedLogInOrGuest)
            {
                return(RedirectToAction("LogInOrGuest"));
            }

            cart = cart.ValidateCartAndSave(this);

            if (!cart.StatusCompletedDeliveryInfo)
            {
                return(RedirectToAction("DeliveryInfo"));
            }
            if (!cart.StatusSelectedDeliveryMethod)
            {
                return(RedirectToAction("DeliveryMethod"));
            }

            CheckoutPaymentInfoViewModel viewModel = new CheckoutPaymentInfoViewModel(config, cart, RouteData.Action());

            return(View("PaymentInfo", viewModel));
        }
Esempio n. 12
0
 protected override void OnException(ExceptionContext filterContext)
 {
     try
     {
         StoreFrontConfiguration storeFrontConfig = GStoreDb.GetCurrentStoreFrontConfig(Request, true, false);
         if (storeFrontConfig == null)
         {
             AddUserMessage("Store Front Inactive or not found!", "Sorry, this URL does not point to an active store front. Please contact us for assistance.", AppHtmlHelpers.UserMessageType.Danger);
             filterContext.ExceptionHandled = true;
             RedirectToAction("Index", "Home", new { area = "" }).ExecuteResult(this.ControllerContext);
         }
     }
     catch (Exceptions.StoreFrontInactiveException)
     {
         AddUserMessage("Store Front Inactive!", "Sorry, this URL points to an Inactive Store Front. Please contact us for assistance.", AppHtmlHelpers.UserMessageType.Danger);
         filterContext.ExceptionHandled = true;
         RedirectToAction("Index", "Home", new { area = "" }).ExecuteResult(this.ControllerContext);
     }
     catch (Exceptions.NoMatchingBindingException)
     {
         AddUserMessage("Store Front Not Found!", "Sorry, this URL does not point to an active store front. Please contact us for assistance.", AppHtmlHelpers.UserMessageType.Danger);
         filterContext.ExceptionHandled = true;
         RedirectToAction("Index", "Home", new { area = "" }).ExecuteResult(this.ControllerContext);
     }
     catch (Exception)
     {
         throw;
     }
     base.OnException(filterContext);
 }
Esempio n. 13
0
        public ActionResult SeekAndDestroyConfirmed(int id, bool?deleteEventLogs, bool?deleteFolders)
        {
            StoreFront target = GStoreDb.StoreFronts.FindById(id);

            if (target == null)
            {
                //client not found, already deleted? overpost?
                AddUserMessage("Store Front Delete Error!", "Store Front not found Store Front Id: " + id + "<br/>Store Front may have been deleted by another user.", UserMessageType.Danger);
                return(RedirectToAction("Index"));
            }
            StoreFrontConfiguration config = target.CurrentConfigOrAny();

            string name        = config == null ? "id [" + target.StoreFrontId + "]" : config.Name;
            string folder      = config == null ? null : config.Folder;
            string folderToMap = config == null ? null : config.StoreFrontVirtualDirectoryToMap(Request.ApplicationPath);

            try
            {
                string report = SeekAndDestroyChildRecordsNoSave(target, deleteEventLogs ?? true, deleteFolders ?? true);
                AddUserMessage("Seek and Destroy report.", report.ToHtmlLines(), UserMessageType.Info);
                bool deleted = GStoreDb.StoreFronts.DeleteById(id);
                GStoreDb.SaveChangesEx(false, false, false, false);
                if (deleted)
                {
                    AddUserMessage("Store Front Deleted", "Store Front '" + name.ToHtml() + "' [" + id + "] was deleted successfully.", UserMessageType.Success);
                }
            }
            catch (Exception ex)
            {
                AddUserMessage("Store Front Seek and Destroy Error!", "Error with Seek and Destroy for Store Front '" + name.ToHtml() + "' [" + id + "].<br/>This Store Front may have child records.<br/>Exception:" + ex.ToString(), UserMessageType.Danger);
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
        protected void SetMetaTags(ProductBundle bundle)
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;

            _metaDescriptionOverride = bundle.MetaDescriptionOrSystemDefault(config);
            _metaKeywordsOverride    = bundle.MetaKeywordsOrSystemDefault(config);
        }
Esempio n. 15
0
        public CartConfigViewModel(StoreFrontConfiguration storeFrontConfig, bool isEditPage, bool isViewPage)
        {
            this.IsEditPage = isEditPage;
            this.IsViewPage = isViewPage;

            this.StoreFront = storeFrontConfig.StoreFront;
            this.StoreFrontId = storeFrontConfig.StoreFrontId;
            this.StoreFrontConfigurationId = storeFrontConfig.StoreFrontConfigurationId;
            this.ConfigurationName = storeFrontConfig.ConfigurationName;
            this.StoreFrontName = storeFrontConfig.Name;
            this.UseShoppingCart = storeFrontConfig.UseShoppingCart;
            this.CartNavShowCartToAnonymous = storeFrontConfig.CartNavShowCartToAnonymous;
            this.CartNavShowCartToRegistered = storeFrontConfig.CartNavShowCartToRegistered;
            this.CartNavShowCartWhenEmpty = storeFrontConfig.CartNavShowCartWhenEmpty;
            this.CartRequireLogin = storeFrontConfig.CartRequireLogin;
            this.CartTheme = storeFrontConfig.CartTheme;
            this.CartThemeId = storeFrontConfig.CartThemeId;
            this.CartPageTitle = storeFrontConfig.CartPageTitle;
            this.CartPageHeading = storeFrontConfig.CartPageHeading;
            this.CartEmptyMessage = storeFrontConfig.CartEmptyMessage;
            this.CartCheckoutButtonLabel = storeFrontConfig.CartCheckoutButtonLabel;
            this.CartItemColumnLabel = storeFrontConfig.CartItemColumnLabel;
            this.CartItemVariantColumnShow = storeFrontConfig.CartItemVariantColumnShow;
            this.CartItemVariantColumnLabel = storeFrontConfig.CartItemVariantColumnLabel;
            this.CartItemListPriceColumnShow = storeFrontConfig.CartItemListPriceColumnShow;
            this.CartItemListPriceColumnLabel = storeFrontConfig.CartItemListPriceColumnLabel;
            this.CartItemUnitPriceColumnShow = storeFrontConfig.CartItemUnitPriceColumnShow;
            this.CartItemUnitPriceColumnLabel = storeFrontConfig.CartItemUnitPriceColumnLabel;
            this.CartItemQuantityColumnShow = storeFrontConfig.CartItemQuantityColumnShow;
            this.CartItemQuantityColumnLabel = storeFrontConfig.CartItemQuantityColumnLabel;
            this.CartItemListPriceExtColumnShow = storeFrontConfig.CartItemListPriceExtColumnShow;
            this.CartItemListPriceExtColumnLabel = storeFrontConfig.CartItemListPriceExtColumnLabel;
            this.CartItemUnitPriceExtColumnShow = storeFrontConfig.CartItemUnitPriceExtColumnShow;
            this.CartItemUnitPriceExtColumnLabel = storeFrontConfig.CartItemUnitPriceExtColumnLabel;
            this.CartItemDiscountColumnShow = storeFrontConfig.CartItemDiscountColumnShow;
            this.CartItemDiscountColumnLabel = storeFrontConfig.CartItemDiscountColumnLabel;
            this.CartItemTotalColumnShow = storeFrontConfig.CartItemTotalColumnShow;
            this.CartItemTotalColumnLabel = storeFrontConfig.CartItemTotalColumnLabel;
            this.CartBundleShowIncludedItems = storeFrontConfig.CartBundleShowIncludedItems;
            this.CartBundleShowPriceOfIncludedItems = storeFrontConfig.CartBundleShowPriceOfIncludedItems;
            this.CartOrderDiscountCodeSectionShow = storeFrontConfig.CartOrderDiscountCodeSectionShow;
            this.CartOrderDiscountCodeLabel = storeFrontConfig.CartOrderDiscountCodeLabel;
            this.CartOrderDiscountCodeApplyButtonText = storeFrontConfig.CartOrderDiscountCodeApplyButtonText;
            this.CartOrderDiscountCodeRemoveButtonText = storeFrontConfig.CartOrderDiscountCodeRemoveButtonText;
            this.CartOrderItemCountShow = storeFrontConfig.CartOrderItemCountShow;
            this.CartOrderItemCountLabel = storeFrontConfig.CartOrderItemCountLabel;
            this.CartOrderSubtotalShow = storeFrontConfig.CartOrderSubtotalShow;
            this.CartOrderSubtotalLabel = storeFrontConfig.CartOrderSubtotalLabel;
            this.CartOrderTaxShow = storeFrontConfig.CartOrderTaxShow;
            this.CartOrderTaxLabel = storeFrontConfig.CartOrderTaxLabel;
            this.CartOrderShippingShow = storeFrontConfig.CartOrderShippingShow;
            this.CartOrderShippingLabel = storeFrontConfig.CartOrderShippingLabel;
            this.CartOrderHandlingShow = storeFrontConfig.CartOrderHandlingShow;
            this.CartOrderHandlingLabel = storeFrontConfig.CartOrderHandlingLabel;
            this.CartOrderDiscountShow = storeFrontConfig.CartOrderDiscountShow;
            this.CartOrderDiscountLabel = storeFrontConfig.CartOrderDiscountLabel;
            this.CartOrderTotalLabel = storeFrontConfig.CartOrderTotalLabel;
            this.CheckoutOrderMinimum = storeFrontConfig.CheckoutOrderMinimum;
        }
Esempio n. 16
0
        public CartConfigViewModel(StoreFrontConfiguration storeFrontConfig, bool isEditPage, bool isViewPage)
        {
            this.IsEditPage = isEditPage;
            this.IsViewPage = isViewPage;

            this.StoreFront   = storeFrontConfig.StoreFront;
            this.StoreFrontId = storeFrontConfig.StoreFrontId;
            this.StoreFrontConfigurationId   = storeFrontConfig.StoreFrontConfigurationId;
            this.ConfigurationName           = storeFrontConfig.ConfigurationName;
            this.StoreFrontName              = storeFrontConfig.Name;
            this.UseShoppingCart             = storeFrontConfig.UseShoppingCart;
            this.CartNavShowCartToAnonymous  = storeFrontConfig.CartNavShowCartToAnonymous;
            this.CartNavShowCartToRegistered = storeFrontConfig.CartNavShowCartToRegistered;
            this.CartNavShowCartWhenEmpty    = storeFrontConfig.CartNavShowCartWhenEmpty;
            this.CartRequireLogin            = storeFrontConfig.CartRequireLogin;
            this.CartTheme                             = storeFrontConfig.CartTheme;
            this.CartThemeId                           = storeFrontConfig.CartThemeId;
            this.CartPageTitle                         = storeFrontConfig.CartPageTitle;
            this.CartPageHeading                       = storeFrontConfig.CartPageHeading;
            this.CartEmptyMessage                      = storeFrontConfig.CartEmptyMessage;
            this.CartCheckoutButtonLabel               = storeFrontConfig.CartCheckoutButtonLabel;
            this.CartItemColumnLabel                   = storeFrontConfig.CartItemColumnLabel;
            this.CartItemVariantColumnShow             = storeFrontConfig.CartItemVariantColumnShow;
            this.CartItemVariantColumnLabel            = storeFrontConfig.CartItemVariantColumnLabel;
            this.CartItemListPriceColumnShow           = storeFrontConfig.CartItemListPriceColumnShow;
            this.CartItemListPriceColumnLabel          = storeFrontConfig.CartItemListPriceColumnLabel;
            this.CartItemUnitPriceColumnShow           = storeFrontConfig.CartItemUnitPriceColumnShow;
            this.CartItemUnitPriceColumnLabel          = storeFrontConfig.CartItemUnitPriceColumnLabel;
            this.CartItemQuantityColumnShow            = storeFrontConfig.CartItemQuantityColumnShow;
            this.CartItemQuantityColumnLabel           = storeFrontConfig.CartItemQuantityColumnLabel;
            this.CartItemListPriceExtColumnShow        = storeFrontConfig.CartItemListPriceExtColumnShow;
            this.CartItemListPriceExtColumnLabel       = storeFrontConfig.CartItemListPriceExtColumnLabel;
            this.CartItemUnitPriceExtColumnShow        = storeFrontConfig.CartItemUnitPriceExtColumnShow;
            this.CartItemUnitPriceExtColumnLabel       = storeFrontConfig.CartItemUnitPriceExtColumnLabel;
            this.CartItemDiscountColumnShow            = storeFrontConfig.CartItemDiscountColumnShow;
            this.CartItemDiscountColumnLabel           = storeFrontConfig.CartItemDiscountColumnLabel;
            this.CartItemTotalColumnShow               = storeFrontConfig.CartItemTotalColumnShow;
            this.CartItemTotalColumnLabel              = storeFrontConfig.CartItemTotalColumnLabel;
            this.CartBundleShowIncludedItems           = storeFrontConfig.CartBundleShowIncludedItems;
            this.CartBundleShowPriceOfIncludedItems    = storeFrontConfig.CartBundleShowPriceOfIncludedItems;
            this.CartOrderDiscountCodeSectionShow      = storeFrontConfig.CartOrderDiscountCodeSectionShow;
            this.CartOrderDiscountCodeLabel            = storeFrontConfig.CartOrderDiscountCodeLabel;
            this.CartOrderDiscountCodeApplyButtonText  = storeFrontConfig.CartOrderDiscountCodeApplyButtonText;
            this.CartOrderDiscountCodeRemoveButtonText = storeFrontConfig.CartOrderDiscountCodeRemoveButtonText;
            this.CartOrderItemCountShow                = storeFrontConfig.CartOrderItemCountShow;
            this.CartOrderItemCountLabel               = storeFrontConfig.CartOrderItemCountLabel;
            this.CartOrderSubtotalShow                 = storeFrontConfig.CartOrderSubtotalShow;
            this.CartOrderSubtotalLabel                = storeFrontConfig.CartOrderSubtotalLabel;
            this.CartOrderTaxShow                      = storeFrontConfig.CartOrderTaxShow;
            this.CartOrderTaxLabel                     = storeFrontConfig.CartOrderTaxLabel;
            this.CartOrderShippingShow                 = storeFrontConfig.CartOrderShippingShow;
            this.CartOrderShippingLabel                = storeFrontConfig.CartOrderShippingLabel;
            this.CartOrderHandlingShow                 = storeFrontConfig.CartOrderHandlingShow;
            this.CartOrderHandlingLabel                = storeFrontConfig.CartOrderHandlingLabel;
            this.CartOrderDiscountShow                 = storeFrontConfig.CartOrderDiscountShow;
            this.CartOrderDiscountLabel                = storeFrontConfig.CartOrderDiscountLabel;
            this.CartOrderTotalLabel                   = storeFrontConfig.CartOrderTotalLabel;
            this.CheckoutOrderMinimum                  = storeFrontConfig.CheckoutOrderMinimum;
        }
Esempio n. 17
0
 public static string MetaKeywordsOrSystemDefault(this BlogEntry entry, StoreFrontConfiguration config)
 {
     if (!string.IsNullOrEmpty(entry.MetaKeywords))
     {
         return(entry.MetaKeywords);
     }
     return(entry.Blog.MetaKeywordsOrSystemDefault(config));
 }
Esempio n. 18
0
 public static Theme ThemeOrSystemDefault(this BlogEntry blogEntry, StoreFrontConfiguration config)
 {
     if (blogEntry.Theme != null)
     {
         return(blogEntry.Theme);
     }
     return(blogEntry.Blog.ThemeOrSystemDefault(config));
 }
Esempio n. 19
0
        protected void SetMetaTagsAndTheme(BlogEntry entry)
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;

            _metaDescriptionOverride = entry.MetaDescriptionOrSystemDefault(config);
            _metaKeywordsOverride    = entry.MetaKeywordsOrSystemDefault(config);
            ViewData.Theme(entry.ThemeOrSystemDefault(config));
        }
Esempio n. 20
0
 public CheckoutDeliveryMethodShippingViewModel(StoreFrontConfiguration config, Cart cart, string currentAction) : base(config, cart, currentAction)
 {
     if (cart.DeliveryInfoShipping == null)
     {
         throw new ArgumentNullException("cart.DeliveryInfoShipping");
     }
     this.ShippingDeliveryMethod = cart.DeliveryInfoShipping.ShippingDeliveryMethod;
 }
Esempio n. 21
0
 public static string MetaKeywordsOrSystemDefault(this Blog blog, StoreFrontConfiguration config)
 {
     if (!string.IsNullOrEmpty(blog.DefaultMetaKeywords))
     {
         return(blog.DefaultMetaKeywords);
     }
     return(config.MetaKeywords);
 }
Esempio n. 22
0
 public GStoreEFDbContext(string userName, StoreFront cachedStoreFront, StoreFrontConfiguration cachedstoreFrontConfig, UserProfile cachedUserProfile)
     : base("name=GStoreWeb.Properties.Settings.GStoreDB")
 {
     this.UserName               = userName;
     this.CachedStoreFront       = cachedStoreFront;
     this.CachedStoreFrontConfig = cachedstoreFrontConfig;
     this.CachedUserProfile      = cachedUserProfile;
 }
Esempio n. 23
0
 public static bool UserExists(StoreFrontConfiguration config, string name)
 {
     if (_userList.Any(u => u.StoreFrontConfigurationId == config.StoreFrontConfigurationId && u.Name.ToLower() == name.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 24
0
 public static string StoreFrontGroupName(StoreFrontConfiguration config)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     return("[" + storeFrontGroupPrefix + config.StoreFrontConfigurationId + "]");
 }
 public NavBarItemManagerAdminViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, IOrderedQueryable<NavBarItem> navBarItems)
     : base(storeFrontConfig, userProfile)
 {
     this.NavBarItems = navBarItems;
     if (navBarItems != null)
     {
         this.NavBarItemEditViewModels = navBarItems.Select(nb => new NavBarItemEditAdminViewModel(nb, userProfile)).ToList();
     }
 }
Esempio n. 26
0
        /// <summary>
        /// saves form data to database, is isRegisterPage = true, also updates user profile
        /// </summary>
        /// <param name="db"></param>
        /// <param name="modelStateDictionary"></param>
        /// <param name="webForm"></param>
        /// <param name="page"></param>
        /// <param name="userProfile"></param>
        /// <param name="request"></param>
        /// <param name="storeFrontConfiguration"></param>
        /// <param name="formSubject"></param>
        /// <param name="formBodyText"></param>
        /// <param name="isRegisterPage"></param>
        /// <returns></returns>
        private static WebFormResponse ProcessWebForm_ToDatabase(BaseController controller, WebForm webForm, Page page, string formSubject, string formBodyText, bool isRegisterPage, WebFormResponse oldResponseToUpdateOrNull)
        {
            if (controller == null)
            {
                throw new ArgumentNullException("controller");
            }
            IGstoreDb               db                      = controller.GStoreDb;
            UserProfile             userProfile             = controller.CurrentUserProfileOrNull;
            StoreFrontConfiguration storeFrontConfiguration = controller.CurrentStoreFrontConfigOrThrow;

            WebFormResponse webFormResponse = null;

            if (oldResponseToUpdateOrNull == null)
            {
                webFormResponse = db.WebFormResponses.Create();
                webFormResponse.SetDefaults(userProfile);
            }
            else
            {
                webFormResponse = oldResponseToUpdateOrNull;
            }
            webFormResponse.StoreFrontId     = storeFrontConfiguration.StoreFrontId;
            webFormResponse.StoreFront       = storeFrontConfiguration.StoreFront;
            webFormResponse.ClientId         = storeFrontConfiguration.ClientId;
            webFormResponse.Client           = storeFrontConfiguration.Client;
            webFormResponse.PageId           = (page == null ? null : (int?)page.PageId);
            webFormResponse.Page             = page;
            webFormResponse.WebFormId        = webForm.WebFormId;
            webFormResponse.WebForm          = webForm;
            webFormResponse.IsPending        = false;
            webFormResponse.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            webFormResponse.EndDateTimeUtc   = DateTime.UtcNow.AddYears(100);
            webFormResponse.BodyText         = formBodyText;
            webFormResponse.Subject          = formSubject;

            FillWebFormResponses(controller, webFormResponse, webForm, oldResponseToUpdateOrNull);

            if (oldResponseToUpdateOrNull == null)
            {
                webFormResponse = db.WebFormResponses.Add(webFormResponse);
            }
            else
            {
                webFormResponse = db.WebFormResponses.Update(oldResponseToUpdateOrNull);
            }
            db.SaveChanges();

            if (isRegisterPage && (userProfile != null))
            {
                userProfile.RegisterWebFormResponseId = webFormResponse.WebFormResponseId;
                db.UserProfiles.Update(userProfile);
                db.SaveChangesDirect();
            }

            //for checkout page and other pages return object
            return(webFormResponse);
        }
Esempio n. 27
0
 public NavBarItemManagerAdminViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, IOrderedQueryable <NavBarItem> navBarItems)
     : base(storeFrontConfig, userProfile)
 {
     this.NavBarItems = navBarItems;
     if (navBarItems != null)
     {
         this.NavBarItemEditViewModels = navBarItems.Select(nb => new NavBarItemEditAdminViewModel(nb, userProfile)).ToList();
     }
 }
Esempio n. 28
0
        /// <summary>
        /// Returns true if store front and client (parent record) are both active
        /// </summary>
        /// <param name="storeFront"></param>
        /// <returns></returns>
        public static bool IsActiveBubble(this StoreFrontConfiguration storeFrontConfig)
        {
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }

            return(storeFrontConfig.IsActiveDirect() && storeFrontConfig.StoreFront.IsActiveBubble());
        }
Esempio n. 29
0
        private static void RenderCatalogPartialHelper(this HtmlHelper <CatalogViewModel> htmlHelper, string view, ViewDataDictionary <CatalogViewModel> newViewDataOrNull, bool addLayoutFolder = false)
        {
            if (htmlHelper.ViewData.Model == null)
            {
                throw new ArgumentNullException("htmlHelper.ViewData.Model");
            }

            StoreFrontConfiguration config = htmlHelper.CurrentStoreFrontConfig(false);

            if (config == null)
            {
                throw new ArgumentNullException("htmlHelper.CurrentStoreFrontConfig");
            }

            string partialViewPath = view;

            if (addLayoutFolder)
            {
                partialViewPath = config.CatalogLayout.ToString() + "/" + view;
            }

            if (config == null)
            {
                throw new ApplicationException("Current store front config not find to display catalog view '" + view + "'");
            }

            try
            {
                //catalog display
                if (newViewDataOrNull == null)
                {
                    htmlHelper.RenderPartial(partialViewPath, htmlHelper.ViewData.Model);
                }
                else
                {
                    htmlHelper.RenderPartial(partialViewPath, newViewDataOrNull);
                }
            }
            catch (Exception ex)
            {
                string errorMsg = "Error rendering catalog partial view '" + partialViewPath + "' for catalog layout '" + config.CatalogLayout.ToString() + "'" + "\n\n" + ex.Message;

                if (ex.InnerException != null)
                {
                    errorMsg += "\nInner Exception: " + ex.InnerException.GetType().FullName + " " + ex.InnerException.Message;
                    if (ex.InnerException.InnerException != null)
                    {
                        errorMsg += "\n2nd Inner Exception: " + ex.InnerException.InnerException.GetType().FullName + " " + ex.InnerException.InnerException.Message;
                        if (ex.InnerException.InnerException.InnerException != null)
                        {
                            errorMsg += "\n3rd Inner Exception: " + ex.InnerException.InnerException.InnerException.GetType().FullName + " " + ex.InnerException.InnerException.InnerException.Message;
                        }
                    }
                }
                throw new ApplicationException(errorMsg, ex);
            }
        }
Esempio n. 30
0
        protected bool NameIsTaken(StoreFrontConfiguration config, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return(true);
            }

            return(Hubs.ChatHub.UserExists(config, "[" + name + "]"));
        }
Esempio n. 31
0
        public ActionResult ConfirmOrder(CheckoutConfirmOrderViewModel viewModel)
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;
            Cart cart = config.StoreFront.GetCart(Session.SessionID, CurrentUserProfileOrNull);

            if (!cart.CartIsValidForCheckout(this))
            {
                return(RedirectToAction("Index", "Cart"));
            }

            if (!cart.StatusStartedCheckout)
            {
                return(RedirectToAction("Index"));
            }
            if (!cart.StatusSelectedLogInOrGuest)
            {
                return(RedirectToAction("LogInOrGuest"));
            }

            cart = cart.ValidateCartAndSave(this);

            if (!cart.StatusCompletedDeliveryInfo)
            {
                return(RedirectToAction("DeliveryInfo"));
            }
            if (!cart.StatusSelectedDeliveryMethod)
            {
                return(RedirectToAction("DeliveryMethod"));
            }
            if (!cart.StatusPaymentInfoConfirmed)
            {
                return(RedirectToAction("PaymentInfo"));
            }

            if (config.CheckoutConfirmOrderWebForm != null)
            {
                FormProcessorExtensions.ValidateFields(this, config.CheckoutConfirmOrderWebForm);
            }

            if (ModelState.IsValid)
            {
                WebFormResponse webFormResponse = cart.ConfirmOrderProcessWebForm(this);
                if (webFormResponse != null)
                {
                    cart.ConfirmOrderWebFormResponseId = webFormResponse.WebFormResponseId;
                    GStoreDb.Carts.Update(cart);
                    GStoreDb.SaveChanges();
                }

                return(cart.ProcessOrderAndPayment(this));
            }

            viewModel.UpdateForRepost(config, cart, RouteData.Action());
            return(View("ConfirmOrder", viewModel));
        }
Esempio n. 32
0
        public ActionResult LogInOrGuest(bool?ContinueAsGuest, bool?ContinueAsLogin)
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;
            Cart cart = config.StoreFront.GetCart(Session.SessionID, CurrentUserProfileOrNull);

            if (!cart.CartIsValidForCheckout(this))
            {
                return(RedirectToAction("Index", "Cart"));
            }

            if (!cart.StatusStartedCheckout)
            {
                return(RedirectToAction("Index"));
            }

            cart = cart.ValidateCartAndSave(this);

            if (ContinueAsGuest ?? false)
            {
                if (!cart.StatusSelectedLogInOrGuest)
                {
                    cart.StatusSelectedLogInOrGuest = true;
                    GStoreDb.Carts.Update(cart);
                    GStoreDb.SaveChanges();

                    GStoreDb.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Checkout, UserActionActionEnum.Checkout_SelectedLogInOrGuest, "", true, cartId: cart.CartId);
                    return(RedirectToAction("DeliveryInfo"));
                }
            }

            UserProfile profile = CurrentUserProfileOrNull;

            if ((ContinueAsLogin ?? false) && (profile != null))
            {
                cart.StatusSelectedLogInOrGuest = true;
                GStoreDb.Carts.Update(cart);
                GStoreDb.SaveChanges();

                GStoreDb.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Checkout, UserActionActionEnum.Checkout_SelectedLogInOrGuest, "", true, cartId: cart.CartId);
                return(RedirectToAction("DeliveryInfo"));
            }

            if (profile != null)
            {
                cart.StatusSelectedLogInOrGuest = true;
                GStoreDb.Carts.Update(cart);
                GStoreDb.SaveChanges();

                return(RedirectToAction("DeliveryInfo"));
            }

            CheckoutLogInOrGuestViewModel viewModel = new CheckoutLogInOrGuestViewModel(config, cart, RouteData.Action());

            return(View("LogInOrGuest", viewModel));
        }
Esempio n. 33
0
 public CatalogAdminViewModel(StoreFrontConfiguration currentStoreFrontConfig, UserProfile userProfile)
 {
     if (currentStoreFrontConfig == null)
     {
         throw new ApplicationException("CatalogAdminMenuViewModel: currentStoreFrontConfig is null, currentStoreFrontConfig must be specified.");
     }
     if (userProfile == null)
     {
         throw new ApplicationException("CatalogAdminMenuViewModel: userProfile is null, UserProfile must be specified.");
     }
     this.StoreFrontConfig = currentStoreFrontConfig;
     this.StoreFront = currentStoreFrontConfig.StoreFront;
     this.UserProfile = userProfile;
     this.Client = currentStoreFrontConfig.Client;
 }
        public ClientConfigManagerAdminViewModel(Client currentClient, StoreFrontConfiguration currentStoreFrontConfig, UserProfile userProfile)
            : base(currentStoreFrontConfig, userProfile)
        {
            if (currentClient == null)
            {
                throw new ArgumentNullException("currentClient");
            }
            if (currentStoreFrontConfig == null)
            {
                throw new ArgumentNullException("currentStoreFrontConfig");
            }

            this.CurrentClient = currentClient;
            this.CurrentStoreFrontConfig = currentStoreFrontConfig;
            this.CurrentStoreFront = currentStoreFrontConfig.StoreFront;
        }
Esempio n. 35
0
        /// <summary>
        /// this constructor will internally call functions to create the navbar tree and category tree for menus
        /// </summary>
        /// <param name="storeFrontConfig"></param>
        /// <param name="userProfile"></param>
        /// <param name="sessionId"></param>
        public MenuViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, string sessionId, long? chatUserCount)
        {
            bool isRegistered = false;
            if (userProfile != null)
            {
                isRegistered = true;
            }

            this.StoreFront = (storeFrontConfig == null ? null : storeFrontConfig.StoreFront);
            this.StoreFrontConfig = storeFrontConfig;
            this.CategoryTree = this.StoreFront.CategoryTreeWhereActiveForNavBar(isRegistered);
            this.NavBarItemTree = this.StoreFront.NavBarTreeWhereActive(isRegistered);
            this.UserProfile = userProfile;

            this.ShowAboutGStore = true;
            if (storeFrontConfig != null && (!storeFrontConfig.ShowAboutGStoreMenu))
            {
                this.ShowAboutGStore = false;
            }

            ChatUserCount = chatUserCount;
            this.ShowBlog = false;
            if ((storeFrontConfig != null) && storeFrontConfig.ShowBlogInMenu)
            {
                this.ShowBlog = true;
            }

            this.ShowChat = false;
            if (Settings.AppEnableChat && (storeFrontConfig != null) && (storeFrontConfig.ChatEnabled))
            {
                this.ShowChat = true;
            }

            this.ShowCart = false;
            if ((storeFrontConfig != null) && (storeFrontConfig.UseShoppingCart))
            {
                this.Cart = this.StoreFront.GetCart(sessionId, userProfile);
                if (userProfile == null && storeFrontConfig.CartNavShowCartToAnonymous)
                {
                    this.ShowCart = (storeFrontConfig.CartNavShowCartWhenEmpty || Cart.ItemCount > 0);
                }
                else if (userProfile != null && storeFrontConfig.CartNavShowCartToRegistered)
                {
                    this.ShowCart = (storeFrontConfig.CartNavShowCartWhenEmpty || Cart.ItemCount > 0);
                }
            }
        }
 public ClientConfigAdminViewModel(Client client, StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, string activeTab)
     : base(storeFrontConfig, userProfile)
 {
     this.ActiveTab = activeTab;
     this.ClientId = client.ClientId;
     this.EnableNewUserRegisteredBroadcast = client.EnableNewUserRegisteredBroadcast;
     this.EnablePageViewLog = client.EnablePageViewLog;
     this.Name = client.Name;
     this.TimeZoneId = client.TimeZoneId;
     this.SendGridMailAccount = client.SendGridMailAccount;
     this.SendGridMailFromEmail = client.SendGridMailFromEmail;
     this.SendGridMailFromName = client.SendGridMailFromName;
     this.SendGridMailPassword = client.SendGridMailPassword;
     this.TwilioFromPhone = client.TwilioFromPhone;
     this.TwilioSid = client.TwilioSid;
     this.TwilioSmsFromEmail = client.TwilioSmsFromEmail;
     this.TwilioSmsFromName = client.TwilioSmsFromName;
     this.TwilioToken = client.TwilioToken;
     this.UseSendGridEmail = client.UseSendGridEmail;
     this.UseTwilioSms = client.UseTwilioSms;
 }
Esempio n. 37
0
        /// <summary>
        /// this constructor will use parameters passed in for navbar tree and category tree for menus
        /// </summary>
        /// <param name="storeFrontConfig"></param>
        /// <param name="categoryTree"></param>
        /// <param name="navBarItemTree"></param>
        /// <param name="userProfile"></param>
        /// <param name="sessionId"></param>
        public MenuViewModel(StoreFrontConfiguration storeFrontConfig, List<TreeNode<ProductCategory>> categoryTree, List<TreeNode<NavBarItem>> navBarItemTree, UserProfile userProfile, string sessionId)
        {
            this.StoreFront = (storeFrontConfig == null ? null : storeFrontConfig.StoreFront);
            this.CategoryTree = categoryTree;
            this.NavBarItemTree = navBarItemTree;
            this.UserProfile = userProfile;

            this.ShowCart = false;
            if ((storeFrontConfig != null) && (storeFrontConfig.UseShoppingCart))
            {
                this.Cart = this.StoreFront.GetCart(sessionId, userProfile);
                if (userProfile == null && storeFrontConfig.CartNavShowCartToAnonymous)
                {
                    this.ShowCart = (storeFrontConfig.CartNavShowCartWhenEmpty || Cart.ItemCount > 0);
                }
                else if (userProfile != null && storeFrontConfig.CartNavShowCartToRegistered)
                {
                    this.ShowCart = (storeFrontConfig.CartNavShowCartWhenEmpty || Cart.ItemCount > 0);
                }
            }
        }
Esempio n. 38
0
 public static string ReceiptSubject(this Order order, StoreFrontConfiguration config)
 {
     if (order == null)
     {
         throw new ArgumentNullException("order");
     }
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     return "Your Order #" + order.OrderNumber + " at " + config.Name + " - " + config.PublicUrl;
 }
Esempio n. 39
0
 public CheckoutConfirmOrderViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
 }
Esempio n. 40
0
 public CheckoutDeliveryMethodShippingViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
     if (cart.DeliveryInfoShipping == null)
     {
         throw new ArgumentNullException("cart.DeliveryInfoShipping");
     }
     this.ShippingDeliveryMethod = cart.DeliveryInfoShipping.ShippingDeliveryMethod;
 }
Esempio n. 41
0
        protected bool NameIsTaken(StoreFrontConfiguration config, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                return true;
            }

            return Hubs.ChatHub.UserExists(config, "[" + name + "]");
        }
Esempio n. 42
0
        public static StoreBinding CreateSeedStoreBindingToCurrentUrl(this IGstoreDb storeDb, StoreFrontConfiguration storeFrontConfig)
        {
            StoreBinding storeBinding = storeDb.StoreBindings.Create();
            storeBinding.ClientId = storeFrontConfig.ClientId;
            storeBinding.StoreFrontId = storeFrontConfig.StoreFrontId;
            storeBinding.StoreFrontConfigurationId = storeFrontConfig.StoreFrontConfigurationId;
            storeBinding.IsPending = false;
            storeBinding.StartDateTimeUtc = DateTime.UtcNow.AddSeconds(-1);
            storeBinding.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);
            storeBinding.RootPath = "/";
            storeBinding.Order = 9000;
            if (HttpContext.Current == null)
            {
                storeBinding.HostName = "*";
                storeBinding.Port = 0;
                storeBinding.RootPath = "*";
            }
            else
            {
                Uri url = HttpContext.Current.Request.Url;
                storeBinding.HostName = url.Host;
                storeBinding.Port = (url.IsDefaultPort ? 80 : (int?)url.Port);
                storeBinding.RootPath = HttpContext.Current.Request.ApplicationPath;
                storeBinding.UseUrlStoreName = (!string.IsNullOrEmpty(HttpContext.Current.Request.RequestContext.RouteData.UrlStoreName()));
                storeBinding.UrlStoreName = HttpContext.Current.Request.RequestContext.RouteData.UrlStoreName();
            }
            storeDb.StoreBindings.Add(storeBinding);
            storeDb.SaveChangesEx(true, false, false, false);

            return storeBinding;
        }
Esempio n. 43
0
        /// <summary>
        /// Dupe-safe CreateSeedPage, CreateSeedNavBarItemForPage, CreateSeedWebFormContactUs, CreateSeedWebFormRegister, are all dupe-safe
        /// </summary>
        private static void CreateSeedPagesHelper(this IGstoreDb storeDb, StoreFrontConfiguration storeFrontConfig)
        {
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }

            List<PageTemplate> templates = storeFrontConfig.Client.PageTemplates.ToList();
            if (templates.Count == 0)
            {
                throw new ApplicationException("No page templates found for this client. Be sure to seed database of load templates in sys admin client edit.");
            }

            PageTemplate defaultTemplate = templates.FirstOrDefault(pt => pt.ViewName.ToLower() == Settings.AppDefaultPageTemplateViewName.ToLower());
            if (defaultTemplate == null)
            {
                defaultTemplate = templates.FirstOrDefault(pt => pt.ViewName.ToLower() == "page simple welcome");
            }
            if (defaultTemplate == null)
            {
                defaultTemplate = templates.First();
            }

            PageTemplate homeTemplate = null;
            if (templates.Any(pt => pt.ViewName.ToLower() == "page simple welcome"))
            {
                homeTemplate = templates.Single(pt => pt.ViewName.ToLower() == "page simple welcome");
            }
            else
            {
                homeTemplate = defaultTemplate;
            }
            string homeUrl = "/";
            if (storeFrontConfig.HomePageUseCatalog)
            {
                //no home page if catalog is home
            }
            else if (storeFrontConfig.HomePageUseBlog)
            {
                //no home page if catalog is home
            }
            else
            {
                Page homePage = storeDb.CreateSeedPage("New Home Page", string.Empty, homeUrl, 100, storeFrontConfig, homeTemplate, true);
                NavBarItem homeLink = storeDb.CreateSeedNavBarItemForPage("Home", homePage.PageId, false, null, storeFrontConfig.StoreFront, true);
            }

            PageTemplate contactUsTemplate = null;
            if (templates.Any(pt => pt.ViewName.ToLower() == "page simple contact us"))
            {
                contactUsTemplate = templates.Single(pt => pt.ViewName.ToLower() == "page simple contact us");
            }
            else
            {
                contactUsTemplate = defaultTemplate;
            }
            Page contactUsPage = storeDb.CreateSeedPage("Contact Us", "Contact Us", "/Contact", 200, storeFrontConfig, contactUsTemplate, true);
            NavBarItem contactUsLink = storeDb.CreateSeedNavBarItemForPage("Contact Us", contactUsPage.PageId, false, null, storeFrontConfig.StoreFront, true);

            PageTemplate locationTemplate = null;
            if (templates.Any(pt => pt.ViewName.ToLower() == "page simple location"))
            {
                locationTemplate = templates.Single(pt => pt.ViewName.ToLower() == "page simple location");
            }
            else
            {
                locationTemplate = defaultTemplate;
            }
            Page locationPage = storeDb.CreateSeedPage("Location", "Location", "/Location", 300, storeFrontConfig, locationTemplate, true);
            NavBarItem locationLink = storeDb.CreateSeedNavBarItemForPage("Location", locationPage.PageId, false, null, storeFrontConfig.StoreFront, true);

            PageTemplate answersTemplate = null;
            if (templates.Any(pt => pt.ViewName.ToLower() == "page simple answers"))
            {
                answersTemplate = templates.Single(pt => pt.ViewName.ToLower() == "page simple answers");
            }
            else
            {
                answersTemplate = defaultTemplate;
            }
            Page answersPage = storeDb.CreateSeedPage("Answers", "Answers", "/Answers", 400, storeFrontConfig, answersTemplate, true);
            NavBarItem answersLink = storeDb.CreateSeedNavBarItemForPage("Questions?", answersPage.PageId, false, null, storeFrontConfig.StoreFront, true);

            PageTemplate aboutUsTemplate = null;
            if (templates.Any(pt => pt.ViewName.ToLower() == "page simple about us"))
            {
                aboutUsTemplate = templates.Single(pt => pt.ViewName.ToLower() == "page simple about us");
            }
            else
            {
                aboutUsTemplate = defaultTemplate;
            }
            Page aboutUsPage = storeDb.CreateSeedPage("About Us", "About Us", "/About", 500, storeFrontConfig, aboutUsTemplate, true);
            NavBarItem aboutLink = storeDb.CreateSeedNavBarItemForPage("About Us", aboutUsPage.PageId, false, null, storeFrontConfig.StoreFront, true);

            WebForm contactForm = storeDb.CreateSeedWebFormContactUs(storeFrontConfig.Client, true);
            WebForm registerWebForm = storeDb.CreateSeedWebFormRegister(storeFrontConfig.Client, true);

            if (!contactUsPage.WebFormId.HasValue)
            {
                contactUsPage.WebForm = contactForm;
                contactUsPage.WebFormId = contactForm.WebFormId;
                contactUsPage.WebFormSaveToDatabase = true;
                contactUsPage.WebFormSaveToFile = true;
                contactUsPage = storeDb.Pages.Update(contactUsPage);
                storeDb.SaveChangesEx(true, false, false, false);
            }

            if (!storeFrontConfig.Register_WebFormId.HasValue)
            {
                storeFrontConfig.Register_WebFormId = registerWebForm.WebFormId;
                storeFrontConfig.RegisterWebForm = registerWebForm;
                storeFrontConfig = storeDb.StoreFrontConfigurations.Update(storeFrontConfig);
                storeDb.SaveChangesEx(true, false, false, false);
            }
        }
Esempio n. 44
0
        public static void CreateDigitalDownloadErrorNotificationToOrderAdminAndSave(this IGstoreDb db, StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, OrderItem orderItem, UrlHelper urlHelper, string errorMessage)
        {
            //user profile is null if user purchased as a guest
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            if (orderItem == null)
            {
                throw new ArgumentNullException("orderItem");
            }
            if (urlHelper == null)
            {
                throw new ArgumentNullException("urlHelper");
            }

            Uri currentUrl = urlHelper.RequestContext.HttpContext.Request.Url;
            string orderAdminUrl = urlHelper.Action("View", "Orders", new { area = "OrderAdmin", id = orderItem.Order.OrderNumber });
            string userViewOrderStatusUrl = urlHelper.Action("View", "OrderStatus", new { area = "", id = orderItem.Order.OrderNumber, Email = orderItem.Order.Email });

            UserProfile orderAdmin = storeFrontConfig.OrderAdmin;
            Notification notification = db.Notifications.Create();

            notification.StoreFront = storeFrontConfig.StoreFront;
            notification.StoreFront = storeFrontConfig.StoreFront;
            notification.ClientId = storeFrontConfig.ClientId;
            notification.Client = storeFrontConfig.Client;
            notification.From = "GStore Order Admin";
            notification.FromUserProfileId = orderAdmin.UserProfileId;
            notification.OrderId = orderItem.OrderId;

            notification.ToUserProfileId = orderAdmin.UserProfileId;
            notification.To = orderAdmin.FullName;

            notification.Importance = "High";
            notification.Subject = "Digital Download Error! with Order #" + orderItem.Order.OrderNumber + " on " + currentUrl.Host + " at " + DateTime.UtcNow.ToStoreDateTimeString(storeFrontConfig, storeFrontConfig.Client);

            notification.UrlHost = currentUrl.Host;
            if (!currentUrl.IsDefaultPort)
            {
                notification.UrlHost += ":" + currentUrl.Port;
            }
            notification.BaseUrl = urlHelper.Action("Details", "Notifications", new { area = "", id = "" });
            notification.Message = notification.Subject
                + "\n\nError: " + errorMessage
                + "\nStore Front: " + storeFrontConfig.Name + " [" + storeFrontConfig.StoreFrontId + "]"
                + "\nClient: " + orderItem.Client.Name + " [" + orderItem.ClientId + "]"
                + "\n\nOrder Number: " + orderItem.Order.OrderNumber
                + "\nOrder Date/Time: " + orderItem.CreateDateTimeUtc.ToStoreDateTimeString(storeFrontConfig, storeFrontConfig.Client)
                + "\nOrder User: "******"(guest)" : orderItem.Order.UserProfile.FullName + " <" + orderItem.Order.UserProfile.Email + "> [" + orderItem.Order.UserProfileId + "]")
                + "\nOrder Email: " + orderItem.Order.Email;

            notification.Message = notification.Message.ToHtmlLines();

            notification.IsPending = false;
            notification.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            notification.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);

            List<NotificationLink> links = new List<NotificationLink>();

            NotificationLink link1 = db.NotificationLinks.Create();

            link1.SetDefaultsForNew(notification);
            link1.Order = 1;
            link1.LinkText = "Admin Order #" + orderItem.Order.OrderNumber;
            link1.Url = orderAdminUrl;
            link1.IsExternal = false;
            links.Add(link1);

            NotificationLink link2 = db.NotificationLinks.Create();
            link2.SetDefaultsForNew(notification);
            link2.Order = 2;
            link2.LinkText = "Order Status Link for User";
            link2.Url = userViewOrderStatusUrl;
            link2.IsExternal = false;
            links.Add(link2);

            notification.NotificationLinks = links;
            db.Notifications.Add(notification);

            db.SaveChanges();
        }
Esempio n. 45
0
 public CheckoutViewModelBase(StoreFrontConfiguration config, Cart cart, string currentAction)
 {
     this.CurrentAction = currentAction;
     this.Config = config;
     this.Cart = cart;
 }
Esempio n. 46
0
 public void UpdateForRepost(StoreFrontConfiguration config, Cart cart, string currentAction)
 {
     this.Config = config;
     this.Cart = cart;
     this.CurrentAction = currentAction;
 }
Esempio n. 47
0
 public CheckoutDeliveryInfoDigitalOnlyViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
     this.EmailAddress = cart.Email;
     this.FullName = cart.FullName;
 }
Esempio n. 48
0
 public CheckoutDeliveryInfoShippingViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
     this.EmailAddress = cart.Email;
     if (cart.DeliveryInfoShipping != null)
     {
         DeliveryInfoShipping info = cart.DeliveryInfoShipping;
         this.EmailAddress = info.EmailAddress;
         this.FullName = info.FullName;
         this.AdddressL1 = info.AdddressL1;
         this.AdddressL2 = info.AdddressL2;
         this.City = info.City;
         this.State = info.State;
         this.PostalCode = info.PostalCode;
         this.CountryCode = info.CountryCode;
     }
     else if (cart.UserProfile != null)
     {
         this.FullName = cart.UserProfile.FullName;
         this.AdddressL1 = cart.UserProfile.AddressLine1;
         this.AdddressL2 = cart.UserProfile.AddressLine2;
         this.City = cart.UserProfile.City;
         this.State = cart.UserProfile.State;
         this.PostalCode = cart.UserProfile.PostalCode;
         this.CountryCode = cart.UserProfile.CountryCode;
     }
 }
Esempio n. 49
0
        public static void SetDefaultsForNew(this Page page, StoreFrontConfiguration storeFrontConfig)
        {
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            StoreFront storeFront = storeFrontConfig.StoreFront;

            string pageName = "New Page";
            string url = "/NewUrl";
            int order = 1000;

            if (storeFront.Pages != null && storeFront.Pages.Count != 0)
            {
                order = storeFront.Pages.Max(pg => pg.Order) + 10;

                if (storeFront.Pages.Any(pg => pg.Name.ToLower() == pageName.ToLower()))
                {
                    int index = 1;
                    do
                    {
                        index++;
                        pageName = "New Page " + index;
                    } while (storeFront.Pages.Any(pg => pg.Name.ToLower() == pageName.ToLower()));
                }

                if (storeFront.Pages.Any(pg => pg.Url.ToLower() == url.ToLower()))
                {
                    int index = 1;
                    do
                    {
                        index++;
                        url = "/NewUrl" + index;
                    } while (storeFront.Pages.Any(pg => pg.Url.ToLower() == url.ToLower()));
                }
            }

            page.ClientId = storeFront.ClientId;
            page.Client = storeFront.Client;
            page.StoreFrontId = storeFront.StoreFrontId;
            page.StoreFront = storeFront;
            page.ThemeId = storeFrontConfig.DefaultNewPageThemeId;
            page.PageTitle = pageName;
            page.Name = pageName;
            page.Url = url;
            page.Order = order;
            page.IsPending = false;
            page.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);
            page.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
        }
Esempio n. 50
0
        /// <summary>
        /// Note; this method should be called after the order is confirmed, and submitted to process.
        /// This is one of the last steps before the order can be placed.
        /// If this fails, the user will be sent back to the payment info page, and cart.StatusEnteredPaymentInfo should be set to false in the calling method
        /// Note; this method will throw an exception back if an error is encountered in the PayPal api, be sure to catch exceptions
        /// </summary>
        /// <param name="storeFront"></param>
        /// <param name="cart"></param>
        /// <param name="payer_id">Pay Pal payer_id from querystring on payment confirm return</param>
        /// <returns></returns>
        public PayPalPaymentData ExecutePayPalPayment(StoreFrontConfiguration storeFrontConfig, Cart cart)
        {
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            if (cart == null)
            {
                throw new ArgumentNullException("cart");
            }
            if (cart.CartPaymentInfo == null)
            {
                throw new ArgumentNullException("cart.PaymentInfo");
            }
            if (!cart.StatusPaymentInfoConfirmed)
            {
                throw new ApplicationException("cart.StatusEnteredPaymentInfo = false. Cannot execute payment until PayPal payer is confirmed with returnUrl.");
            }
            if (string.IsNullOrWhiteSpace(cart.CartPaymentInfo.PayPalPaymentId))
            {
                throw new ArgumentNullException("cart.PaymentInfo.PayPalPaymentId", "cart.PaymentInfo.PayPalPaymentId = null. Be sure PayPalPaymentId is being set before Buyer is sent to PayPal to start auth or payment.");
            }
            if (string.IsNullOrWhiteSpace(cart.CartPaymentInfo.PayPalReturnPayerId))
            {
                throw new ArgumentNullException("cart.CartPaymentInfo.PayPalReturnPayerId", "cart.CartPaymentInfo.PayPalReturnPayerId = null. Be sure PayPalPayerId is being set in return from PayPal to start payment.");
            }
            if (cart.CartPaymentInfo.PayPalReturnPaymentId.ToLower() != cart.CartPaymentInfo.PayPalPaymentId.ToLower())
            {
                throw new ArgumentOutOfRangeException("PayPalReturnPaymentId", "cart.CartPaymentInfo.PayPalReturnPayerId != cart.CartPaymentInfo.PayPalPaymentId. This appears to be a URL hack.");
            }

            string client_Id = storeFrontConfig.PaymentMethod_PayPal_Client_Id;
            if (string.IsNullOrWhiteSpace(client_Id))
            {
                throw new ArgumentNullException("storeFrontConfig.PayPal_Client_Id");
            }

            string client_Secret = storeFrontConfig.PaymentMethod_PayPal_Client_Secret;
            if (string.IsNullOrWhiteSpace(client_Secret))
            {
                throw new ArgumentNullException("storeFrontConfig.PayPal_Client_Secret");
            }

            bool useSandbox = !storeFrontConfig.PaymentMethod_PayPal_UseLiveServer;

            PayPalOAuthTokenData token;
            try
            {
                token = GetOAuthToken(client_Id, client_Secret, useSandbox);
            }
            catch (Exceptions.PayPalExceptionOAuthFailed)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Paypal OAuth token call failed with exception " + ex.Message + ". See inner exception for details";
                throw new Exceptions.PayPalExceptionOAuthFailed(useSandbox, message, null, ex);
            }

            PayPalPaymentData result;
            try
            {
                result = ExecutePayment(token, cart.CartPaymentInfo.PayPalPaymentId, cart.CartPaymentInfo.PayPalReturnPayerId, useSandbox);
            }
            catch (Exceptions.PayPalExceptionCreatePaymentFailed)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Paypal Executer Payment API call failed with exception " + ex.Message + ". See inner exception for details";
                throw new Exceptions.PayPalExceptionCreatePaymentFailed(useSandbox, message, null, ex);
            }

            return result;
        }
Esempio n. 51
0
        /// <summary>
        /// Note; this method will throw an exception back if an error is encountered in the PayPal api, be sure to catch exceptions
        /// </summary>
        /// <param name="storeFront"></param>
        /// <param name="cart"></param>
        /// <param name="return_url">URL to send user to after they confirm their payment info. Example: (current server url)/Checkout/PaymentSuccess</param>
        /// <param name="cancel_url">URL to send user to if they Cancel their payment info. Example: (current server url)/Checkout/PaymentCanceled</param>
        /// <returns></returns>
        public PayPalPaymentData StartPayPalPayment(StoreFrontConfiguration storeFrontConfig, Cart cart, Uri return_url, Uri cancel_url)
        {
            if (return_url == null)
            {
                throw new ArgumentNullException("return_url");
            }
            if (cancel_url == null)
            {
                throw new ArgumentNullException("cancel_url");
            }
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            if (cart == null)
            {
                throw new ArgumentNullException("cart");
            }

            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFront.CurrentConfig");
            }

            if (!storeFrontConfig.PaymentMethod_PayPal_Enabled)
            {
                throw new ApplicationException("PayPal is not enabled for this store front. Update Store Front Configuration to set storeFrontConfig.PayPal_UsePayPal = true");
            }

            string client_Id = storeFrontConfig.PaymentMethod_PayPal_Client_Id;
            if (string.IsNullOrWhiteSpace(client_Id))
            {
                throw new ArgumentNullException("storeFrontConfig.PayPal_Client_Id");
            }

            string client_Secret = storeFrontConfig.PaymentMethod_PayPal_Client_Secret;
            if (string.IsNullOrWhiteSpace(client_Secret))
            {
                throw new ArgumentNullException("storeFrontConfig.PayPal_Client_Secret");
            }

            bool useSandbox = !storeFrontConfig.PaymentMethod_PayPal_UseLiveServer;

            PayPalItemData[] items = cart.CartItems.Select(ci => new PayPalItemData(ci.Quantity.ToString(), ci.Product.Name, (ci.LineTotal / ci.Quantity).ToString("N2"), ci.Product.UrlName)).ToArray();

            PayPalOAuthTokenData token;
            try
            {
                token = GetOAuthToken(client_Id, client_Secret, useSandbox);
            }
            catch(Exceptions.PayPalExceptionOAuthFailed)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Paypal OAuth token call failed with exception " + ex.Message + ". See inner exception for details";
                throw new Exceptions.PayPalExceptionOAuthFailed(useSandbox, message, null, ex);
            }

            PayPalPaymentData result;
            try
            {
                result = CreatePayPalPayment(token, cart.Total, "Your Order at " + storeFrontConfig.Name, items, return_url.ToString(), cancel_url.ToString(), useSandbox);
            }
            catch (Exceptions.PayPalExceptionCreatePaymentFailed)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Paypal Create Payment API call failed with exception " + ex.Message + ". See inner exception for details";
                throw new Exceptions.PayPalExceptionCreatePaymentFailed(useSandbox, message, null, ex);
            }

            return result;
        }
Esempio n. 52
0
        /// <summary>
        /// Processes paypal payment on an order if it has not been done already
        /// Saves Payment to cart, does not mark cart status
        /// Exceptions thrown if cart.StatusPlacedOrder = true or cart.OrderId.HasValue
        /// Otherwise, payment will be processed and if failed, a record with failure code will be returned
        /// </summary>
        /// <returns></returns>
        public static Payment ProcessPayPalPaymentForOrderAndSavePayment(this Cart cart, StoreFrontConfiguration storeFrontConfig, IGstoreDb db)
        {
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            if (cart == null)
            {
                throw new ArgumentNullException("cart");
            }
            if (!cart.StatusPaymentInfoConfirmed)
            {
                throw new ApplicationException("cart.StatusPaymentInfoConfirmed = false. Be sure cart is updated with payment info status = true when payment is selected.");
            }
            if (cart.CartPaymentInfo == null)
            {
                throw new ArgumentNullException("cart.PaymentInfo");
            }
            if (cart.OrderId.HasValue)
            {
                throw new ApplicationException("cart.OrderId.HasValue is set. This cart already has been processed and converted into an order. Order Id: " + cart.OrderId.Value);
            }
            if (cart.StatusPlacedOrder)
            {
                throw new ApplicationException("cart.StatusPlacedOrder = true. This cart already has been processed and converted into an order.");
            }
            if (cart.CartPaymentInfo.PayPalPaymentId.ToLower() != cart.CartPaymentInfo.PayPalReturnPaymentId.ToLower())
            {
                throw new ApplicationException("PayPal Payment id mismatch. PaymentId: " + cart.CartPaymentInfo.PayPalPaymentId + " ReturnPaymentId: " + cart.CartPaymentInfo.PayPalReturnPaymentId);
            }
            if (cart.CartPaymentInfo.PaymentSource != Models.BaseClasses.GStorePaymentSourceEnum.PayPal)
            {
                throw new ApplicationException("Payment Source not supported: " + cart.CartPaymentInfo.PaymentSource.ToString());
            }

            Payment payment = db.Payments.Create();
            payment.SetDefaultsForNew(storeFrontConfig);
            payment.PaymentSource = cart.CartPaymentInfo.PaymentSource;
            payment.ProcessDateTimeUtc = DateTime.UtcNow;
            payment.CartId = cart.CartId;

            PayPalPaymentData response = new PayPal.Models.PayPalPaymentData();
            PayPal.PayPalPaymentClient paypalClient = new PayPal.PayPalPaymentClient();
            try
            {
                response = paypalClient.ExecutePayPalPayment(storeFrontConfig, cart);
                if (response.transactions == null || response.transactions.Count() == 0)
                {
                    throw new ApplicationException("PayPal transactions missing from response. JSON: " + response.Json);
                }
                payment.SetFromPayPalPayment(response);
                payment.PaymentFailed = false;
                payment.FailureException = null;
                payment.IsProcessed = true;
            }
            catch (Exceptions.PayPalExceptionOAuthFailed exOAuth)
            {
                payment.PaymentFailed = true;
                payment.FailureException = exOAuth.ToString();
                payment.Json = response.Json;
                payment.AmountPaid = 0M;
                payment.TransactionId = null;
                payment.IsProcessed = false;
            }
            catch (Exceptions.PayPalExceptionExecutePaymentFailed exPaymentFailed)
            {
                payment.PaymentFailed = true;
                payment.FailureException = exPaymentFailed.ToString();
                payment.Json = response.Json;
                payment.AmountPaid = 0M;
                payment.TransactionId = null;
                payment.IsProcessed = false;
            }
            catch (Exception ex)
            {
                payment.PaymentFailed = true;
                payment.FailureException = ex.ToString();
                payment.Json = response.Json;
                payment.AmountPaid = 0M;
                payment.TransactionId = null;
                payment.IsProcessed = false;
            }

            db.Payments.Add(payment);
            db.SaveChanges();

            return payment;
        }
Esempio n. 53
0
        public static Order CreateOrderFromCartAndSave(this Cart cart, StoreFrontConfiguration config, Payment payment, IGstoreDb db)
        {
            if (cart == null)
            {
                throw new ArgumentNullException("cart");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            Order order = db.Orders.Create();

            lock (orderNumberLock)
            {
                order.OrderNumber = cart.StoreFront.GetAndIncrementOrderNumber(db).ToString();
            }

            order.OriginalCartId = cart.CartId;
            order.Client = cart.Client;
            order.ClientId= cart.ClientId;
            order.CreateDateTimeUtc = DateTime.UtcNow;
            order.CreatedBy= cart.CreatedBy;
            order.CreatedBy_UserProfileId= cart.CreatedBy_UserProfileId;
            order.Discount= cart.Discount;
            order.DiscountCode= cart.DiscountCode;
            order.DiscountCodesAttempted= cart.DiscountCodesAttempted;
            order.DiscountCodesFailed= cart.DiscountCodesFailed;
            order.DiscountId= cart.DiscountId;
            order.Email= cart.Email;
            order.FullName = cart.FullName;
            order.EndDateTimeUtc= DateTime.UtcNow.AddYears(100);
            order.EntryDateTimeUtc= cart.EntryDateTimeUtc;
            order.EntryRawUrl= cart.EntryRawUrl;
            order.EntryReferrer= cart.EntryReferrer;
            order.EntryUrl= cart.EntryUrl;
            order.Handling= cart.Handling;
            order.IPAddress= cart.IPAddress;
            order.IsPending= false;
            order.ItemCount= cart.ItemCount;
            order.OrderDiscount= cart.OrderDiscount;
            order.LoginOrGuestWebFormResponse = cart.LoginOrGuestWebFormResponse;
            order.PaymentInfoWebFormResponse = cart.CartPaymentInfo == null ? null : cart.CartPaymentInfo.WebFormResponse;
            order.ConfirmOrderWebFormResponse = cart.ConfirmOrderWebFormResponse;
            order.DeliveryInfoDigital = cart.DeliveryInfoDigital;
            order.DeliveryInfoShipping = cart.DeliveryInfoShipping;
            order.AllItemsAreDigitalDownload = cart.AllItemsAreDigitalDownload;
            order.DigitalDownloadItemCount = cart.DigitalDownloadItemCount;
            order.ShippingItemCount = cart.ShippingItemCount;

            order.RefundedAmount = 0;
            order.SessionId= cart.SessionId;
            order.Shipping= cart.Shipping;

            order.StartDateTimeUtc= DateTime.UtcNow.AddMinutes(-1);
            order.StoreFront= cart.StoreFront;
            order.StoreFrontId= cart.StoreFrontId;
            order.Subtotal= cart.Subtotal;
            order.Tax= cart.Tax;
            order.Total= cart.Total;
            order.UpdateDateTimeUtc= DateTime.UtcNow;
            order.UpdatedBy= cart.UpdatedBy;
            order.UpdatedBy_UserProfileId= cart.UpdatedBy_UserProfileId;
            order.UserAgent= cart.UserAgent;
            order.UserProfile= cart.UserProfile;
            order.UserProfileId= cart.UserProfileId;

            order = db.Orders.Add(order);
            db.SaveChanges();

            //note: payment can be null in a PO or invoicing scenario
            if (payment == null)
            {
                order.StatusOrderPaymentProcessed = false;
            }
            else
            {
                if (payment.IsProcessed)
                {
                    order.StatusOrderPaymentProcessed = true;
                    if (config.Orders_AutoAcceptPaid)
                    {
                        order.StatusOrderAccepted = true;
                    }
                    else if (order.AllItemsAreDigitalDownload)
                    {
                        //always auto-accept digital download orders because they are available immediately
                        order.StatusOrderAccepted = true;
                    }
                }
                //link payment to order
                payment.Order = order;
                payment.OrderId = order.OrderId;

                payment = db.Payments.Update(payment);
            }

            foreach (CartBundle cartBundle in cart.CartBundles.AsQueryable().ApplyDefaultSort())
            {
                OrderBundle orderBundle = db.OrderBundles.Create();
                orderBundle.ProductBundleId = cartBundle.ProductBundleId;

                orderBundle.Client = cartBundle.Client;
                orderBundle.ClientId = cartBundle.ClientId;
                orderBundle.StoreFront = cartBundle.StoreFront;
                orderBundle.StoreFrontId = cartBundle.StoreFrontId;
                orderBundle.CartBundleId = cartBundle.CartBundleId;
                orderBundle.Order = order;

                orderBundle.Quantity = cartBundle.Quantity;
                orderBundle.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
                orderBundle.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);
                orderBundle.IsPending = false;

                orderBundle = db.OrderBundles.Add(orderBundle);
            }

            if (cart.CartBundles != null && cart.CartBundles.Count != 0)
            {
                db.SaveChanges();
            }

            //add order items;
            foreach (CartItem item in cart.CartItems.AsQueryable().ApplyDefaultSort())
            {
                OrderItem orderItem = db.OrderItems.Create();
                orderItem.CartItem = item;
                orderItem.CartItemId = item.CartItemId;
                orderItem.Client = item.Client;
                orderItem.ClientId = item.ClientId;
                orderItem.CreateDateTimeUtc = DateTime.UtcNow;
                orderItem.CreatedBy = item.CreatedBy;
                orderItem.CreatedBy_UserProfileId = item.CreatedBy_UserProfileId;
                orderItem.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);
                orderItem.IsPending = false;
                orderItem.ItemRefundedAmount = 0;
                orderItem.IsDigitalDownload = item.Product.DigitalDownload;
                if (payment != null && payment.IsProcessed)
                {
                    orderItem.StatusItemPaymentReceived = true;
                }
                else
                {
                    orderItem.StatusItemPaymentReceived = false;
                }
                orderItem.StatusItemPaymentReceived = order.StatusOrderPaymentProcessed;
                orderItem.StatusItemAccepted = order.StatusOrderAccepted;
                orderItem.LineDiscount = item.LineDiscount;
                orderItem.LineTotal = item.LineTotal;
                orderItem.ListPrice = item.ListPrice;
                orderItem.ListPriceExt = item.ListPriceExt;
                orderItem.Order = order;
                orderItem.OrderId = order.OrderId;
                orderItem.Product = item.Product;
                orderItem.ProductId = item.ProductId;
                orderItem.ProductVariantInfo = item.ProductVariantInfo;
                orderItem.Quantity = item.Quantity;
                orderItem.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
                orderItem.StoreFront = item.StoreFront;
                orderItem.StoreFrontId = item.StoreFrontId;
                orderItem.UnitPrice = item.UnitPrice;
                orderItem.UnitPriceExt = item.UnitPriceExt;
                orderItem.UpdateDateTimeUtc = DateTime.UtcNow;
                orderItem.UpdatedBy = item.UpdatedBy;
                orderItem.UpdatedBy_UserProfileId = item.UpdatedBy_UserProfileId;
                orderItem.ProductBundleItemId = item.ProductBundleItemId;

                if (item.CartBundleId.HasValue)
                {
                    OrderBundle orderBundle = order.OrderBundles.Single(ob => ob.CartBundleId == item.CartBundleId);
                    orderItem.OrderBundleId = orderBundle.OrderBundleId;
                }
                orderItem = db.OrderItems.Add(orderItem);
            }

            db.SaveChanges();

            return order;
        }
 public WebFormManagerAdminViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, IOrderedQueryable<WebForm> webForms)
     : base(storeFrontConfig, userProfile)
 {
     this.WebForms = webForms;
 }
Esempio n. 55
0
        public static void CreateNewOrderNotificationToOrderAdminAndSave(this IGstoreDb db, StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, Order order, UrlHelper urlHelper)
        {
            //user profile is null if user purchased as a guest
            if (storeFrontConfig == null)
            {
                throw new ArgumentNullException("storeFrontConfig");
            }
            if (order == null)
            {
                throw new ArgumentNullException("order");
            }
            if (urlHelper == null)
            {
                throw new ArgumentNullException("urlHelper");
            }

            Uri currentUrl = urlHelper.RequestContext.HttpContext.Request.Url;
            string orderAdminUrl = urlHelper.Action("View", "Orders", new { area = "OrderAdmin", id = order.OrderNumber });
            string userViewOrderStatusUrl = urlHelper.Action("View", "OrderStatus", new { area = "", id = order.OrderNumber, Email = order.Email });

            UserProfile orderAdmin = storeFrontConfig.OrderAdmin;
            Notification notification = db.Notifications.Create();

            notification.StoreFront = storeFrontConfig.StoreFront;
            notification.StoreFront = storeFrontConfig.StoreFront;
            notification.ClientId = storeFrontConfig.ClientId;
            notification.Client = storeFrontConfig.Client;
            notification.From = "GStore Order Admin";
            notification.FromUserProfileId = orderAdmin.UserProfileId;
            notification.OrderId = order.OrderId;
            notification.ToUserProfileId = orderAdmin.UserProfileId;
            notification.To = orderAdmin.FullName;

            notification.Importance = "Normal";
            notification.Subject = "New Order #" + order.OrderNumber + " placed on " + currentUrl.Host + " at " + order.CreateDateTimeUtc.ToStoreDateTimeString(storeFrontConfig, storeFrontConfig.Client);

            notification.UrlHost = currentUrl.Host;
            if (!currentUrl.IsDefaultPort)
            {
                notification.UrlHost += ":" + currentUrl.Port;
            }
            notification.BaseUrl = urlHelper.Action("Details", "Notifications", new { area = "", id = "" });
            notification.Message = notification.Subject
                + "\n\nOrder Number: " + order.OrderNumber
                + "\nStore Front: " + storeFrontConfig.Name + " [" + storeFrontConfig.StoreFrontId + "]"
                + "\nClient: " + order.Client.Name + " [" + order.ClientId + "]"
                + "\nDate/Time: " + order.CreateDateTimeUtc.ToStoreDateTimeString(storeFrontConfig, storeFrontConfig.Client)
                + "\n"
                + "\nUser: "******"(guest)" : order.UserProfile.FullName + " <" + order.UserProfile.Email + "> [" + order.UserProfileId + "]")
                + "\nEmail: " + order.Email;

            notification.Message = notification.Message.ToHtmlLines();

            if (order.LoginOrGuestWebFormResponse != null)
            {
                //add custom fields from LoginOrGuestWebFormResponse
                notification.Message += order.LoginOrGuestWebFormResponse.ToSimpleTextForCheckout(true);
            }

            notification.Message += "\n"
                + "\nTax: $" + order.Tax.ToString("N2")
                + "\nShipping: $" + order.Shipping.ToString("N2")
                + "\nHandling: $" + order.Handling.ToString("N2")
                + "\nDiscount Code: " + order.DiscountCode.OrDefault("(none)")
                + "\nDiscount: " + order.Discount.ToStringDetails()
                + "\nOrder Discount: $" + order.OrderDiscount.ToString("N2")
                + "\nSubtotal: $" + order.Subtotal.ToString("N2")
                + "\nTotal: $" + order.Total.ToString("N2")
                + "\nPaid: $" + (order.Payments.Sum(p => p.AmountPaid).ToString("N2"));

            if (order.PaymentInfoWebFormResponse != null)
            {
                //add custom fields from PaymentInfoWebFormResponse
                notification.Message += order.PaymentInfoWebFormResponse.ToSimpleTextForCheckout(true);
            }
            notification.Message += "\n";
            notification.Message += "\nOrder Confirmed";
            if (order.ConfirmOrderWebFormResponse != null)
            {
                //add custom fields from LoginOrGuestWebFormResponse
                notification.Message += order.ConfirmOrderWebFormResponse.ToSimpleTextForCheckout(true);
            }

            notification.Message += "\n";
            if (order.DeliveryInfoShippingId.HasValue)
            {
                notification.Message += "\nShip To: " + order.DeliveryInfoShipping.ToOrderDetails(true) + "\n";
            }

            if (order.DeliveryInfoDigitalId.HasValue)
            {
                notification.Message += "\nDigital Delivery To: " + order.DeliveryInfoDigital.ToOrderDetails(true) + "\n";
            }

            notification.Message += "\nItem Count: " + order.ItemCount
                + "\nAll Items are Digital Download: " + (order.AllItemsAreDigitalDownload ? "Yes" : "No")
                + "\nItems to Ship: " + order.ShippingItemCount.ToString("N0")
                + "\nDigital Download Item Count: " + order.DigitalDownloadItemCount
                + "\n\nOrder Items: " + order.OrderItems.Count;

            int counter = 0;
            foreach (OrderItem item in order.OrderItems.OrderBy(oi => oi.OrderItemId))
            {
                counter++;
                notification.Message += "\nOrder Item " + counter + " " + item.ToOrderDetails();
            }

            notification.Message += "\n\nOrder Id: " + order.OrderId
                + "\nCart Id: " + order.OriginalCartId
                + "\nUser Agent: " + order.UserAgent
                + "\nSession Id: " + order.SessionId
                + "\nIP Address: " + order.IPAddress
                + "\nEntry Url: " + order.EntryUrl
                + "\nEntry Referrer: " + order.EntryReferrer
                + "\nEntry Raw Url: " + order.EntryRawUrl
                + "\nEntry Date Time: " + order.EntryDateTimeUtc.ToStoreDateTimeString(storeFrontConfig, storeFrontConfig.Client)
                + "\nDiscount Codes Attempted: " + order.DiscountCodesAttempted.OrDefault("(none)")
                + "\nDiscount Codes Failed: " + order.DiscountCodesFailed.OrDefault("(none)");

            notification.IsPending = false;
            notification.StartDateTimeUtc = DateTime.UtcNow.AddMinutes(-1);
            notification.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);

            List<NotificationLink> links = new List<NotificationLink>();

            NotificationLink link1 = db.NotificationLinks.Create();

            link1.SetDefaultsForNew(notification);
            link1.Order = 1;
            link1.LinkText = "Admin Order #" + order.OrderNumber;
            link1.Url = orderAdminUrl;
            link1.IsExternal = false;
            links.Add(link1);

            NotificationLink link2 = db.NotificationLinks.Create();
            link2.SetDefaultsForNew(notification);
            link2.Order = 2;
            link2.LinkText = "Order Status Link for User";
            link2.Url = userViewOrderStatusUrl;
            link2.IsExternal = false;
            links.Add(link2);

            notification.NotificationLinks = links;
            db.Notifications.Add(notification);

            db.SaveChanges();
        }
 public PageManagerAdminViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, IOrderedQueryable<Page> pages)
     : base(storeFrontConfig, userProfile)
 {
     this.Pages = pages;
 }
Esempio n. 57
0
        /// <summary>
        /// Dupe-safe uses Page.Url to prevent dupes
        /// </summary>
        private static Page CreateSeedPage(this IGstoreDb storeDb, string name, string pageTitle, string url, int order, StoreFrontConfiguration storeFrontConfig, PageTemplate pageTemplate, bool returnPageIfExists)
        {
            if (storeFrontConfig.StoreFront.Pages.Any(p => p.Url.ToLower() == url.ToLower()))
            {
                if (returnPageIfExists)
                {
                    return storeFrontConfig.StoreFront.Pages.Single(p => p.Url.ToLower() == url.ToLower());
                }
                return null;
            }
            Page page = storeDb.Pages.Create();
            page.ClientId = storeFrontConfig.ClientId;
            page.PageTemplateId = pageTemplate.PageTemplateId;
            page.Theme = storeFrontConfig.DefaultNewPageTheme;
            page.ThemeId = storeFrontConfig.DefaultNewPageThemeId;
            page.Order = order;
            page.Name = name;
            page.PageTitle = pageTitle;
            page.ForAnonymousOnly = false;
            page.ForRegisteredOnly = false;
            page.IsPending = false;
            page.StartDateTimeUtc = DateTime.UtcNow.AddSeconds(-1);
            page.EndDateTimeUtc = DateTime.UtcNow.AddYears(100);
            page.StoreFrontId = storeFrontConfig.StoreFrontId;
            page.Url = url;
            storeDb.Pages.Add(page);
            storeDb.SaveChangesEx(true, false, false, false);

            return page;
        }
Esempio n. 58
0
 public CheckoutPaymentInfoViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
 }
Esempio n. 59
0
 public CheckoutLogInOrGuestViewModel(StoreFrontConfiguration config, Cart cart, string currentAction)
     : base(config, cart, currentAction)
 {
 }
        public StoreFrontConfigAdminViewModel(StoreFrontConfiguration storeFrontConfig, UserProfile userProfile, string activeTab, bool isCreatePage, bool isDeletePage)
            : base(storeFrontConfig, userProfile)
        {
            this.ActiveTab = activeTab;
            this.IsCreatePage = isCreatePage;
            this.IsDeletePage = isDeletePage;
            this.StoreFrontId = storeFrontConfig.StoreFrontId;
            this.StoreFrontConfigurationId = storeFrontConfig.StoreFrontConfigurationId;
            this.AccountAdmin = storeFrontConfig.AccountAdmin;
            this.AccountAdmin_UserProfileId = storeFrontConfig.AccountAdmin_UserProfileId;
            this.AccountTheme = storeFrontConfig.AccountTheme;
            this.AccountThemeId = storeFrontConfig.AccountThemeId;
            this.AccountLoginRegisterLinkText = storeFrontConfig.AccountLoginRegisterLinkText;
            this.AccountLoginShowRegisterLink = storeFrontConfig.AccountLoginShowRegisterLink;
            this.AdminTheme = storeFrontConfig.AdminTheme;
            this.AdminThemeId = storeFrontConfig.AdminThemeId;
            this.CartTheme = storeFrontConfig.CartTheme;
            this.CartThemeId = storeFrontConfig.CartThemeId;
            this.CheckoutTheme = storeFrontConfig.CheckoutTheme;
            this.CheckoutThemeId = storeFrontConfig.CheckoutThemeId;
            this.CheckoutOrderMinimum = storeFrontConfig.CheckoutOrderMinimum;

            this.CheckoutLogInOrGuestWebFormId = storeFrontConfig.CheckoutLogInOrGuestWebFormId;
            this.CheckoutLogInOrGuestWebForm = storeFrontConfig.CheckoutLogInOrGuestWebForm;
            this.CheckoutDeliveryInfoDigitalOnlyWebFormId = storeFrontConfig.CheckoutDeliveryInfoDigitalOnlyWebFormId;
            this.CheckoutDeliveryInfoDigitalOnlyWebForm = storeFrontConfig.CheckoutDeliveryInfoDigitalOnlyWebForm;
            this.CheckoutDeliveryInfoShippingWebFormId = storeFrontConfig.CheckoutDeliveryInfoShippingWebFormId;
            this.CheckoutDeliveryInfoShippingWebForm = storeFrontConfig.CheckoutDeliveryInfoShippingWebForm;
            this.CheckoutDeliveryMethodWebFormId = storeFrontConfig.CheckoutDeliveryMethodWebFormId;
            this.CheckoutDeliveryMethodWebForm = storeFrontConfig.CheckoutDeliveryMethodWebForm;
            this.CheckoutPaymentInfoWebFormId = storeFrontConfig.CheckoutPaymentInfoWebFormId;
            this.CheckoutPaymentInfoWebForm = storeFrontConfig.CheckoutPaymentInfoWebForm;
            this.CheckoutConfirmOrderWebFormId = storeFrontConfig.CheckoutConfirmOrderWebFormId;
            this.CheckoutConfirmOrderWebForm = storeFrontConfig.CheckoutConfirmOrderWebForm;

            this.Orders_AutoAcceptPaid = storeFrontConfig.Orders_AutoAcceptPaid;
            this.PaymentMethod_PayPal_Enabled = storeFrontConfig.PaymentMethod_PayPal_Enabled;
            this.PaymentMethod_PayPal_UseLiveServer = storeFrontConfig.PaymentMethod_PayPal_UseLiveServer;
            this.PaymentMethod_PayPal_Client_Id = storeFrontConfig.PaymentMethod_PayPal_Client_Id;
            this.PaymentMethod_PayPal_Client_Secret = storeFrontConfig.PaymentMethod_PayPal_Client_Secret;

            this.CatalogCategoryColLg = storeFrontConfig.CatalogCategoryColLg;
            this.CatalogCategoryColMd = storeFrontConfig.CatalogCategoryColMd;
            this.CatalogCategoryColSm = storeFrontConfig.CatalogCategoryColSm;
            this.CatalogTheme = storeFrontConfig.CatalogTheme;
            this.CatalogThemeId = storeFrontConfig.CatalogThemeId;
            this.CatalogPageInitialLevels = storeFrontConfig.CatalogPageInitialLevels;
            this.CatalogProductColLg = storeFrontConfig.CatalogProductColLg;
            this.CatalogProductColMd = storeFrontConfig.CatalogProductColMd;
            this.CatalogProductColSm = storeFrontConfig.CatalogProductColSm;
            this.CatalogProductBundleColLg = storeFrontConfig.CatalogProductBundleColLg;
            this.CatalogProductBundleColMd = storeFrontConfig.CatalogProductBundleColMd;
            this.CatalogProductBundleColSm = storeFrontConfig.CatalogProductBundleColSm;
            this.CatalogProductBundleItemColLg = storeFrontConfig.CatalogProductBundleItemColLg;
            this.CatalogProductBundleItemColMd = storeFrontConfig.CatalogProductBundleItemColMd;
            this.CatalogProductBundleItemColSm = storeFrontConfig.CatalogProductBundleItemColSm;

            this.BlogTheme = storeFrontConfig.BlogTheme;
            this.BlogThemeId = storeFrontConfig.BlogThemeId;
            this.BlogAdminTheme = storeFrontConfig.BlogAdminTheme;
            this.BlogAdminThemeId = storeFrontConfig.BlogAdminThemeId;

            this.ChatTheme = storeFrontConfig.ChatTheme;
            this.ChatThemeId = storeFrontConfig.ChatThemeId;
            this.ChatEnabled = storeFrontConfig.ChatEnabled;
            this.ChatRequireLogin = storeFrontConfig.ChatRequireLogin;

            this.CatalogAdminThemeId = storeFrontConfig.CatalogAdminThemeId;
            this.CatalogAdminTheme = storeFrontConfig.CatalogAdminTheme;
            this.DefaultNewPageTheme = storeFrontConfig.DefaultNewPageTheme;
            this.DefaultNewPageThemeId = storeFrontConfig.DefaultNewPageThemeId;
            this.Folder = storeFrontConfig.Folder;
            this.EnableGoogleAnalytics = storeFrontConfig.EnableGoogleAnalytics;
            this.GoogleAnalyticsWebPropertyId = storeFrontConfig.GoogleAnalyticsWebPropertyId;
            this.HtmlFooter = storeFrontConfig.HtmlFooter;
            this.HomePageUseCatalog = storeFrontConfig.HomePageUseCatalog;
            this.HomePageUseBlog = storeFrontConfig.HomePageUseBlog;

            this.ShowBlogInMenu = storeFrontConfig.ShowBlogInMenu;
            this.ShowAboutGStoreMenu = storeFrontConfig.ShowAboutGStoreMenu;
            this.MetaApplicationName = storeFrontConfig.MetaApplicationName;
            this.MetaApplicationTileColor = storeFrontConfig.MetaApplicationTileColor;
            this.MetaDescription = storeFrontConfig.MetaDescription;
            this.MetaKeywords = storeFrontConfig.MetaKeywords;
            this.Order = storeFrontConfig.Order;
            this.OrderAdminThemeId = storeFrontConfig.OrderAdminThemeId;
            this.OrderAdminTheme = storeFrontConfig.OrderAdminTheme;
            this.OrdersThemeId = storeFrontConfig.OrdersThemeId;
            this.OrdersTheme = storeFrontConfig.OrdersTheme;
            this.BodyTopScriptTag = storeFrontConfig.BodyTopScriptTag;
            this.BodyBottomScriptTag = storeFrontConfig.BodyBottomScriptTag;
            this.Name = storeFrontConfig.Name;
            this.TimeZoneId = storeFrontConfig.TimeZoneId;
            this.CatalogTitle = storeFrontConfig.CatalogTitle;

            this.CatalogLayout = storeFrontConfig.CatalogLayout;
            this.CatalogHeaderHtml = storeFrontConfig.CatalogHeaderHtml;
            this.CatalogFooterHtml = storeFrontConfig.CatalogFooterHtml;
            this.CatalogRootListTemplate = storeFrontConfig.CatalogRootListTemplate;
            this.CatalogRootHeaderHtml = storeFrontConfig.CatalogRootHeaderHtml;
            this.CatalogRootFooterHtml = storeFrontConfig.CatalogRootFooterHtml;

            this.CatalogDefaultBottomDescriptionCaption = storeFrontConfig.CatalogDefaultBottomDescriptionCaption;
            this.CatalogDefaultNoProductsMessageHtml = storeFrontConfig.CatalogDefaultNoProductsMessageHtml;
            this.CatalogDefaultProductBundleTypePlural = storeFrontConfig.CatalogDefaultProductBundleTypePlural;
            this.CatalogDefaultProductBundleTypeSingle = storeFrontConfig.CatalogDefaultProductBundleTypeSingle;
            this.CatalogDefaultProductTypePlural = storeFrontConfig.CatalogDefaultProductTypePlural;
            this.CatalogDefaultProductTypeSingle = storeFrontConfig.CatalogDefaultProductTypeSingle;
            this.CatalogDefaultSampleAudioCaption = storeFrontConfig.CatalogDefaultSampleAudioCaption;
            this.CatalogDefaultSampleDownloadCaption = storeFrontConfig.CatalogDefaultSampleDownloadCaption;
            this.CatalogDefaultSampleImageCaption = storeFrontConfig.CatalogDefaultSampleImageCaption;
            this.CatalogDefaultSummaryCaption = storeFrontConfig.CatalogDefaultSummaryCaption;
            this.CatalogDefaultTopDescriptionCaption = storeFrontConfig.CatalogDefaultTopDescriptionCaption;

            this.NavBarCatalogMaxLevels = storeFrontConfig.NavBarCatalogMaxLevels;
            this.NavBarItemsMaxLevels = storeFrontConfig.NavBarItemsMaxLevels;
            this.NavBarRegisterLinkText = storeFrontConfig.NavBarRegisterLinkText;
            this.NavBarShowRegisterLink = storeFrontConfig.NavBarShowRegisterLink;
            this.NotFoundErrorPage = storeFrontConfig.NotFoundErrorPage;
            this.NotFoundError_PageId = storeFrontConfig.NotFoundError_PageId;
            this.NotificationsTheme = storeFrontConfig.NotificationsTheme;
            this.NotificationsThemeId = storeFrontConfig.NotificationsThemeId;
            this.ProfileTheme = storeFrontConfig.ProfileTheme;
            this.ProfileThemeId = storeFrontConfig.ProfileThemeId;
            this.PublicUrl = storeFrontConfig.PublicUrl;
            this.RegisteredNotify = storeFrontConfig.RegisteredNotify;
            this.RegisteredNotify_UserProfileId = storeFrontConfig.RegisteredNotify_UserProfileId;
            this.RegisterSuccessPage = storeFrontConfig.RegisterSuccessPage;
            this.RegisterSuccess_PageId = storeFrontConfig.RegisterSuccess_PageId;
            this.RegisterWebForm = storeFrontConfig.RegisterWebForm;
            this.Register_WebFormId = storeFrontConfig.Register_WebFormId;
            this.StoreErrorPage = storeFrontConfig.StoreErrorPage;
            this.StoreError_PageId = storeFrontConfig.StoreError_PageId;
            this.UseShoppingCart = storeFrontConfig.UseShoppingCart;
            this.CartNavShowCartWhenEmpty = storeFrontConfig.CartNavShowCartWhenEmpty;
            this.CartNavShowCartToAnonymous = storeFrontConfig.CartNavShowCartToAnonymous;
            this.CartNavShowCartToRegistered = storeFrontConfig.CartNavShowCartToRegistered;
            this.CartRequireLogin = storeFrontConfig.CartRequireLogin;

            this.WelcomePerson = storeFrontConfig.WelcomePerson;
            this.WelcomePerson_UserProfileId = storeFrontConfig.WelcomePerson_UserProfileId;
            this.OrderAdmin = storeFrontConfig.OrderAdmin;
            this.OrderAdmin_UserProfileId = storeFrontConfig.OrderAdmin_UserProfileId;

            this.ConfigurationName = storeFrontConfig.ConfigurationName;
            this.IsPending = storeFrontConfig.IsPending;
            this.EndDateTimeUtc = storeFrontConfig.EndDateTimeUtc;
            this.StartDateTimeUtc = storeFrontConfig.StartDateTimeUtc;

            this.ConfigIsActiveDirect = storeFrontConfig.IsActiveDirect();
        }