//增加一个连接配置,如果可以登录成功,加到内存中。 private void addConfig() { try { if (!check()) { return; } _config = new SapConfigClass(); _config.Name = cbxName.Text.Trim().ToUpper(); _config.AppServerHost = txtAppServerHost.Text.Trim().ToUpper(); _config.SAPRouter = txtRouter.Text.Trim().ToUpper(); _config.SystemID = txtSystemId.Text.Trim().ToUpper(); _config.SystemNumber = txtSystemNumber.Text.Trim().ToUpper(); _config.User = txtUser.Text.Trim().ToUpper(); _config.Password = txtPassword.Text.Trim(); _config.Client = txtClient.Text.Trim().ToUpper(); _config.Language = txtLanguage.Text.Trim().ToUpper(); // _config.PoolSize = "5"; // _config.MaxPoolSize = "10"; // _config.IdleTimeout = "60"; RfcDestination des = SAPDestination.GetDesByConfig(_config); des.Ping(); SAPLogonConfigList.AddConfig(_config.Name, _config); } catch (RfcLogonException e) { var s = e.Message; if ("LOGON_FAILURE" == e.Key) { s = s + "登陆失败"; } throw new SAPException(e.Key + s); } catch (RfcAbapRuntimeException e) { throw new SAPException(e.Key + e.Message); } catch (RfcAbapException e) { throw new SAPException(e.Key + e.Message); } }
//加载配置 private void loadConfig(string name) { if (!check()) { return; } _config = SAPLogonConfigList.GetConfig(name); if (_config == null) { MessageBox.Show("没有找到配置"); } clear(); cbxName.Text = _config.Name; txtAppServerHost.Text = _config.AppServerHost; txtRouter.Text = _config.SAPRouter; txtSystemId.Text = _config.SystemID; txtSystemNumber.Text = _config.SystemNumber; txtClient.Text = _config.Client; txtLanguage.Text = _config.Language; }