コード例 #1
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
        private void timerStatus_Tick(object sender, EventArgs e)
        {
            try
            {
                RefreshStatus();
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }

            try
            {
                RefreshStatus4WebAutoUpdate();
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }

            try
            {
                RefreshStatus4DBAutoBackUp();
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #2
0
ファイル: frmServerForm.cs プロジェクト: BsJia/WeightManager
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtInPath.Text.TrimEnd() != "" && !Directory.Exists(this.txtInPath.Text))
                {
                    throw new Exception("[入场图片保存路径]不存在,请输入有效并且可访问的目录!保存失败!");
                }
                if (this.txtOutPath.Text.TrimEnd() != "" && !Directory.Exists(this.txtOutPath.Text))
                {
                    throw new Exception("[出场图片保存路径]不存在,请输入有效并且可访问的目录!保存失败!");
                }
                if (this.txtOutPath.Text.TrimEnd() != "" &&
                    this.txtOutPath.Text.TrimEnd() == this.txtInPath.Text.TrimEnd())
                {
                    throw new Exception("[入场图片保存路径]和[出场图片保存路径]不能相同!保存失败!");
                }

                string   strIniPath = Path.Combine(Application.StartupPath, "LBPicturePath.ini");
                IniClass ini        = new IniClass(strIniPath);
                ini.WriteValue("Path", "InPath", this.txtInPath.Text);
                ini.WriteValue("Path", "OutPath", this.txtOutPath.Text);
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #3
0
        private void btnInstallSure_Click(object sender, EventArgs e)
        {
            try
            {
                string strServiceName = txtServiceName.Text.Trim();
                if (strServiceName != LB.RMT.Base.ConfigHelper.ServiceName)
                {
                    if (MonitorHelper.ShowConfirmMessage("修改服务名,将重新安装所有服务,是否继续?") != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                }

                string strMsg = SaveInstallServices();
                if (!string.IsNullOrWhiteSpace(strMsg))
                {
                    MonitorHelper.ShowNormalMessage(strMsg);
                }
                else
                {
                    MonitorHelper.ShowNormalMessage("保存并安装服务完成");
                }
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #4
0
ファイル: WebLinkHelper.cs プロジェクト: BsJia/WeightManager
        public static void SaveConfig(List <string> OrderConfigLists)
        {
            try
            {
                string strPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
                strPath  = strPath.Substring(0, strPath.LastIndexOf(@"\"));      // 去掉文件名,得到目录
                strPath += (strPath.EndsWith(@"\ServerPlg\") ? "" : @"\ServerPlg\") + "WebLink.ini";

                //创建名称为WebLink.ini文件
                using (FileStream fs = new FileStream(strPath, FileMode.Create))
                {
                    //fs.SetLength(0);
                    using (StreamWriter sw = new StreamWriter(fs, Encoding.GetEncoding("GB2312")))
                    {
                        for (int i = 0, j = OrderConfigLists.Count; i < j; i++)
                        {
                            sw.Write(OrderConfigLists[i].ToString());
                        }
                        sw.Close();
                    }
                    fs.Close();
                }
            }
            catch (Exception ex)
            {
                MonitorHelper.ShowNormalMessage("写入连接数据库的文件出错:" + ex.Message);
            }
        }
コード例 #5
0
 private void btnCancle_Click(object sender, EventArgs e)
 {
     try
     {
         this.Close();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #6
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void btnRefresh4WebAutoUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         RefreshStatus4WebAutoUpdate();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #7
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void itemStop4itemWebAutoUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         Stop4WebAutoUpdate();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #8
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void btnRefresh4DBAutoBackUp_Click(object sender, EventArgs e)
 {
     try
     {
         RefreshStatus4DBAutoBackUp();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #9
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void itemStop4DBAutoBackUp_Click(object sender, EventArgs e)
 {
     try
     {
         Stop4DBAutoBackUp();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #10
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void btnStop_Click(object sender, EventArgs e)
 {
     try
     {
         Stop();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #11
0
ファイル: frmServerForm.cs プロジェクト: BsJia/WeightManager
 private void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         frmDisk frm = new ServiceMonitor.frmDisk();
         frm.ShowDialog();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #12
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void itemOpenForm_Click(object sender, EventArgs e)
 {
     try
     {
         this.Show();
         this.ShowInTaskbar = true;
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #13
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void itemExit_Click(object sender, EventArgs e)
 {
     try
     {
         mbCloseFromNotifyIcon = true;
         this.Close();
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #14
0
        private void btnUnInstall_Click(object sender, EventArgs e)
        {
            try
            {
                if (clbService.CheckedItems.Count == 0)
                {
                    MonitorHelper.ShowNormalMessage("请先选择要卸装的服务");
                    return;
                }

                if (MonitorHelper.ShowConfirmMessage("确认卸载选择的服务?") != System.Windows.Forms.DialogResult.Yes)
                {
                    return;
                }

                List <ServiceTool.ServiceHelper> lsService = new List <ServiceTool.ServiceHelper>(0);
                for (int i = 0; i < clbService.Items.Count; i++)
                {
                    bool b = clbService.GetItemChecked(i);
                    if (!b)
                    {
                        continue;
                    }

                    string item = clbService.Items[i].ToString();

                    if (item.StartsWith("M3主服务"))
                    {
                        lsService.Add(_sh_M3);
                    }
                    else if (item.StartsWith("自动更新服务"))
                    {
                        lsService.Add(_sh_WebAutoUpdate);
                    }
                    else if (item.StartsWith("自动备份服务"))
                    {
                        lsService.Add(_sh_DBAutoBackUp);
                    }
                }

                foreach (ServiceTool.ServiceHelper service in lsService)
                {
                    service.Uninstall();
                }

                MonitorHelper.ShowNormalMessage("卸装服务完成");
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #15
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void btnConfig_Click(object sender, EventArgs e)
 {
     try
     {
         using (frmRemoteConfig frm = new frmRemoteConfig(this))
         {
             frm.ShowDialog();
         }
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #16
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void notifyIconTS_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     try
     {
         if (e.Button == MouseButtons.Left)
         {
             this.Show();
             this.ShowInTaskbar = true;
         }
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #17
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
 private void ServerForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (!mbCloseFromNotifyIcon && e.CloseReason == CloseReason.UserClosing)
         {
             this.ShowInTaskbar = false;
             this.Hide();
             e.Cancel = true;
         }
     }
     catch (Exception err)
     {
         MonitorHelper.DealWithError(err);
     }
 }
コード例 #18
0
ファイル: frmServerForm.cs プロジェクト: BsJia/WeightManager
        private void ServerForm_Load(object sender, EventArgs e)
        {
            try
            {
                // 读取 remoting 相关的配置
                LB.RMT.Base.ConfigHelper.ReadIniConfig();
                // 显示 URL
                txtServerURL.Text = "tcp://" + LB.RMT.Base.ConfigHelper.ServiceURL + "/LBRMT";
                txtName.Text      = LB.RMT.Base.ConfigHelper.ServiceName;

                // 自动更新
                //txtName4WebAutoUpdate.Text = ServiceName4WebAutoUpdate;
                //mbIsWithUpdateService = LB.Web.Base.ConfigHelper.WithUpdateService;

                //if( !mbIsWithUpdateService )
                {
                    tcService.TabPages.Remove(tpWebAutoUpdate);
                    itemWebAutoUpdate.Visible = false;
                }

                // 自动备份服务
                //txtName4DBAutoBackUp.Text = ServiceName4DBAutoBackUp;
                //mbIsWithDBAutoBackUp = LB.Web.Base.ConfigHelper.WithBackupService;
                //if( !mbIsWithDBAutoBackUp )
                {
                    tcService.TabPages.Remove(tpDBAutoBackUp);
                    itemDBAutoBackUp.Visible = false;
                }

                // 网上订单配置按钮
                //if( TS.DW.Setting.SettingDBType.DisplayNETORDER )
                //{
                //    btnWebLink.Visible = true;
                //    btnConfig.Location = new Point( 110, btnConfig.Location.Y );
                //}

                // 定时刷新状态
                timerStatus.Enabled = true;
                timerStatus.Start();

                LoadPictureSavePath();//读取保存路径
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #19
0
        private void frmRemoteConfig_Load(object sender, EventArgs e)
        {
            try
            {
                this.txtMachineName.Text = System.Environment.MachineName;

                IPHostEntry ihe   = Dns.GetHostByName(Dns.GetHostName());
                string      strIP = "";
                for (int i = 0, j = ihe.AddressList.Length; i < j; i++)
                {
                    IPAddress myself = ihe.AddressList[i];

                    strIP += (strIP == "" ? "" : "/") + myself.ToString();
                }

                this.txtIP.Text   = strIP;
                this.txtPort.Text = LB.RMT.Base.ConfigHelper.Port.ToString();

                this.txtDBUser.Text = LB.RMT.Base.ConfigHelper.DBUser;
                this.txtDBPW.Text   = LB.RMT.Base.ConfigHelper.DBPW;
                this.txtLoginSecure.SelectedIndex = LB.RMT.Base.ConfigHelper.LoginSecure ? 1 : 0;

                //客户端登录设置
                //强制局域网模式
                //强制互联网模式
                string strRemotingForceMode = "强制互联网模式";
                if (LB.RMT.Base.ConfigHelper.RemotingForceMode == 1)
                {
                    strRemotingForceMode = "强制局域网模式";
                }
                else if (LB.RMT.Base.ConfigHelper.RemotingForceMode == 2)
                {
                    strRemotingForceMode = "强制互联网模式";
                }
                else
                {
                    strRemotingForceMode = "客户端登录设置";
                }
                lstRemotingForceMode.Text = strRemotingForceMode;
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #20
0
        private void frmWebLinkConfig_Load(object sender, EventArgs e)
        {
            try
            {
                WebLinkHelper.GetConfig();

                txtT3LoginName.Text         = WebLinkHelper.T3LoginName;
                txtNetOrderUrl.Text         = WebLinkHelper.WebServiceURL;
                cbTrantion.SelectedIndex    = WebLinkHelper.SynchronType == 0 ? 0 : 1;
                cbSaveInfoUrl.SelectedIndex = WebLinkHelper.SaveInfo == 0 ? 0 : 1;

                WebLinkHelper.GetConnectionMsg(WebLinkHelper.WebConnectionString,
                                               txtNetServer, txtNetDB, txtNetUser, txtNetPassword);
                WebLinkHelper.GetConnectionMsg(WebLinkHelper.T3ConnectionString,
                                               txtT3Server, txtT3DB, txtT3User, txtT3Password);
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #21
0
        private void btnTestRun_Click(object sender, EventArgs e)
        {
            try
            {
                if (clbService.CheckedItems.Count == 0)
                {
                    MonitorHelper.ShowNormalMessage("请先选择要测试启动的服务");
                    return;
                }

                string path = Application.StartupPath;
                for (int i = 0; i < clbService.Items.Count; i++)
                {
                    bool b = clbService.GetItemChecked(i);
                    if (!b)
                    {
                        continue;
                    }

                    string item = clbService.Items[i].ToString();

                    if (item.StartsWith("M3主服务"))
                    {
                        RunDev(Path.Combine(path, "LB.Web.Server.exe"));
                    }
                    else if (item.StartsWith("自动更新服务"))
                    {
                        //lsService.Add( _sh_WebAutoUpdate );
                    }
                    else if (item.StartsWith("自动备份服务"))
                    {
                        RunDev(Path.Combine(path, "ServerBak\\TS.ServerBak.ServiceDev.exe"));
                    }
                }
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #22
0
ファイル: WebLinkHelper.cs プロジェクト: BsJia/WeightManager
        //private static string mstrConfigRest = string.Empty;

        //private static string MC_strConnectionByUser = "******";

        public static void GetConfig()
        {
            try
            {
                string strPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
                strPath  = strPath.Substring(0, strPath.LastIndexOf(@"\"));      // 去掉文件名,得到目录
                strPath += (strPath.EndsWith(@"\ServerPlg\") ? "" : @"\ServerPlg\") + "WebLink.ini";

                if (File.Exists(strPath))
                {
                    string[] readText = File.ReadAllLines(strPath, Encoding.GetEncoding("GB2312"));
                    mstrWebConnectionString = readText[0];
                    mstrT3ConnectionString  = readText[1];
                    mstrT3LoginName         = readText[2];
                    mstrWebServiceURL       = readText[3];// + "/WebInterFace.asmx";

                    if (readText.Length >= 5 && readText[4].ToString().TrimEnd() != string.Empty)
                    {
                        int.TryParse(readText[4], out miSynchronType);
                    }

                    if (readText.Length >= 6 && readText[5].ToString().TrimEnd() != string.Empty)
                    {
                        int.TryParse(readText[5], out miSaveInfo);
                    }

                    //StringBuilder sb = new StringBuilder();
                    //for( int i = 5; i < readText.Length; i++ )
                    //{
                    //    sb.AppendLine( readText[i] );
                    //}
                    //mstrConfigRest = sb.ToString();
                }
            }
            catch (Exception ex)
            {
                MonitorHelper.ShowNormalMessage("读取连接数据库的文件出错:" + ex.Message);
            }
        }
コード例 #23
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
        private void btnReStart4WebAutoUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                btnReStart4WebAutoUpdate.Enabled = btnStart4WebAutoUpdate.Enabled = btnStop4WebAutoUpdate.Enabled = false;

                if (timerReStart4WebAutoUpdate == null)
                {
                    timerReStart4WebAutoUpdate          = new Timer();
                    timerReStart4WebAutoUpdate.Interval = 500;
                    timerReStart4WebAutoUpdate.Tick    += timerReStart4WebAutoUpdate_Tick;
                }
                if (!timerReStart4WebAutoUpdate.Enabled && !mbRS4WebAutoUpdate)
                {
                    timerReStart4WebAutoUpdate.Start();
                }
            }
            catch (Exception ex)
            {
                MonitorHelper.DealWithError(ex);
            }
        }
コード例 #24
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
        private void btnReStart4DBAutoBackUp_Click(object sender, EventArgs e)
        {
            try
            {
                btnReStart4DBAutoBackUp.Enabled = btnStart4DBAutoBackUp.Enabled = btnStop4DBAutoBackUp.Enabled = false;

                if (timerReStart4DBAutoBackUp == null)
                {
                    timerReStart4DBAutoBackUp          = new Timer();
                    timerReStart4DBAutoBackUp.Interval = 500;
                    timerReStart4DBAutoBackUp.Tick    += timerReStart4DBAutoBackUp_Tick;
                }
                if (!timerReStart4DBAutoBackUp.Enabled && !mbRS4DBAutoBackUp)
                {
                    timerReStart4DBAutoBackUp.Start();
                }
            }
            catch (Exception ex)
            {
                MonitorHelper.DealWithError(ex);
            }
        }
コード例 #25
0
        private void btnInstall_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.Width == 300)
                {
                    this.Width      = 680;
                    btnInstall.Text = "安装服务<<";

                    InitService();
                    BindServices();
                }
                else
                {
                    this.Width      = 300;
                    btnInstall.Text = "安装服务>>";
                }
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #26
0
        private void txtServiceName_LostFocus(object sender, EventArgs e)
        {
            try
            {
                string strServiceName = txtServiceName.Text.Trim();

                Dictionary <string, bool> dictItems = new Dictionary <string, bool>(0);
                for (int i = 0; i < clbService.Items.Count; i++)
                {
                    string item = clbService.Items[i].ToString();
                    dictItems.Add(item, clbService.GetItemChecked(i));
                }

                clbService.Items.Clear();
                foreach (string item in dictItems.Keys)
                {
                    if (item.StartsWith("M3主服务"))
                    {
                        clbService.Items.Add(string.Format("M3主服务({0})", strServiceName), dictItems[item]);
                    }
                    else if (item.StartsWith("自动更新服务"))
                    {
                        clbService.Items.Add(string.Format("自动更新服务({0}_{1})", strServiceName, "WebAutoUpdate"),
                                             dictItems[item]);
                    }
                    else if (item.StartsWith("自动备份服务"))
                    {
                        clbService.Items.Add(string.Format("自动备份服务({0}_{1})", strServiceName, "DBAutoBackUp"),
                                             dictItems[item]);
                    }
                }
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #27
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
        private void btnReStart_Click(object sender, EventArgs e)
        {
            try
            {
                btnReStart.Enabled = btnStart.Enabled = btnStop.Enabled = false;

                if (timerReStart == null)
                {
                    timerReStart          = new Timer();
                    timerReStart.Interval = 500;
                    timerReStart.Tick    += timerReStart_Tick;
                }
                if (!timerReStart.Enabled && !mbRS)
                {
                    //miIndexRS = 0;
                    //mbRS = false;
                    timerReStart.Start();
                }
            }
            catch (Exception ex)
            {
                MonitorHelper.DealWithError(ex);
            }
        }
コード例 #28
0
ファイル: frmServerForm.cs プロジェクト: radtek/GrooveManager
        private void timerReStart4DBAutoBackUp_Tick(object sender, EventArgs e)
        {
            using (ServiceController controller = new ServiceController(ServiceName4DBAutoBackUp))
            {
                controller.Refresh();

                try
                {
                    timerReStart4DBAutoBackUp.Stop();

                    if (mbRS4DBAutoBackUp)
                    {
                        return;
                    }

                    mbRS4DBAutoBackUp = true;

                    ServiceControllerStatus status = controller.Status;
                    if (status == System.ServiceProcess.ServiceControllerStatus.Running)
                    {
                        controller.Stop();
                        controller.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Stopped, new TimeSpan(0, 1, 0));
                        status = controller.Status;
                        DisplayStatus4DBAutoBackUp(status, true);
                    }

                    this.Update();

                    int  iCount = 0;
                    bool bFlag  = false;
                    while (iCount <= 120)
                    {
                        if (controller.Status == System.ServiceProcess.ServiceControllerStatus.Stopped)
                        {
                            bFlag = true;
                            break;
                        }

                        System.Threading.Thread.Sleep(500);

                        iCount++;
                    }

                    if (bFlag)
                    {
                        status = controller.Status;
                        if (status == System.ServiceProcess.ServiceControllerStatus.Stopped)
                        {
                            controller.Start();
                            controller.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Running, new TimeSpan(0, 1, 0));
                            status = controller.Status;
                            DisplayStatus4DBAutoBackUp(status, true);
                        }
                    }
                }
                catch (Exception err)
                {
                    MonitorHelper.DealWithError(err);
                }
                finally
                {
                    try
                    {
                        mbRS4DBAutoBackUp = false;
                        btnReStart4DBAutoBackUp.Enabled = btnStop4DBAutoBackUp.Enabled = controller.Status == System.ServiceProcess.ServiceControllerStatus.Running;
                        btnStart4DBAutoBackUp.Enabled   = controller.Status == System.ServiceProcess.ServiceControllerStatus.Stopped;
                    }
                    catch
                    {
                    }
                }
            }
        }
コード例 #29
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                //获取相关网上订单配置信息
                string LoginName    = this.txtT3LoginName.Text.ToString().Trim() + "\r\n";
                string OrderUrl     = this.txtNetOrderUrl.Text.ToString().Trim() + "\r\n";
                string TrantionType = this.cbTrantion.SelectedItem.ToString();
                string SaveUrl      = this.cbSaveInfoUrl.SelectedItem.ToString();
                //网上订单
                string WebServerUrl = "server=" + this.txtNetServer.Text.ToString().Trim() + ";";
                string WebDbName    = "database=" + this.txtNetDB.Text.ToString().Trim() + ";";
                string WebUserName  = "******" + this.txtNetUser.Text.ToString().Trim() + ";";
                string WebPwd       = "Password="******";";
                //M3
                string M3ServerUrl = "server=" + this.txtT3Server.Text.ToString().Trim() + ";";
                string M3DbName    = "database=" + this.txtT3DB.Text.ToString().Trim() + ";";
                string M3UserName  = "******" + this.txtT3User.Text.ToString().Trim() + ";";
                string M3Pwd       = "Password="******";\r\n";

                string WebOrdersConfig = WebServerUrl + WebDbName + WebUserName + WebPwd + "TimeOut=30;\r\n";
                string M3OrdersConfig  = M3ServerUrl + M3DbName + M3UserName + M3Pwd;

                //判断事务类型
                switch (TrantionType)
                {
                case "分布式事务":
                    TrantionType = "0\r\n";
                    break;

                case "网上订单及M3使用不同事务":
                    TrantionType = "1\r\n";
                    break;
                }
                //判断终端信息保存位置
                switch (SaveUrl)
                {
                case "订单终端信息扩展表":
                    SaveUrl = "0\r\n";
                    break;

                case "订单单头":
                    SaveUrl = "1\r\n";
                    break;
                }

                //将所有的配置信息放入泛型数组中
                List <string> OrderConfigLists = new List <string>();
                OrderConfigLists.Add(WebOrdersConfig);
                OrderConfigLists.Add(M3OrdersConfig);
                OrderConfigLists.Add(LoginName);
                OrderConfigLists.Add(OrderUrl);
                OrderConfigLists.Add(TrantionType);
                OrderConfigLists.Add(SaveUrl);

                WebLinkHelper.SaveConfig(OrderConfigLists);

                this.Close();
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }
コード例 #30
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                int iPort = 0;
                try
                {
                    iPort = Convert.ToInt32(this.txtPort.Text);
                }
                catch
                {
                    throw new Exception("<端口号>必须为有效的数值(范围1~65535)。");
                }
                if (iPort < 1 || iPort > 65535)
                {
                    throw new Exception("<端口号>必须为有效的数值(范围1~65535)。");
                }

                bool   bChanged      = false;
                string strRMTChannel = 1.ToString();

                //客户端登录设置
                //强制局域网模式
                //强制互联网模式
                int    iRemotingForceMode   = 0;
                string strRemotingForceMode = lstRemotingForceMode.Text.Trim();
                if (strRemotingForceMode == "强制局域网模式")
                {
                    iRemotingForceMode = 1;
                }
                else if (strRemotingForceMode == "强制互联网模式")
                {
                    iRemotingForceMode = 2;
                }
                else
                {
                    iRemotingForceMode = 0;
                }

                if (iPort != LB.RMT.Base.ConfigHelper.Port ||
                    //strRMTChannel != LB.Web.Base.ConfigHelper.RMTChannel ||
                    iRemotingForceMode != LB.RMT.Base.ConfigHelper.RemotingForceMode ||
                    this.txtDBUser.Text != LB.RMT.Base.ConfigHelper.DBUser ||
                    this.txtDBPW.Text != LB.RMT.Base.ConfigHelper.DBPW ||
                    (this.txtLoginSecure.SelectedIndex == 0 ? false : true) != ConfigHelper.LoginSecure ||
                    this.txtServiceName.Text != ConfigHelper.ServiceName)
                {
                    bChanged = true;
                }

                if (!bChanged)
                {
                    MonitorHelper.ShowNormalMessage("服务配置没有更改。");
                    return;
                }

                // 如果原服务正在运行,则先停止
                _serverForm.Stop();

                // 读入新的配置
                //ConfigHelper.RMTChannel = strRMTChannel;
                ConfigHelper.Port              = iPort;
                ConfigHelper.ServiceName       = this.txtServiceName.Text.Trim();
                ConfigHelper.RemotingForceMode = iRemotingForceMode;
                ConfigHelper.DBUser            = this.txtDBUser.Text;
                ConfigHelper.DBPW              = this.txtDBPW.Text;
                ConfigHelper.LoginSecure       = this.txtLoginSecure.SelectedIndex == 0 ? false : true;

                // 写入新配置
                ConfigHelper.WriteIniConfig();

                // 重新运行服务
                _serverForm.Start();

                // 成功提示
                MonitorHelper.ShowNormalMessage(LB.RMT.Base.ConfigHelper.ServiceURL + Environment.NewLine + "服务已运行。");

                this.Close();
            }
            catch (Exception err)
            {
                MonitorHelper.DealWithError(err);
            }
        }