public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("isRedirectToFiles")) { var redirectUrl = PageUtils.GetCmsUrl("PageFileMain", new NameValueCollection { { "RootPath", $"~/SiteFiles/BackupFiles/{PublishmentSystemInfo.PublishmentSystemDir}" } }); PageUtils.Redirect(redirectUrl); return; } if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdBackup, "数据备份", AppManager.Cms.Permission.WebSite.Backup); EBackupTypeUtils.AddListItems(BackupType); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (!IsPostBack) { BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdBackup, "数据恢复", AppManager.Cms.Permission.WebSite.Backup); EBackupTypeUtils.AddListItems(BackupType); ControlUtils.SelectListItems(BackupType, EBackupTypeUtils.GetValue(EBackupType.Templates)); EBooleanUtils.AddListItems(IsRecoveryByUpload, "从上传文件中恢复", "从服务器备份文件中恢复"); ControlUtils.SelectListItems(IsRecoveryByUpload, true.ToString()); Options_SelectedIndexChanged(null, EventArgs.Empty); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _serviceType = EServiceTypeUtils.GetEnumType(Body.GetQueryString("ServiceType")); if (!IsPostBack) { EFrequencyTypeUtils.AddListItems(FrequencyType, false); for (var i = 1; i < 32; i++) { StartDay.Items.Add(new ListItem(i + "日", i.ToString())); } for (var i = 1; i < 8; i++) { var weekName = string.Empty; if (i == 1) { weekName = "星期一"; } else if (i == 2) { weekName = "星期二"; } else if (i == 3) { weekName = "星期三"; } else if (i == 4) { weekName = "星期四"; } else if (i == 5) { weekName = "星期五"; } else if (i == 6) { weekName = "星期六"; } else if (i == 7) { weekName = "星期日"; } StartWeekday.Items.Add(new ListItem(weekName, i.ToString())); } for (var i = 0; i < 24; i++) { StartHour.Items.Add(new ListItem(i + "点", i.ToString())); } var listItem = new ListItem("周", "5040"); PeriodIntervalType.Items.Add(listItem); listItem = new ListItem("天", "720"); PeriodIntervalType.Items.Add(listItem); listItem = new ListItem("小时", "12"); PeriodIntervalType.Items.Add(listItem); listItem = new ListItem("分钟", "1"); listItem.Selected = true; PeriodIntervalType.Items.Add(listItem); if (_serviceType == EServiceType.Create) { PlaceHolder_Create.Visible = true; if (PublishmentSystemId != 0) { NodeManager.AddListItems(CreateChannelIDCollection.Items, PublishmentSystemInfo, false, true, Body.AdministratorName); } else { var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList(); foreach (int publishmentSystemID in arraylist) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID); var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString()); CreateChannelIDCollection.Items.Add(item); } } ECreateTypeUtils.AddListItems(CreateCreateTypes); } else if (_serviceType == EServiceType.Gather) { PlaceHolder_Gather.Visible = true; if (PublishmentSystemId != 0) { var gatherRuleNameArrayList = DataProvider.GatherRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId); var gatherTypeValue = EGatherTypeUtils.GetValue(EGatherType.Web); var gatherTypeText = EGatherTypeUtils.GetText(EGatherType.Web); foreach (string gatherName in gatherRuleNameArrayList) { GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName)); } gatherRuleNameArrayList = DataProvider.GatherDatabaseRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId); gatherTypeValue = EGatherTypeUtils.GetValue(EGatherType.Database); gatherTypeText = EGatherTypeUtils.GetText(EGatherType.Database); foreach (string gatherName in gatherRuleNameArrayList) { GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName)); } gatherRuleNameArrayList = DataProvider.GatherFileRuleDao.GetGatherRuleNameArrayList(PublishmentSystemId); gatherTypeValue = EGatherTypeUtils.GetValue(EGatherType.File); gatherTypeText = EGatherTypeUtils.GetText(EGatherType.File); foreach (string gatherName in gatherRuleNameArrayList) { GatherListBox.Items.Add(new ListItem(gatherName + "(" + gatherTypeText + ")", gatherTypeValue + "_" + gatherName)); } GatherHelp.Text = "选择需要定时执行的采集名称"; } else { var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList(); foreach (int publishmentSystemID in arraylist) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID); var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString()); GatherListBox.Items.Add(item); } GatherHelp.Text = "选择需要定时采集的站点"; } } else if (_serviceType == EServiceType.Backup) { PlaceHolder_Backup.Visible = true; if (PublishmentSystemId != 0) { PlaceHolder_Backup_PublishmentSystem.Visible = false; } else { PlaceHolder_Backup_PublishmentSystem.Visible = true; var arraylist = PublishmentSystemManager.GetPublishmentSystemIdList(); foreach (int publishmentSystemID in arraylist) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID); var item = new ListItem(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemId.ToString()); BackupPublishmentSystemIDCollection.Items.Add(item); } } EBackupTypeUtils.AddListItems(BackupType); } if (Body.IsQueryExists("TaskID")) { var taskId = Body.GetQueryInt("TaskID"); var taskInfo = DataProvider.TaskDao.GetTaskInfo(taskId); if (taskInfo != null) { TaskName.Text = taskInfo.TaskName; TaskName.Enabled = false; ControlUtils.SelectListItems(FrequencyType, EFrequencyTypeUtils.GetValue(taskInfo.FrequencyType)); ControlUtils.SelectListItems(StartDay, taskInfo.StartDay.ToString()); ControlUtils.SelectListItems(StartWeekday, taskInfo.StartWeekday.ToString()); ControlUtils.SelectListItems(StartHour, taskInfo.StartHour.ToString()); if (taskInfo.PeriodIntervalMinute % 5040 == 0) { PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 5040).ToString(); ControlUtils.SelectListItems(PeriodIntervalType, "5040"); } else if (taskInfo.PeriodIntervalMinute % 720 == 0) { PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 720).ToString(); ControlUtils.SelectListItems(PeriodIntervalType, "720"); } else if (taskInfo.PeriodIntervalMinute % 12 == 0) { PeriodInterval.Text = Convert.ToInt32(taskInfo.PeriodIntervalMinute / 12).ToString(); ControlUtils.SelectListItems(PeriodIntervalType, "12"); } else { PeriodInterval.Text = taskInfo.PeriodIntervalMinute.ToString(); ControlUtils.SelectListItems(PeriodIntervalType, "1"); } Description.Text = taskInfo.Description; if (_serviceType == EServiceType.Create) { var taskCreateInfo = new TaskCreateInfo(taskInfo.ServiceParameters); if (taskCreateInfo.IsCreateAll) { foreach (ListItem item in CreateChannelIDCollection.Items) { item.Selected = true; } CreateIsCreateAll.Checked = true; } else { var channelIdList = TranslateUtils.StringCollectionToStringList(taskCreateInfo.ChannelIDCollection); ControlUtils.SelectListItems(CreateChannelIDCollection, channelIdList); CreateIsCreateAll.Checked = false; } var createTypeArrayList = TranslateUtils.StringCollectionToStringList(taskCreateInfo.CreateTypes); foreach (ListItem item in CreateCreateTypes.Items) { if (createTypeArrayList.Contains(item.Value)) { item.Selected = true; } else { item.Selected = false; } } } else if (_serviceType == EServiceType.Gather) { var taskGatherInfo = new TaskGatherInfo(taskInfo.ServiceParameters); if (PublishmentSystemId != 0) { var webGatherNames = TranslateUtils.StringCollectionToStringList(taskGatherInfo.WebGatherNames); var databaseGatherNames = TranslateUtils.StringCollectionToStringList(taskGatherInfo.DatabaseGatherNames); var fileGatherNames = TranslateUtils.StringCollectionToStringList(taskGatherInfo.FileGatherNames); foreach (ListItem item in GatherListBox.Items) { var gatherType = EGatherTypeUtils.GetEnumType(item.Value.Split('_')[0]); var gatherName = item.Value.Substring(item.Value.Split('_')[0].Length + 1); if (gatherType == EGatherType.Web && webGatherNames.Contains(gatherName)) { item.Selected = true; } else if (gatherType == EGatherType.Database && databaseGatherNames.Contains(gatherName)) { item.Selected = true; } else if (gatherType == EGatherType.File && fileGatherNames.Contains(gatherName)) { item.Selected = true; } } } else { var publishmentSystemIdList = TranslateUtils.StringCollectionToStringList(taskGatherInfo.PublishmentSystemIDCollection); ControlUtils.SelectListItems(GatherListBox, publishmentSystemIdList); } } else if (_serviceType == EServiceType.Backup) { var taskBackupInfo = new TaskBackupInfo(taskInfo.ServiceParameters); if (taskInfo.PublishmentSystemID == 0) { if (taskBackupInfo.IsBackupAll) { foreach (ListItem item in BackupPublishmentSystemIDCollection.Items) { item.Selected = true; } BackupIsBackupAll.Checked = true; } else { var publishmentSystemIdList = TranslateUtils.StringCollectionToStringList(taskBackupInfo.PublishmentSystemIDCollection); ControlUtils.SelectListItems(BackupPublishmentSystemIDCollection, publishmentSystemIdList); BackupIsBackupAll.Checked = false; } } else { ControlUtils.SelectListItems(BackupPublishmentSystemIDCollection, taskInfo.PublishmentSystemID.ToString()); } ControlUtils.SelectListItems(BackupType, EBackupTypeUtils.GetValue(taskBackupInfo.BackupType)); } } } FrequencyType_SelectedIndexChanged(null, EventArgs.Empty); } }