public SortedTableInfos(TableInfoSet tableInfoSet) { this.m_tableInfoSet = tableInfoSet; foreach (string current in this.m_tableInfoSet.Keys) { base.Add(new TableComparer(current, this.GetLevel(current))); } base.Sort(); }
public DbEditForm(DataSet dataSet, TableInfoSet tableInfoSet, UIApplication revitUiApp) : this() { this.m_dataSet = dataSet; this.m_command = DatabaseManager.CreateCommand(); this.m_tableInfoSet = tableInfoSet; this.m_revitUiApp = revitUiApp; this.m_revitApp = revitUiApp.Application; this.m_revitDoc = revitUiApp.ActiveUIDocument.Document; this.m_bindingSource = new BindingSource(); this.m_bindingSource.DataSource = this.m_dataSet; this.tableDataGridView.AutoGenerateColumns = false; this.tableDataGridView.VirtualMode = true; this.tableDataGridView.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText; this.m_readOnlyStyle.ForeColor = SystemColors.GrayText; this.m_headerCellStyle.BackColor = System.Drawing.Color.Pink; this.m_dataErrorCellStyle.BackColor = System.Drawing.Color.Red; }
public ParameterListForm(UIApplication revitUiApp, DataSet dataSet) : this() { this.m_revitUiApp = revitUiApp; this.m_revitApp = revitUiApp.Application; this.m_tableInfoSet = Command.TableInfoSet; this.m_parameterCreation = new ParameterCreation(revitUiApp); this.m_dataSet = dataSet; this.parameterListBox.DisplayMember = "ParameterName"; this.parameterListBox.Sorted = true; DefinitionBindingMapIterator definitionBindingMapIterator = this.m_revitUiApp.ActiveUIDocument.Document.ParameterBindings.ForwardIterator(); definitionBindingMapIterator.Reset(); while (definitionBindingMapIterator.MoveNext()) { Definition key = definitionBindingMapIterator.Key; string name = key.Name; if (!this.ParameterExists(name)) { this.parameterListBox.Items.Add(name); } } }
public bool IsDatabaseValid(TableInfoSet tableinfoset) { // *** Coyove Patched *** int num = 0; foreach (TableInfo current in tableinfoset.Values) { string name = current.Name; if (this.TableExist(name)) { num++; bool flag = current is InstanceTableInfo || current is SymbolTableInfo; foreach (ColumnInfo current2 in current.Values) { string name2 = current2.Name; if (!this.ColumnExist(name, name2)) { if (!flag || !(current2 is CustomColumnInfo)) { bool result = false; return(result); } // string text = string.Format("ALTER TABLE [{0}] ADD [{1}] {2}", name, current2.Name, this.m_DataTypeMap[current2.DataType]); string text = string.Format("ALTER TABLE \"{0}\" ADD \"{1}\" {2}", name, current2.Name, this.m_DataTypeMap[current2.DataType]); if (!this.ExecuteSQL(text)) { Log.WriteWarning("SQL Statement '{0}' executed failed", new object[] { text }); bool result = false; return(result); } } } } } return(num > 0); }
public static bool IsDatabaseValid(TableInfoSet tableinfoset) { Log.WriteLine("Check whether database is valid"); return(DatabaseManager.m_CurrentDriver.IsDatabaseValid(tableinfoset)); }
public static bool CreateDatabase(TableInfoSet tableinfoset, out string errorMessage) { return(DatabaseManager.m_CurrentDriver.CreateDatabase(tableinfoset, out errorMessage)); }
public bool CreateDatabase(TableInfoSet tableinfoset, out string errorMessage) { errorMessage = string.Empty; Log.WriteLine("Create tables ..."); Log.Indent(); foreach (TableInfo current in tableinfoset.Values) { if (current.PrimaryKeys.Count > 1) { Log.WriteLine("{0},{1}", new object[] { current.TableId, current.Name }); Log.Indent(); foreach (string current2 in current.PrimaryKeys) { Log.WriteLine("primaryKey:" + current2); } Log.Unindent(); } if (this.TableExist(current.Name)) { if (DatabaseManager.isExcelExport) { MessageBox.Show(RDBResource.GetString("MessageBox_CanNotUpdateExcelTable"), RDBResource.GetString("MessageBox_CanNotUpdateExcelTable_Title"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk); bool result = false; return(result); } System.Collections.Generic.List <ColumnInfo> list = new System.Collections.Generic.List <ColumnInfo>(); foreach (ColumnInfo current3 in current.Values) { if (!this.ColumnExist(current.Name, current3.Name)) { list.Add(current3); } } if (list.Count > 0) { string addColumnSqlStmt = this.GetAddColumnSqlStmt(current.Name, list); bool flag = this.ExecuteSQL(addColumnSqlStmt); if (Command.ConfigFile.DebugSQL && !flag) { Log.WriteWarning("Update table '" + current.Name + "' failed, statement: " + addColumnSqlStmt); } } } else { string tableCreationSqlStmt = this.GetTableCreationSqlStmt(current); if (Command.ConfigFile.DebugSQL) { Log.WriteLine("Create table: (" + current.Name + ") " + tableCreationSqlStmt); } if (!this.ExecuteSQL(tableCreationSqlStmt)) { Log.WriteError("Failed: " + tableCreationSqlStmt); errorMessage = tableCreationSqlStmt; bool result = false; return(result); } } this.ProgressStep(); } Log.Unindent(); Log.WriteLine("Create tables Finished"); Log.WriteLine("Add foreign keys ..."); Log.Indent(); if (!DatabaseManager.isExcelExport) { foreach (TableInfo current4 in tableinfoset.Values) { string[] tableForeignKeysSqlStmt = this.GetTableForeignKeysSqlStmt(current4); string[] array = tableForeignKeysSqlStmt; for (int i = 0; i < array.Length; i++) { string sqlStmt = array[i]; this.ExecuteSQL(sqlStmt); } this.ProgressStep(); } } Log.Unindent(); Log.WriteLine("Add foreign keys Finished"); return(true); }