/// <summary> /// Inits extended fields. /// </summary> private void _InitExtendedFields() { ICollection <TableInfo> tableInfos = _structureKeeper.GetPattern(ExportType.Access); foreach (TableInfo tableInfo in tableInfos) { if ((TableType.Schedules == tableInfo.Type) || (TableType.Schema == tableInfo.Type)) { continue; // skip this table } TableDescription descr = _structureKeeper.GetTableDescription(tableInfo.Type); foreach (string name in descr.GetFieldNames()) { FieldInfo info = descr.GetFieldInfo(name); if (!info.IsDefault) { _extendedFields.Add(info.Name); } } } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Creates a new instance of the <c>TableDefinition</c> class. /// </summary> /// <param name="description">Description of table.</param> /// <param name="ignorableFields">Ignorable fields.</param> /// <param name="isShortNamesMode">Is short names mode indicator.</param> public TableDefinition(TableDescription description, StringCollection ignorableFields, bool isShortNamesMode) { Debug.Assert(null != description); Debug.Assert(null != ignorableFields); _type = description.Type; _name = description.Name; foreach (string fieldName in description.GetFieldNames()) { if (ignorableFields.Contains(fieldName)) { continue; // skip ignorable fields } // set default selected Debug.Assert(null != description.GetFieldInfo(fieldName)); FieldInfo fieldInfo = description.GetFieldInfo(fieldName); if (fieldInfo.IsDefault) { _fields.Add(fieldName); } if (fieldInfo.IsHidden) { _hiddenFields.Add(fieldName); } else { _supportedFields.Add(fieldName); } string name = (isShortNamesMode) ? fieldInfo.ShortName : fieldInfo.LongName; _mapFaceNameByName.Add(fieldName, name); _mapDescriptionByName.Add(fieldName, fieldInfo.Description); } }
/// <summary> /// Adds hidden fields (for reporting need full data generation). /// </summary> /// <param name="tables">Table definitions to updating.</param> private void _AddHiddenFields(ref ICollection <ITableDefinition> tables) { // NOTE: add hidden fields - to full data generation ICollection <TableInfo> tableInfos = _structureKeeper.GetPattern(ExportType.Access); foreach (ITableDefinition table in tables) { if ((TableType.Schedules == table.Type) || (TableType.Schema == table.Type)) { continue; // skip this table } // add hidden fields to table definition TableDescription descr = _structureKeeper.GetTableDescription(table.Type); foreach (string name in descr.GetFieldNames()) { FieldInfo info = descr.GetFieldInfo(name); if (info.IsHidden) { table.AddField(info.Name); } } } }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Gets field names from export table description. /// </summary> /// <param name="reader">Export structure reader to decsription access.</param> /// <param name="type">Export type.</param> /// <param name="readedNames">Readed unique names (in\out).</param> private void _GetFieldNames(ExportStructureReader reader, ExportType type, IList <string> readedNames) { Debug.Assert(null != reader); Debug.Assert(null != readedNames); ICollection <TableInfo> tableInfos = reader.GetPattern(type); foreach (TableInfo tableInfo in tableInfos) { if ((TableType.Stops != tableInfo.Type) && (TableType.Orders != tableInfo.Type)) { continue; // NOTE: skip other tables } TableDescription descr = reader.GetTableDescription(tableInfo.Type); foreach (string name in descr.GetFieldNames()) { if (!readedNames.Contains(name)) { readedNames.Add(name); } } } }