Exemplo n.º 1
0
 public TableInfo(string tableId)
 {
     this.m_tableId = tableId;
     if (Command.ConfigFile.DebugSQL)
     {
         Log.WriteLine("TableInfo ctor: tableId [{0}]", new object[]
         {
             this.m_tableId
         });
     }
     this.m_name = RDBResource.GetTableName(this.m_tableId);
     if (Command.ConfigFile.DebugSQL)
     {
         Log.WriteLine("\ttableName [{0}]", new object[]
         {
             this.m_name
         });
     }
 }
Exemplo n.º 2
0
 private void addButton_Click(object sender, System.EventArgs e)
 {
     using (ParameterPropertyForm parameterPropertyForm = new ParameterPropertyForm(this.m_revitUiApp))
     {
         if (parameterPropertyForm.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 if (!this.m_parameterCreation.CreateUserDefinedParameter(parameterPropertyForm.ParameterInfo))
                 {
                     MessageBox.Show(RDBResource.GetString("MessageBox_Import_CreateParameterFailed"));
                 }
                 else
                 {
                     ParameterInfo parameterInfo = parameterPropertyForm.ParameterInfo;
                     this.parameterListBox.Items.Add(parameterInfo.ParameterName);
                     this.parameterListBox.SelectedItem = parameterInfo.ParameterName;
                     foreach (Category category in parameterInfo.Categories)
                     {
                         if (category != null)
                         {
                             string tableKey  = RDBResource.GetTableKey(category.Id.IntegerValue, parameterInfo.ParameterForType);
                             string tableName = RDBResource.GetTableName(tableKey);
                             if (tableName != null && !Command.ColumnExists(tableName, parameterInfo.ParameterName))
                             {
                                 bool flag = Command.AddColumn(parameterInfo.ParameterName, DatabaseManager.GetDataType(parameterInfo.ParameterType), tableName);
                                 if (flag)
                                 {
                                     bool      flag2     = true;
                                     TableInfo tableInfo = this.m_tableInfoSet[tableKey];
                                     foreach (ColumnInfo current in tableInfo.Values)
                                     {
                                         if (current.Name == parameterInfo.ParameterName)
                                         {
                                             flag2 = false;
                                             break;
                                         }
                                     }
                                     if (flag2)
                                     {
                                         tableInfo.AddColumn(new CustomColumnInfo(parameterInfo.ParameterName, DatabaseManager.GetDataType(parameterInfo.ParameterType)));
                                     }
                                     if (this.m_dataSet.Tables.Contains(tableName))
                                     {
                                         Log.WriteLine("Refresh data table " + tableName + " after addding column");
                                         Command.RefreshDataTable(this.m_dataSet.Tables[tableName]);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             catch (System.Exception ex)
             {
                 MessageBox.Show(ex.Message);
                 Log.WriteLine(ex.ToString());
             }
         }
     }
 }