Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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];
        }