public static IEnumerable <ItemReference> GetItems(Connections.ConnectionData conn) { using (var dialog = new EditorWindow()) { dialog.dgvItems.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dialog.tbcOutputView.Appearance = TabAppearance.FlatButtons; dialog.tbcOutputView.ItemSize = new Size(0, 1); dialog.tbcOutputView.SelectedTab = dialog.pgTableOutput; dialog.tbcOutputView.SizeMode = TabSizeMode.Fixed; dialog.SetConnection(conn); if (dialog.ShowDialog() == DialogResult.OK && dialog._outputTable.Columns.Contains("type") && dialog._outputTable.Columns.Contains("id")) { return(dialog.dgvItems.SelectedRows .OfType <DataGridViewRow>() .Select(r => ((DataRowView)r.DataBoundItem).Row) .Select(r => new ItemReference((string)r["type"], (string)r["id"]) { KeyedName = dialog._outputTable.Columns.Contains("keyed_name") ? (string)r["keyed_name"] : null }).ToList()); } return(Enumerable.Empty <ItemReference>()); } }
public static IArasConnection Login(ConnectionData credentials, out string messageText) { messageText = ""; if (string.IsNullOrEmpty(credentials.Url)) { messageText = resources.Messages.UrlNotSpecified; return null; } return Iom.GetFactory(credentials.IomVersion).Login(credentials.Url, credentials.Database, credentials.UserName, credentials.Password, out messageText); }
public void SetConnection(ConnectionData conn) { string msg; var arasConn = ConnectionEditor.Login(conn, out msg); if (arasConn == null) { MessageBox.Show(msg); } else { _conn = arasConn; _connData = conn; ((Editor.AmlEditorHelper)inputEditor.Helper).InitializeConnection(ApplyAction); } lblConnectionName.Text = string.Format("{0} ({1})", conn.ConnectionName, _conn.GetIomVersion()); }