public static bool MoveStoreFrontFolders(this StoreFrontConfiguration config, string applicationPath, HttpServerUtilityBase server, string oldFolder, BaseController controller) { string oldFolderToMap = config.ClientVirtualDirectoryToMapToStoreFronts(applicationPath) + "/" + oldFolder; string newFolderToMap = config.StoreFrontVirtualDirectoryToMap(applicationPath); string oldFolderPath = server.MapPath(oldFolderToMap); string newFolderPath = server.MapPath(newFolderToMap); //default behavior is to move the old folder to the new name if (System.IO.Directory.Exists(oldFolderPath)) { try { System.IO.Directory.Move(oldFolderPath, newFolderPath); if (controller != null) { controller.AddUserMessage("Store Front Folder Moved", "Store Front folder was moved from '" + oldFolderToMap.ToHtml() + "' to '" + newFolderToMap.ToHtml() + "'", UserMessageType.Success); } return true; } catch (Exception ex) { if (controller != null) { controller.AddUserMessage("Error Moving Client Folder!", "There was an error moving the client folder from '" + oldFolderToMap.ToHtml() + "' to '" + newFolderToMap.ToHtml() + "'. You will need to move the folder manually. Error: " + ex.Message, UserMessageType.Warning); } return false; } } else { try { bool result = config.CreateStoreFrontFolders(applicationPath, server); if (result) { if (controller != null) { controller.AddUserMessage("Folders Created", "Store Front folders were created in : " + newFolderToMap.ToHtml(), UserMessageType.Info); } return true; } return false; } catch (Exception ex) { if (controller != null) { controller.AddUserMessage("Error Creating Store Front Folders!", "There was an error creating the Store Front folders in '" + newFolderToMap.ToHtml() + "'. You will need to create the folders manually. Error: " + ex.Message, UserMessageType.Warning); } return false; } } }
public static string StoreFrontVirtualDirectoryToMapThisConfig(this StoreFrontConfiguration storeFrontConfig, string applicationPath) { if (storeFrontConfig == null) { throw new ArgumentNullException("storeFrontConfig"); } return storeFrontConfig.ClientVirtualDirectoryToMapToStoreFronts(applicationPath) + "/" + storeFrontConfig.Folder.ToFileName(); }
public static string StoreFrontVirtualDirectoryToMapAnyConfig(this StoreFront storeFront, string applicationPath) { if (storeFront.CurrentConfigOrAny() == null) { throw new ArgumentNullException("storeFront.CurrentConfigOrAny()"); } return storeFront.ClientVirtualDirectoryToMapToStoreFronts(applicationPath) + "/" + System.Web.HttpUtility.UrlEncode(storeFront.CurrentConfigOrAny().Folder.ToFileName()); }
public static string StoreFrontVirtualDirectoryToMapAnyConfig(this StoreFrontRecord record, string applicationPath) { if (record.StoreFront.CurrentConfigOrAny() == null) { throw new ArgumentNullException("record.CurrentConfigOrAny()"); } return record.ClientVirtualDirectoryToMapToStoreFronts(applicationPath) + "/" + record.StoreFront.CurrentConfigOrAny().Folder.ToFileName(); }
public static string StoreFrontVirtualDirectoryToMap(this StoreFrontRecord record, string applicationPath) { return record.ClientVirtualDirectoryToMapToStoreFronts(applicationPath) + "/" + record.StoreFront.CurrentConfig().Folder.ToFileName(); }