// Multi-Store Destroy public bool DestroyStore(long storeId) { EventLog.LogEvent("System", "Destroying Store " + storeId, EventLogSeverity.Debug); var result = true; var s = AccountServices.Stores.FindById(storeId); if (s == null) { return(false); } if (s.Id != storeId) { return(false); } DiskStorage.DestroyAllFilesForStore(storeId); //this.AccountServices.RemoveAllUsersFromStore(storeId); // Store Address var storeAddress = ContactServices.Addresses.FindStoreContactAddress(); if (storeAddress != null) { ContactServices.Addresses.Delete(storeAddress.Bvin); } // Get rid of URLs so they won't stop category/product deletes ContentServices.CustomUrls.DestoryAllForStore(storeId); // Catalog Services DestroyAllProductsForStore(storeId); DestroyAllCategoriesForStore(storeId); CatalogServices.ProductProperties.DestroyAllForStore(storeId); CatalogServices.ProductTypeDestoryAllForStore(storeId); CatalogServices.WishListItems.DestroyAllForStore(storeId); // Contact Services ContactServices.Affiliates.DestoryForStore(storeId); ContactServices.MailingLists.DestoryForStore(storeId); ContactServices.Manufacturers.DestoryAllForStore(storeId); ContactServices.PriceGroups.DestoryAllForStore(storeId); ContactServices.Vendors.DestoryAllForStore(storeId); // Content Services ContentServices.Columns.DestroyForStore(storeId); ContentServices.HtmlTemplates.DestroyAllForStore(storeId); // Customer Points CustomerPointsManager.DestroyAllForStore(storeId); // Membership MembershipServices.UserQuestions.DestroyAllForStore(storeId); MembershipServices.Customers.DestroyAllForStore(storeId); // Marketing MarketingServices.Promotions.DestroyAllForStore(storeId); // Metrics MetricsSerices.SearchQueries.DestoryAllForStore(storeId); // Orders OrderServices.Orders.DestoryAllForStore(storeId); OrderServices.ShippingMethods.DestoryAllForStore(storeId); OrderServices.ShippingZones.DestoryAllForStore(storeId); OrderServices.Taxes.DestoryAllForStore(storeId); OrderServices.TaxSchedules.DestoryAllForStore(storeId); OrderServices.Transactions.DestoryAllForStore(storeId); // Tasks ScheduleServices.QueuedTasks.DestoryAllForStore(storeId); // Account Services AccountServices.ApiKeys.DestoryAllForStore(storeId); AccountServices.Stores.Delete(storeId); if (result) { EventLog.LogEvent("System", "Finished Destroying Store " + storeId, EventLogSeverity.Debug); } else { EventLog.LogEvent("System", "Error Destroying Store " + storeId, EventLogSeverity.Warning); } return(result); }