public static ListItem GetListItem(EBackupType type, bool selected) { var item = new ListItem(GetText(type), GetValue(type)); if (selected) { item.Selected = true; } return(item); }
public static bool Equals(EBackupType type, string typeStr) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower())) { return(true); } return(false); }
public static string GetBackupFilePath(SiteInfo siteInfo, EBackupType backupType) { var extention = ".zip"; var siteName = siteInfo.SiteDir; if (!string.IsNullOrEmpty(siteName)) { siteName += "_"; } if (backupType == EBackupType.Templates) { extention = ".xml"; } return(PathUtils.Combine(PathUtils.PhysicalSiteFilesPath, DirectoryUtils.SiteFiles.BackupFiles, siteInfo.SiteDir, DateTime.Now.ToString("yyyy-MM"), EBackupTypeUtils.GetValue(backupType) + "_" + siteName + DateTime.Now.ToString("yyyy-MM-dd-HH-mm") + extention)); }
public static string GetValue(EBackupType type) { if (type == EBackupType.Templates) { return("Templates"); } if (type == EBackupType.ChannelsAndContents) { return("ChannelsAndContents"); } if (type == EBackupType.Files) { return("Files"); } if (type == EBackupType.Site) { return("Site"); } return("Undefined"); }
public static string GetText(EBackupType type) { if (type == EBackupType.Templates) { return("显示模板"); } if (type == EBackupType.ChannelsAndContents) { return("栏目及内容"); } if (type == EBackupType.Files) { return("文件"); } if (type == EBackupType.Site) { return("整站"); } return("Undefined"); }
private static bool BackupByPublishmentSystemID(TaskInfo taskInfo, int publishmentSystemID, EBackupType backupType) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID); if (publishmentSystemInfo == null) { ExecutionUtils.LogError(taskInfo, new Exception("无法找到对应站点")); return(false); } var filePath = PathUtility.GetBackupFilePath(publishmentSystemInfo, backupType); DirectoryUtils.CreateDirectoryIfNotExists(filePath); FileUtils.DeleteFileIfExists(filePath); if (backupType == EBackupType.Templates) { BackupUtility.BackupTemplates(publishmentSystemInfo.PublishmentSystemId, filePath); } else if (backupType == EBackupType.ChannelsAndContents) { BackupUtility.BackupChannelsAndContents(publishmentSystemInfo.PublishmentSystemId, filePath); } else if (backupType == EBackupType.Files) { BackupUtility.BackupFiles(publishmentSystemInfo.PublishmentSystemId, filePath); } else if (backupType == EBackupType.Site) { BackupUtility.BackupSite(publishmentSystemInfo.PublishmentSystemId, filePath); } return(true); }
public static bool Equals(string typeStr, EBackupType type) { return(Equals(type, typeStr)); }