public void Remove(DataConnectionBase connection) { if (FConnections.Contains(connection)) { FConnections.Remove(connection); } }
internal void OnAfterDatabaseLogin(DataConnectionBase sender, AfterDatabaseLoginEventArgs e) { if (AfterDatabaseLogin != null) { AfterDatabaseLogin(sender, e); } }
private void FindConnectorType() { FApplicationConnectionType = null; if (FApplicationConnection == null) { return; } // find appropriate connector List <ObjectInfo> registeredObjects = new List <ObjectInfo>(); RegisteredObjects.Objects.EnumItems(registeredObjects); foreach (ObjectInfo info in registeredObjects) { if (info.Object != null && info.Object.IsSubclassOf(typeof(DataConnectionBase))) { using (DataConnectionBase conn = Activator.CreateInstance(info.Object) as DataConnectionBase) using (DbConnection dbConn = conn.GetConnection()) { if (dbConn != null && dbConn.GetType() == FApplicationConnection.GetType()) { FApplicationConnectionType = conn.GetType(); return; } } } } throw new Exception(FApplicationConnection.GetType().Name + " connection is not supported."); }
internal void OnDatabaseLogin(DataConnectionBase sender, DatabaseLoginEventArgs e) { if (Config.DesignerSettings.ApplicationConnection != null && sender.GetType() == Config.DesignerSettings.ApplicationConnectionType) { e.ConnectionString = Config.DesignerSettings.ApplicationConnection.ConnectionString; } if (DatabaseLogin != null) DatabaseLogin(sender, e); }
private void cbxConnections_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); if (e.Index >= 0) { try { DataConnectionBase connection = cbxConnections.Items[e.Index] as DataConnectionBase; TextRenderer.DrawText(e.Graphics, connection.GetConnectionId(), e.Font, e.Bounds.Location, e.ForeColor); } catch { } } }
public void Deserialize(List <ConnectionEntry> connections) { foreach (ConnectionEntry ce in connections) { try { DataConnectionBase connection = Activator.CreateInstance(ce.Type) as DataConnectionBase; connection.ConnectionString = ce.ConnectionString; FConnections.Add(connection); } catch { } } }
public void Deserialize(FRReader reader) { while (reader.NextItem()) { try { DataConnectionBase connection = reader.Read() as DataConnectionBase; if (connection != null) { FConnections.Add(connection); } } catch { } } }
private void cbxConnections_SelectedIndexChanged(object sender, EventArgs e) { cbAlwaysUse.Checked = false; SuspendLayout(); if (FConnectionEditor != null) { FConnectionEditor.Dispose(); } if (!FEditMode) { if (FConnection != null) { FConnection.Dispose(); } FConnection = null; Type connectionType = (cbxConnections.SelectedItem as ObjectInfo).Object; FConnection = Activator.CreateInstance(connectionType) as DataConnectionBase; } FConnectionEditor = FConnection.GetEditor(); if (FConnectionEditor != null) { FConnectionEditor.Parent = this; FConnectionEditor.Location = new Point(0, gbSelect.Bottom); PerformAutoScale(); FConnectionEditor.UpdateLayout(); ClientSize = new Size(ClientSize.Width, FConnectionEditor.Bottom + cbLoginPrompt.Height + btnOk.Height + gbSelect.Top * 5); } else { ClientSize = new Size(ClientSize.Width, gbSelect.Bottom + cbLoginPrompt.Height + btnOk.Height + gbSelect.Top * 5); } ResumeLayout(); Refresh(); if (FConnection != null && FConnectionEditor != null) { FConnectionEditor.ConnectionString = FConnection.ConnectionString; cbLoginPrompt.Checked = FConnection.LoginPrompt; } btnTest.Enabled = FConnection != null && FConnection.IsSqlBased; }
private void btnQueryBuilder_Click(object sender, EventArgs e) { using (DataConnectionBase conn = Activator.CreateInstance(FTable.Connection.GetType()) as DataConnectionBase) { conn.Assign(FTable.Connection); if (Config.DesignerSettings.ApplicationConnection != null) { conn.ConnectionString = Config.DesignerSettings.ApplicationConnection.ConnectionString; } QueryBuilder qb = new QueryBuilder(conn); qb.UseJoin = true; if (qb.DesignQuery() == DialogResult.OK) { tbSql.Text = qb.GetSql(); } } }
public void Add(DataConnectionBase connection) { for (int i = 0; i < FConnections.Count; i++) { try { if (FConnections[i].GetConnectionId() == connection.GetConnectionId()) { FConnections.RemoveAt(i); break; } } catch { } } FConnections.Insert(0, connection); }
public DataBase(DataConnectionBase db) { dataBase = db; try { dataBase.CreateAllTables(false); } catch { } foreach (TableDataSource tds in dataBase.Tables) { Table tbl = new Table(tds); tbl.Name = tbl.Name; tableList.TableList.Add(tbl); } tableList.TableList.Sort(CompareTable); }
public static void CreateDataTree(Dictionary dictionary, DataConnectionBase connection, TreeNodeCollection root) { foreach (TableDataSource data in connection.Tables) { AddDataSource(dictionary, data, root, false, false, true); TreeNode node = root[root.Count - 1]; // add dummy child node for the table which has no schema, to allow expand the node and get schema if (data.Columns.Count == 0) { node.Nodes.Add("dummy"); } // fix the node text if table is not a query: display the TableName instead of Alias if (String.IsNullOrEmpty(data.SelectCommand)) { node.Text = data.TableName.Replace("\"", ""); } } }
private void btnCreateNewDatasource_Click(object sender, EventArgs e) { using (DataWizardForm form = new DataWizardForm(FReport)) { if (form.ShowDialog() == DialogResult.OK) { tvDataSources.CreateNodes(FReport.Dictionary); DataConnectionBase connection = form.Connection; string tableName = ""; foreach (DataSourceBase table in connection.Tables) { if (table.Enabled) { tableName = table.Alias; break; } } if (tableName != "") { tvDataSources.SelectedItem = tableName; } } } }
public QueryBuilder(DataConnectionBase dcb) { core = new Core(new QueryDesigner(), new DataBase(dcb)); }
internal FilterConnectionTablesEventArgs(DataConnectionBase connection, string tableName) { FConnection = connection; FTableName = tableName; }