Beispiel #1
0
        /// <summary>
        /// RTX机器人配置
        /// </summary>
        private void toolStripButtonSet_Click(object sender, EventArgs e)
        {
            if (!toolStripButtonStart.Enabled)
            {
                MessageBox.Show("停止服务后再进行配置", "提示消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (toolStripButtonSet.Text == "RTX配置保存")
            {
                try
                {
                    string RIP          = tboxRIP.Text;
                    string RPORT        = tboxRPort.Text;
                    string RUSER        = tboxRUser.Text;
                    string RPSW         = tboxRPSW.Text;
                    string TCONN        = textBoxConnStr.Text;
                    string TUSER        = textBoxTFSUser.Text;
                    string TPSW         = textBoxTFSPsw.Text;
                    string TMAIL        = tboxMailIP.Text;
                    string TQUN         = radioButtonGroup.Checked.ToString();
                    string TSYS         = checkBoxSys.Checked.ToString();
                    string TSYSTIME     = tboxSysAlertTime.Text;
                    string TIM          = checkBoxIM.Checked.ToString();
                    string TMAILPORT    = tboxMailPort.Text;
                    string TFSDETAILURL = textBoxTFSDetailURL.Text;

                    if (!WinUtil.IsDouble(TSYSTIME))
                    {
                        WriteLog("系统消息显示时间(秒)输入格式不正确");
                        return;
                    }

                    string sql = "UPDATE CONFIG SET RIP='" + RIP + "',RPORT='" + RPORT + "',RUSER='******',RPSW='" + RPSW + "',TCONN='" + TCONN + "',TUSER='******',TPSW='" + TPSW + "',TMAIL='" + TMAIL + "',TQUN='" + TQUN + "',TSYS='" + TSYS + "',TSYSTIME='" + TSYSTIME + "',TIM='" + TIM + "',TMAILPORT='" + TMAILPORT + "',TFSDETAILURL='" + TFSDETAILURL + "' WHERE ID=1";
                    DbHelperSQLite.connectionString = _sqlitstr;
                    int row = DbHelperSQLite.ExecuteSql(sql);
                    if (row >= 1)
                    {
                        WriteLog("RTX配置保存成功!");
                        toolStripButtonSet.Text  = "RTX配置";
                        tboxRIP.Enabled          = false;
                        tboxRPort.Enabled        = false;
                        tboxRUser.Enabled        = false;
                        tboxRPSW.Enabled         = false;
                        textBoxConnStr.Enabled   = false;
                        textBoxTFSUser.Enabled   = false;
                        textBoxTFSPsw.Enabled    = false;
                        tboxMailIP.Enabled       = false;
                        radioButtonGroup.Enabled = false;
                        radioButtonOne.Enabled   = false;
                        checkBoxSys.Enabled      = false;
                        checkBoxIM.Enabled       = false;
                        tboxSysAlertTime.Enabled = false;
                        lblSysAlertTime.Enabled  = false;

                        tboxMailPort.Enabled        = false;
                        textBoxTFSDetailURL.Enabled = false;
                    }
                    else
                    {
                        WriteLog("RTX配置保存失败!");
                    }
                }
                catch (System.Exception ex)
                {
                    WriteLog("RTX配置保存失败!" + ex.Message);
                }
            }
            else
            {
                toolStripButtonSet.Text  = "RTX配置保存";
                tboxRIP.Enabled          = true;
                tboxRPort.Enabled        = true;
                tboxRUser.Enabled        = true;
                tboxRPSW.Enabled         = true;
                textBoxConnStr.Enabled   = true;
                textBoxTFSUser.Enabled   = true;
                textBoxTFSPsw.Enabled    = true;
                tboxMailIP.Enabled       = true;
                radioButtonGroup.Enabled = true;
                radioButtonOne.Enabled   = true;
                checkBoxSys.Enabled      = true;
                checkBoxIM.Enabled       = true;
                tboxSysAlertTime.Enabled = true;
                lblSysAlertTime.Enabled  = true;

                tboxMailPort.Enabled        = true;
                textBoxTFSDetailURL.Enabled = true;
            }
        }