private void BuildIndex(IProgressMessenger progressMessenger, Guid applicationId, string applicationName, bool rebuild) { var searchManager = new SearchManager(applicationName); searchManager.SearchIndexMessage += SearchManager_SearchIndexMessage; searchManager.BuildIndex(rebuild); }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Importing assets...", false, 0); ImportAssets(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\B2BProductAssets.episerverdata")); ImportAssets(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\Hero.episerverdata")); _progressMessenger.AddProgressMessageText("Running EPiServer Find Content Indexing Job...", false, 0); var job = ScheduledJobRepository.Service.List().FirstOrDefault(x => x.Name.Equals("EPiServer Find Content Indexing Job")); if (job != null) { var result = ScheduledJobExecutor.Service.StartAsync(job).Result; if (result.Status == ScheduledJobExecutionStatus.Failed) { _progressMessenger.AddProgressMessageText("Quicksilver B2B Media failed: " + result.Message, true, 0); LogManager.GetLogger(GetType()).Error(result.Message); } } _progressMessenger.AddProgressMessageText("Done running EPiServer Find Content Indexing Job", false, 0); return(true); } catch (Exception ex) { _progressMessenger.AddProgressMessageText("Quicksilver B2B Media failed failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex.StackTrace); return(false); } }
public bool Execute(IProgressMessenger processMessenger) { var setup = new SetupData(_container); setup.Dump(); return(true); }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Importing product assets...", false, 0); ImportAssets(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\ProductAssets.episerverdata")); _progressMessenger.AddProgressMessageText("Enabling currencies...", false, 0); EnableCurrencies(); _progressMessenger.AddProgressMessageText("Importing taxes...", false, 0); ImportTaxes(); _progressMessenger.AddProgressMessageText("Importing catalog...", false, 0); ImportCatalog(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\Catalog_Fashion.zip")); _progressMessenger.AddProgressMessageText("Removing default warehouse...", false, 0); RemoveDefaultWarehouse(); _progressMessenger.AddProgressMessageText("Disabling default market...", false, 0); DisableDefaultMarket(); _progressMessenger.AddProgressMessageText("Configuring payment methods...", false, 0); ConfigurePaymentMethods(); _progressMessenger.AddProgressMessageText("Configuring shipment methods...", false, 0); ConfigureShippingMethods(); _progressMessenger.AddProgressMessageText("Creating marketing campaigns and Promotions...", false, 0); ConfigureMarketing(); _progressMessenger.AddProgressMessageText("Rebuilding index...", false, 0); BuildIndex(AppContext.Current.ApplicationName, true); _progressMessenger.AddProgressMessageText("Done rebuilding index", false, 0); _progressMessenger.AddProgressMessageText("Updating consent data for existing contacts...", false, 0); UpdateConsentDataForExistingContacts(); _progressMessenger.AddProgressMessageText("Done updating consent data for existing contacts", false, 0); return(true); } catch (Exception ex) { _progressMessenger.AddProgressMessageText("ImportSiteContent failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex); return(false); } }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Installing PayPal", false, 0); InstallPayPalPaymentProvider(); return(true); } catch (Exception ex) { _progressMessenger.AddProgressMessageText("Setting up failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex.StackTrace); return(false); } }
protected override void ExecuteInternal(IProgressMessenger progressMessenger) { using (var stream = new FileStream(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\shippingMethods.xml"), FileMode.Open)) { var enabledMarkets = MarketService.GetAllMarkets().Where(x => x.IsEnabled).ToList(); foreach (var language in enabledMarkets.SelectMany(x => x.Languages).Distinct()) { var languageId = language.TwoLetterISOLanguageName; var dto = ShippingManager.GetShippingMethods(languageId); DeleteShippingMethods(dto); ShippingManager.SaveShipping(dto); var shippingOption = dto.ShippingOption.First(x => x.Name == "Generic Gateway"); var shippingMethods = new List <ShippingMethodDto.ShippingMethodRow>(); foreach (var xShippingMethod in GetXElements(stream, "ShippingMethod")) { var method = new { Name = xShippingMethod.Get("Name"), Description = xShippingMethod.Get("Description"), CostInUSD = xShippingMethod.GetDecimalOrDefault("CostInUSD"), SortOrder = xShippingMethod.GetIntOrDefault("SortOrder") }; foreach (var currency in enabledMarkets.Where(x => x.Languages.Contains(language)).SelectMany(m => m.Currencies).Distinct()) { shippingMethods.Add(CreateShippingMethod( dto, shippingOption, languageId, method.SortOrder, method.Name + "-" + currency, string.Format(method.Description, currency, languageId), new Money(method.CostInUSD, currency), currency)); } } ShippingManager.SaveShipping(dto); AssociateShippingMethodWithMarkets(dto, enabledMarkets.Where(x => x.Languages.Contains(language)), shippingMethods); ShippingManager.SaveShipping(dto); } } }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Creating customers and orders...", false, 0); CreateContactsAndOrders(); return(true); } catch (Exception ex) { _progressMessenger.AddProgressMessageText($"CreateCustomers failed: {ex.Message} Stack trace: {ex.StackTrace}", true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex); return(false); } }
public bool Execute(IProgressMessenger progressMessenger) { progressMessenger.AddProgressMessageText($"{DateTime.Now.ToString(CultureInfo.InvariantCulture)} - Started step {GetType().Name}", false, 0); var name = GetType().Name; try { ExecuteInternal(progressMessenger); } catch (Exception ex) { progressMessenger.AddProgressMessageText($"Error executing step {name} with message\n {ex.Message}.\nPlease see log for more details.", true, 0); Logger.Error($"Error executing step {name}", ex); throw; } progressMessenger.AddProgressMessageText($"{DateTime.Now.ToString(CultureInfo.InvariantCulture)} - Ended {GetType().Name}", false, 0); progressMessenger.AddProgressMessageText("Step completed successfully", false, 0); return(true); }
protected override void ExecuteInternal(IProgressMessenger progressMessenger) { using (var stream = new FileStream(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\paymentMethods.xml"), FileMode.Open)) { var allMarkets = MarketService.GetAllMarkets().Where(x => x.IsEnabled).ToList(); foreach (var language in allMarkets.SelectMany(x => x.Languages).Distinct()) { var paymentMethodDto = PaymentManager.GetPaymentMethods(language.TwoLetterISOLanguageName); foreach (var pm in paymentMethodDto.PaymentMethod) { pm.Delete(); } PaymentManager.SavePayment(paymentMethodDto); foreach (var xPaymentMethod in GetXElements(stream, "PaymentMethod")) { var method = new { Name = xPaymentMethod.Get("Name"), SystemKeyword = xPaymentMethod.Get("SystemKeyword"), Description = xPaymentMethod.Get("Description"), PaymentClass = xPaymentMethod.Get("PaymentClass"), GatewayClass = xPaymentMethod.Get("GatewayClass"), IsDefault = xPaymentMethod.GetBoolOrDefault("IsDefault"), SortOrder = xPaymentMethod.GetIntOrDefault("SortOrder") }; AddPaymentMethod(Guid.NewGuid(), method.Name, method.SystemKeyword, method.Description, method.PaymentClass, method.GatewayClass, method.IsDefault, method.SortOrder, allMarkets, language, paymentMethodDto); } } } }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Importing product assets...", false, 0); ImportAssets(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\ProductAssets.episerverdata")); _progressMessenger.AddProgressMessageText("Enabling currencies...", false, 0); EnableCurrencies(); _progressMessenger.AddProgressMessageText("Importing catalog...", false, 0); ImportCatalog(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\Catalog_Fashion.zip")); _progressMessenger.AddProgressMessageText("Disabling default market...", false, 0); DisableDefaultMarket(); _progressMessenger.AddProgressMessageText("Configuring payment methods", false, 0); ConfigurePaymentMethods(); _progressMessenger.AddProgressMessageText("Configuring shipment methods", false, 0); ConfigureShippingMethods(); _progressMessenger.AddProgressMessageText("Creating marketing campaigns and Promotions", false, 0); ConfigureMarketing(); _progressMessenger.AddProgressMessageText("Rebuilding index...", false, 0); BuildIndex(_progressMessenger, AppContext.Current.ApplicationId, AppContext.Current.ApplicationName, true); _progressMessenger.AddProgressMessageText("Done rebuilding index", false, 0); return true; } catch (Exception ex) { _progressMessenger.AddProgressMessageText("ImportSiteContent failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex.StackTrace); return false; } }
public bool Execute(IProgressMessenger progressMessenger) { _progressMessenger = progressMessenger; try { _progressMessenger.AddProgressMessageText("Importing product assets...", false, 0); ImportAssets(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\B2BProductAssets.episerverdata")); _progressMessenger.AddProgressMessageText("Importing catalog...", false, 0); ImportCatalog(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\CatalogExport_QuicksilverB2B_20161212-183053.zip")); _progressMessenger.AddProgressMessageText("Rebuilding index...", false, 0); BuildIndex(_progressMessenger, AppContext.Current.ApplicationId, AppContext.Current.ApplicationName, true); _progressMessenger.AddProgressMessageText("Done rebuilding index", false, 0); return(true); } catch (Exception ex) { _progressMessenger.AddProgressMessageText("ImportSiteB2BContent failed: " + ex.Message + "Stack trace:" + ex.StackTrace, true, 0); LogManager.GetLogger(GetType()).Error(ex.Message, ex.StackTrace); return(false); } }
protected override void ExecuteInternal(IProgressMessenger progressMessenger) { using (var scope = DataContext.Current.MetaModel.BeginEdit(MetaClassManagerEditScope.SystemOwner, Mediachase.BusinessFoundation.Data.Meta.Management.AccessLevel.System)) { var manager = DataContext.Current.MetaModel; var changeTrackingManifest = ChangeTrackingManager.CreateModuleManifest(); var recentReferenceManifest = RecentReferenceManager.CreateModuleManifest(); var contactMetaClass = manager.MetaClasses[ContactEntity.ClassName]; var demoUserMenu = MetaEnum.Create("DemoUserMenu", "Show in Demo User Menu", false); MetaEnum.AddItem(demoUserMenu, 1, "Never", 1); MetaEnum.AddItem(demoUserMenu, 2, "Always", 2); MetaEnum.AddItem(demoUserMenu, 3, "Commerce Only", 3); using (var builder = new MetaFieldBuilder(contactMetaClass)) { builder.CreateEnumField("ShowInDemoUserMenu", "{Customer:DemoUserMenu}", "DemoUserMenu", true, "1", false); builder.CreateText("DemoUserTitle", "{Customer:DemoUserTitle}", true, 100, false); builder.CreateText("DemoUserDescription", "{Customer:DemoUserDescription}", true, 500, false); builder.SaveChanges(); } AddMetaFieldToForms(contactMetaClass, contactMetaClass.Fields["ShowInDemoUserMenu"]); AddMetaFieldToForms(contactMetaClass, contactMetaClass.Fields["DemoUserTitle"]); AddMetaFieldToForms(contactMetaClass, contactMetaClass.Fields["DemoUserDescription"]); var giftCardClass = manager.CreateMetaClass("GiftCard", "{Customer:GiftCard}", "{Customer:GiftCard}", "cls_GiftCard", PrimaryKeyIdValueType.Guid); ModuleManager.Activate(giftCardClass, changeTrackingManifest); using (var builder = new MetaFieldBuilder(giftCardClass)) { builder.CreateText("GiftCardName", "{Customer:GiftCardName}", false, 100, false); builder.CreateCurrency("InitialAmount", "{Customer:InitialAmount}", true, 0, true); builder.CreateCurrency("RemainBalance", "{Customer:RemainBalance}", true, 0, true); builder.CreateText("RedemptionCode", "{Customer:RedemptionCode}", true, 100, false); builder.CreateCheckBoxBoolean("IsActive", "{Customer:IsActive}", true, true, "{Customer:IsActive}"); giftCardClass.Fields[MetaClassManager.GetPrimaryKeyName(giftCardClass.Name)].FriendlyName = "{GlobalMetaInfo:PrimaryKeyId}"; var contactReference = builder.CreateReference("Contact", "{Customer:CreditCard_mf_Contact}", true, "Contact", false); contactReference.Attributes.Add(McDataTypeAttribute.ReferenceDisplayBlock, "InfoBlock"); contactReference.Attributes.Add(McDataTypeAttribute.ReferenceDisplayText, "{Customer:GiftCard}"); contactReference.Attributes.Add(McDataTypeAttribute.ReferenceDisplayOrder, "10000"); builder.SaveChanges(); } giftCardClass.AddPermissions(); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["GiftCardName"]); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["InitialAmount"]); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["RemainBalance"]); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["RedemptionCode"]); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["IsActive"]); AddMetaFieldToForms(giftCardClass, giftCardClass.Fields["ContactId"]); scope.SaveChanges(); } var contactProfile = @"<ListViewProfile xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <Id>{54a649a9-302f-48bd-b657-11ca3604fda9}</Id> <Name>{Customer:AllContacts}</Name> <IsSystem>true</IsSystem> <IsPublic>true</IsPublic> <FieldSetName>Contacts</FieldSetName> <FieldSet> <string>FullName</string> <string>Email</string> <string>LastOrder</string> <string>NumberOfOrders</string> <string>NumberOfReviews</string> <string>Points</string> <string>ShowInDemoUserMenu</string> <string>DemoUserTitle</string> </FieldSet> <GroupByFieldName /> <Filters /> <Sorting /> <ColumnsUI> <Column field=""FullName"" width=""150"" /> <Column field=""Email"" width=""150"" /> <Column field=""LastOrder"" width=""150"" /> <Column field=""NumberOfOrders"" width=""150"" /> <Column field=""NumberOfReviews"" width=""150"" /> <Column field=""Points"" width=""150"" /> <Column field=""ShowInDemoUserMenu"" width=""150"" /> <Column field=""DemoUserTitle"" width=""150"" /> </ColumnsUI> </ListViewProfile>"; var contactviewProfile = (ListViewProfile)_listViewProfileXmlSerializer.Deserialize(new StringReader(contactProfile)); ListViewProfile.SaveSystemProfile("Contact", "EntityList", Guid.NewGuid(), contactviewProfile); using (var stream = new FileStream(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\Customers.xml"), FileMode.Open)) { ProcessCustomers(stream); ProcessOrganizations(stream); } }
protected override void ExecuteInternal(IProgressMessenger progressMessenger) { progressMessenger.AddProgressMessageText("Creating markets...", false, 0); using (var stream = new FileStream(Path.Combine(HostingEnvironment.ApplicationPhysicalPath, @"App_Data\markets.xml"), FileMode.Open)) { foreach (var xMarket in GetXElements(stream, "Market")) { var market = new MarketImpl(xMarket.Get("MarketId")) { IsEnabled = xMarket.GetBool("IsEnabled"), MarketName = xMarket.Get("MarketName"), MarketDescription = xMarket.Get("MarketDescription") ?? xMarket.Get("MarketName"), DefaultCurrency = new Currency(xMarket.Get("DefaultCurrency")), DefaultLanguage = new CultureInfo(xMarket.Get("DefaultLanguage")), PricesIncludeTax = xMarket.GetBoolOrDefault("PricesIncludeTax") }; foreach (var xCurrency in xMarket.Element("Currencies").Elements("Currency").Distinct()) { market.CurrenciesCollection.Add(new Currency((string)xCurrency)); } foreach (var xLanguage in xMarket.Element("Languages").Elements("Language").Distinct()) { market.LanguagesCollection.Add(new CultureInfo((string)xLanguage)); } foreach (var xCountry in xMarket.Element("Countries").Elements("Country").Distinct()) { market.CountriesCollection.Add((string)xCountry); } var existingMarket = MarketService.GetMarket(market.MarketId); if (existingMarket == null) { MarketService.CreateMarket(market); } else { foreach (var currency in existingMarket.Currencies.Where(x => !market.CurrenciesCollection.Contains(x))) { market.CurrenciesCollection.Add(currency); } foreach (var language in existingMarket.Languages .Where(el => !market.Languages.Any(nl => string.Equals(el.Name, nl.Name, StringComparison.OrdinalIgnoreCase)))) { market.LanguagesCollection.Add(language); } foreach (var country in existingMarket.Countries .Where(ec => !market.Countries.Any(nc => string.Equals(ec, nc, StringComparison.OrdinalIgnoreCase)))) { market.CountriesCollection.Add(country); } MarketService.UpdateMarket(market); } } } }
protected abstract void ExecuteInternal(IProgressMessenger progressMessenger);
public ProgressPresenter(IProgressMessenger messenger) { _messenger = messenger; }
protected override void ExecuteInternal(IProgressMessenger progressMessenger) => ConfigureMarketing();
protected override void ExecuteInternal(IProgressMessenger progressMessenger) => new CurrencySetup().CreateConversions();