private void ConnectButton_Click(object sender, EventArgs e) { if (connectionConfig == null) { msgBox.AppendText("\n\nConfiguration not loaded -- use button 1 first!"); return; } serverConnection = Aras.IOM.IomFactory.CreateHttpServerConnection(connectionConfig.Server + "/Server/InnovatorServer.aspx", connectionConfig.Database, connectionConfig.Username, connectionConfig.Password); Aras.IOM.Item result; try { result = serverConnection.Login(); } catch (Exception exception) { msgBox.AppendText("\n\nLogin Error: " + exception.Message); return; } if (result.isError()) { msgBox.AppendText("\n\nLogin Error: " + result.getErrorString()); serverConnection = null; return; } innovator = new Aras.IOM.Innovator(serverConnection); msgBox.AppendText("\n\nDone! -- the MyInnovator object is created and ready to run queries.\nNOTE: a roundtrip the server has already been tested!\nServer says your userID is " + innovator.getUserID()); }
private void tryToConnectInnovator() { if (_innovator == null) { _innovatorServer = DefaultInnovatorServer; _innovatorDatabase = DefaultInnovatorDatabase; _innovatorUserName = DefaultInnovatorUserName; _innovatorPassword = DefaultInnovatorPassword; } var connectionDialog = new ConnectToInnovatorDialog { Owner = this, Server = _innovatorServer, Database = _innovatorDatabase, UserName = _innovatorUserName, Password = _innovatorPassword, }; if (connectionDialog.ShowDialog() == true) { _innovatorServer = connectionDialog.Server; _innovatorDatabase = connectionDialog.Database; _innovatorUserName = connectionDialog.UserName; _innovatorPassword = connectionDialog.Password; var serverConnection = Aras.IOM.IomFactory.CreateHttpServerConnection( _innovatorServer, _innovatorDatabase, _innovatorUserName, _innovatorPassword); _innovator = new Aras.IOM.Innovator(serverConnection); } }