private object backupcfgPro(object param) { string str_folder = (string)param; this.syncThreshold(); DeviceOperation.RefreshDBCache(false); EcoGlobalVar.setDashBoardFlg(2uL, "", 0); int num = Backuptask.BackupConfig4UI(str_folder); return(num); }
private object RestorecfgPro(object param) { string str_file = (string)param; EcoGlobalVar.ECOAppRunStatus = 2; Program.StopService(EcoGlobalVar.gl_ServiceName, 30000); System.Threading.Thread.Sleep(3000); int num = Backuptask.RestoreConfig(str_file); InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .setInterProcessKeyValue("ServiceStDBMaintain", "DBMaintainFinish"); Program.StartService(null); return(num); }
public void pageInit() { this.dataGridViewCfgTasks.Rows.Clear(); System.Collections.Generic.List <Backuptask> allTask = Backuptask.GetAllTask(); int num = 0; foreach (Backuptask current in allTask) { string msg = EcoLanguage.getMsg(LangRes.Task_TPDaily, new string[0]); switch (current.TaskType) { case 0: msg = EcoLanguage.getMsg(LangRes.Task_TPDaily, new string[0]); break; case 1: msg = EcoLanguage.getMsg(LangRes.Task_TPWeekly, new string[0]); break; } object[] values = new object[] { num + 1, current.TaskName, msg, current.Filepath, current.ID.ToString() }; this.dataGridViewCfgTasks.Rows.Add(values); num++; } if (this.dataGridViewCfgTasks.Rows.Count == 0) { this.butModify.Enabled = false; this.butDelete.Enabled = false; return; } this.butModify.Enabled = true; this.butDelete.Enabled = true; }
private void butDelete_Click(object sender, System.EventArgs e) { string value = this.dataGridViewCfgTasks.CurrentRow.Cells[4].Value.ToString(); long i_taskid = (long)System.Convert.ToInt32(value); DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.Task_delCrm, new string[0]), MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.Cancel) { return; } Backuptask taskByID = Backuptask.GetTaskByID(i_taskid); int num = Backuptask.DeleteTaskByID(i_taskid); if (num < 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0530001", new string[] { taskByID.TaskName, valuePair }); } else { LogAPI.writeEventLog("0530001", new string[] { taskByID.TaskName }); } this.pageInit(); }
private bool checkValue() { bool flag = false; Ecovalidate.checkTextIsNull(this.tbTaskName, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbTaskname.Text })); return(false); } string text = this.tbTaskName.Text; if (!Backuptask.CheckName(this.m_taskID, text)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Task_nmdup, new string[] { text })); this.tbTaskName.Focus(); return(false); } if (this.rbStore_SMB.Checked) { Ecovalidate.checkTextIsNull(this.tbSMBDir, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbSMBDir.Text })); return(false); } string text2 = this.tbSMBDir.Text; if (text2.Length > 255) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.maxlength, new string[] { this.lbSMBDir.Text, 255.ToString() })); return(false); } } else { Ecovalidate.checkTextIsNull(this.tbFTPServer, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbFTPServer.Text })); return(false); } Ecovalidate.checkTextIsNull(this.tbFTPPort, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbFTPport.Text })); return(false); } if (!Ecovalidate.Rangeint(this.tbFTPPort, 1, 65535)) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[] { this.lbFTPport.Text, "1", "65535" })); return(false); } string text3 = this.tbFTPDir.Text; if (text3.Length > 255) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.maxlength, new string[] { this.lbFTPDir.Text, 255.ToString() })); return(false); } if (!this.cbFTPAuth.Checked) { Ecovalidate.checkTextIsNull(this.tbFTPUsername, ref flag); if (flag) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[] { this.lbFTPUsername.Text })); return(false); } } } if (this.cbTaskType.SelectedItem.Equals(this.m_TPDaily)) { string arg_2A6_0 = this.dtPickerOnD00.Text; } else { if (!this.checkBoxOnW01.Checked && !this.checkBoxOnW02.Checked && !this.checkBoxOnW03.Checked && !this.checkBoxOnW04.Checked && !this.checkBoxOnW05.Checked && !this.checkBoxOnW06.Checked && !this.checkBoxOnW07.Checked) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Task_timeStartneed, new string[0])); return(false); } } return(true); }
private void butSave_Click(object sender, System.EventArgs e) { if (!this.checkValue()) { return; } string text = this.tbTaskName.Text; int num; string text2; string text3; string text4; string text5; int num2; if (this.rbStore_SMB.Checked) { num = 2; text2 = this.tbSMBUsername.Text; text3 = this.tbSMBPsw.Text; text4 = this.tbSMBDir.Text; text5 = ""; num2 = 0; } else { num = 1; text5 = this.tbFTPServer.Text; num2 = System.Convert.ToInt32(this.tbFTPPort.Text); text4 = this.tbFTPDir.Text; if (this.cbFTPAuth.Checked) { text2 = ""; text3 = this.tbFTPPsw.Text; } else { text2 = this.tbFTPUsername.Text; text3 = this.tbFTPPsw.Text; } } int num3; string[] array; if (this.cbTaskType.SelectedItem.Equals(this.m_TPDaily)) { num3 = 0; array = new string[1]; string text6 = this.dtPickerOnD00.Text; array[0] = text6 + ":00"; } else { num3 = 1; array = new string[7]; if (this.checkBoxOnW01.Checked) { array[0] = this.dtPickerOnW01.Text + ":00"; } else { array[0] = ""; } if (this.checkBoxOnW02.Checked) { array[1] = this.dtPickerOnW02.Text + ":00"; } else { array[1] = ""; } if (this.checkBoxOnW03.Checked) { array[2] = this.dtPickerOnW03.Text + ":00"; } else { array[2] = ""; } if (this.checkBoxOnW04.Checked) { array[3] = this.dtPickerOnW04.Text + ":00"; } else { array[3] = ""; } if (this.checkBoxOnW05.Checked) { array[4] = this.dtPickerOnW05.Text + ":00"; } else { array[4] = ""; } if (this.checkBoxOnW06.Checked) { array[5] = this.dtPickerOnW06.Text + ":00"; } else { array[5] = ""; } if (this.checkBoxOnW07.Checked) { array[6] = this.dtPickerOnW07.Text + ":00"; } else { array[6] = ""; } } int num4; if (this.m_taskID < 0L) { num4 = Backuptask.CreateTask(text, num3, num, text2, text3, text5, num2, text4, array); if (num4 > 0) { string valuePair = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair)) { LogAPI.writeEventLog("0530000", new string[] { text, valuePair }); } else { LogAPI.writeEventLog("0530000", new string[] { text }); } } } else { Backuptask taskByID = Backuptask.GetTaskByID(this.m_taskID); taskByID.TaskName = text; taskByID.TaskType = num3; taskByID.STOREType = num; taskByID.Host = text5; taskByID.UserName = text2; taskByID.Password = text3; taskByID.Port = num2; taskByID.Filepath = text4; taskByID.TaskSchedule = array; num4 = taskByID.UpdateTask(); if (num4 > 0) { string valuePair2 = ValuePairs.getValuePair("Username"); if (!string.IsNullOrEmpty(valuePair2)) { LogAPI.writeEventLog("0530002", new string[] { text, valuePair2 }); } else { LogAPI.writeEventLog("0530002", new string[] { text }); } } } if (num4 < 0) { EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0])); return; } EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0])); base.DialogResult = DialogResult.OK; base.Close(); }
public CfgBackupTaskDlg(long taskID) { this.InitializeComponent(); this.m_taskID = taskID; this.cbTaskType.Items.Clear(); this.cbTaskType.Items.Add(this.m_TPDaily); this.cbTaskType.Items.Add(this.m_TPWeekly); this.cbTaskType.SelectedItem = this.m_TPDaily; this.tbFTPPort.Text = "21"; if (taskID <= 0L) { this.tbSMBUsername.Enabled = false; this.tbSMBPsw.Enabled = false; this.rbStore_SMB.Checked = true; return; } Backuptask taskByID = Backuptask.GetTaskByID(taskID); this.tbTaskName.Text = taskByID.TaskName; if (taskByID.STOREType == 0 || taskByID.STOREType == 2) { this.rbStore_SMB.Checked = true; this.tbSMBUsername.Text = taskByID.UserName; this.tbSMBPsw.Text = taskByID.Password; this.tbSMBDir.Text = taskByID.Filepath; } else { this.rbStore_FTP.Checked = true; this.tbFTPServer.Text = taskByID.Host; this.tbFTPPort.Text = System.Convert.ToString(taskByID.Port); this.tbFTPDir.Text = taskByID.Filepath; if (taskByID.UserName.Length > 0) { this.cbFTPAuth.Checked = false; this.tbFTPUsername.Text = taskByID.UserName; this.tbFTPPsw.Text = taskByID.Password; } else { this.cbFTPAuth.Checked = true; } } if (taskByID.TaskType == 0) { this.cbTaskType.SelectedItem = this.m_TPDaily; this.dtPickerOnD00.Text = taskByID.TaskSchedule[0]; return; } this.cbTaskType.SelectedItem = this.m_TPWeekly; if (taskByID.TaskSchedule[0].Length == 0) { this.checkBoxOnW01.Checked = false; } else { this.checkBoxOnW01.Checked = true; this.dtPickerOnW01.Text = taskByID.TaskSchedule[0]; } if (taskByID.TaskSchedule[1].Length == 0) { this.checkBoxOnW02.Checked = false; } else { this.checkBoxOnW02.Checked = true; this.dtPickerOnW02.Text = taskByID.TaskSchedule[1]; } if (taskByID.TaskSchedule[2].Length == 0) { this.checkBoxOnW03.Checked = false; } else { this.checkBoxOnW03.Checked = true; this.dtPickerOnW03.Text = taskByID.TaskSchedule[2]; } if (taskByID.TaskSchedule[3].Length == 0) { this.checkBoxOnW04.Checked = false; } else { this.checkBoxOnW04.Checked = true; this.dtPickerOnW04.Text = taskByID.TaskSchedule[3]; } if (taskByID.TaskSchedule[4].Length == 0) { this.checkBoxOnW05.Checked = false; } else { this.checkBoxOnW05.Checked = true; this.dtPickerOnW05.Text = taskByID.TaskSchedule[4]; } if (taskByID.TaskSchedule[5].Length == 0) { this.checkBoxOnW06.Checked = false; } else { this.checkBoxOnW06.Checked = true; this.dtPickerOnW06.Text = taskByID.TaskSchedule[5]; } if (taskByID.TaskSchedule[6].Length == 0) { this.checkBoxOnW07.Checked = false; return; } this.checkBoxOnW07.Checked = true; this.dtPickerOnW07.Text = taskByID.TaskSchedule[6]; }