Exemplo n.º 1
0
        private void SaveUrls()
        {
            var sett = HccApp.CurrentStore.Settings.Urls;

            var showPageUrls = PageUtils.ShowPageUrls();

            if (showPageUrls)
            {
                sett.CategoryUrl      = txtCategoryUrl.Text;
                sett.ProductUrl       = txtProductsUrl.Text;
                sett.CheckoutUrl      = txtCheckoutUrl.Text;
                sett.AddressBookUrl   = StoreSettingsUrls.DefaultAddressBookUrl;
                sett.CartUrl          = StoreSettingsUrls.DefaultCartUrl;
                sett.OrderHistoryUrl  = StoreSettingsUrls.DefaultOrderHistoryUrl;
                sett.ProductReviewUrl = StoreSettingsUrls.DefaultProductReviewUrl;
                sett.SearchUrl        = StoreSettingsUrls.DefaultSearchUrl;
                sett.WishListUrl      = StoreSettingsUrls.DefaultWishListUrl;
            }

            sett.CategoryTabId = int.Parse(ddlCategoryTab.SelectedValue);
            sett.ProductTabId  = int.Parse(ddlProductsTab.SelectedValue);
            sett.CheckoutTabId = int.Parse(ddlCheckoutTab.SelectedValue);

            PageUtils.EnsureTabsExist(sett);
        }
        /// <summary>
        ///     Creates and configures hotcakes store from config file.
        /// </summary>
        /// <exception cref="CreateStoreException">Could not create store</exception>
        private void InstallApplication()
        {
            var intallFolderPath = "~/DesktopModules/Hotcakes/Core/Install/";
            var configPath       = HttpContext.Current.Server.MapPath(intallFolderPath + "Hotcakes.install.config");

            if (File.Exists(configPath))
            {
                // hardcoded for now since we create only one store now
                var portalId       = 0;
                var portalSettings = new PortalSettings(portalId);
                DnnGlobal.SetPortalSettings(portalSettings);

                var productsFile = HttpContext.Current.Server.MapPath(intallFolderPath + "Products.xlsx");

                var hccApp = HotcakesApplication.Current;

                var store = hccApp.AccountServices.CreateAndSetupStore();
                if (store == null)
                {
                    throw new CreateStoreException("Could not create store");
                }

                var config = GetStoreConfig(configPath);

                store.StoreName = config.StoreName;
                foreach (var settingConfig in config.Settings)
                {
                    store.Settings.AddOrUpdateLocalSetting(new StoreSetting
                    {
                        SettingName  = settingConfig.Name,
                        SettingValue = settingConfig.Value
                    });
                }

                hccApp.CurrentStore = store;
                hccApp.UpdateCurrentStore();

                hccApp.AccountServices.Stores.SetLastOrderNumber(store.Id, config.LastOrderNumber);

                var systemColumnsFilePath =
                    "~/DesktopModules/Hotcakes/Core/Admin/Parts/ContentBlocks/SystemColumnsData.xml";
                hccApp.ContentServices.Columns.CreateFromTemplateFile(systemColumnsFilePath);

                hccApp.OrderServices.EnsureDefaultZones(store.Id);

                var urlSettings = hccApp.CurrentStore.Settings.Urls;
                PageUtils.EnsureTabsExist(urlSettings);
                hccApp.UpdateCurrentStore();

                var catImport = new CatalogImport(hccApp)
                {
                    ImagesImportPath = intallFolderPath + "Images/"
                };
                catImport.ImportFromExcel(productsFile, (p, l) => { });

                Directory.Delete(HttpContext.Current.Server.MapPath(intallFolderPath), true);

                DnnGlobal.SetPortalSettings(null);
            }
        }
        private void CreatePages()
        {
            var sett = HccApp.CurrentStore.Settings.Urls;

            var showPageUrls = PageUtils.ShowPageUrls();

            if (showPageUrls)
            {
                sett.CategoryUrl      = txtCategoryUrl.Text;
                sett.ProductUrl       = txtProductsUrl.Text;
                sett.CheckoutUrl      = txtCheckoutUrl.Text;
                sett.AddressBookUrl   = StoreSettingsUrls.DefaultAddressBookUrl;
                sett.CartUrl          = StoreSettingsUrls.DefaultCartUrl;
                sett.OrderHistoryUrl  = StoreSettingsUrls.DefaultOrderHistoryUrl;
                sett.ProductReviewUrl = StoreSettingsUrls.DefaultProductReviewUrl;
                sett.SearchUrl        = StoreSettingsUrls.DefaultSearchUrl;
                sett.WishListUrl      = StoreSettingsUrls.DefaultWishListUrl;
            }

            PageUtils.EnsureTabsExist(sett);
        }