Ejemplo n.º 1
0
 public void CreateNewRelayEntry(TableTwo pTable, string pClassName)
 {
     table    = pTable;
     objectId = table.CreateRow().row;
     table.EnsureField <string>(CSHARP_CLASS_FIELD_NAME);
     table.SetValue <string>(objectId, CSHARP_CLASS_FIELD_NAME, pClassName);
     SetupCells();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Append all entries in all tables, source IDs will be discarded.
        /// </summary>
        public void AppendTables(RelayTwo pRelay)
        {
            RelayTwo additiveRelay = pRelay;

            // Cycle through all new tables in the loaded relay
            foreach (String tableName in additiveRelay.tables.Keys)
            {
                TableTwo fromTable = additiveRelay.tables[tableName];
                // If the table already exists, append the entries from the new table.
                if (tables.ContainsKey(tableName))
                {
                    TableTwo toTable = tables[tableName];
                    // Ensure that all fields exists in the old table.
                    foreach (ITableField f in fromTable.fields)
                    {
                        if (!toTable.fieldNames.Contains(f.name))
                        {
                            toTable.AddField(f.GetEmptyCopy());
                        }
                    }
                    foreach (TableRow fromRow in fromTable)
                    {
                        TableRow toRow = toTable.CreateRow();
                        foreach (ITableField fromField in fromTable.fields)
                        {
                            ITableField toField = toTable.GetField(fromField.name);
                            toField.SetValueFromString(toRow.row, fromField.GetValueAsString(fromRow.row));
                        }
                    }
                }
                else
                {
                    this.tables[fromTable.name] = fromTable;
                }
            }
        }