--- source_files: - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateZone.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CalculatedValueClass.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LevelTriggerChannel.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectChannel.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TemplateRegion.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/IsoCode.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestEngineerDetails.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestSetting.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/HardwareChannel.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/TestObjectMetaData.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/CustomerDetails.cs - DataPRO/Modules/DatabaseImporter/DatabaseImport/ISO/LabratoryDetails.cs generated_at: "2026-04-16T04:29:31.413854+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "fd925eaa489a9345" --- # Documentation: ISO Database Import Module Classes ## 1. Purpose This module provides data transfer objects (DTOs) for importing and exporting ISO-compliant test data from a database. It encapsulates structured representations of test configurations—including templates, zones, regions, channels, triggers, calculated values, and metadata—enabling serialization/deserialization between database rows and in-memory objects. These classes serve as intermediaries between the database layer and higher-level application logic, supporting data migration, configuration management, and ISO standard compliance for crash testing systems. ## 2. Public Interface ### `TemplateZone` - **`TemplateName`** (`string`, read-only) Name of the template this zone belongs to. - **`ZoneName`** (`string`) Name of the zone; defaults to `"Default zone"` if null in database. - **`Picture`** (`string`, read/write) Path or identifier for an associated picture. - **`Description`** (`string`) Zone description; defaults to empty string if null in database. - **`TemplateRegions`** (`TemplateRegion[]`, read/write) Array of regions associated with this zone; populated via `TemplateRegion.GetAllRegions()` in the `DataRow` constructor. ### `CalculatedValueClass` - **`Id`** (`int`) Unique identifier; defaults to `-1`. - **`Operation`** (`Operations` enum) Operation type: `SUM`, `AVERAGE`, `IRTRACC3D`, `IRTRACC3D_ABDOMEN`, `IRTRACC3D_LOWERTHORAX`. Defaults to `SUM`. - **`CalculatedValueCode`** (`string`) Code string; defaults to `"???????????????X"`. - **`InputChannelIds`** (`string[]`, read/write) Array of input channel IDs; backed by `InputChannelIdsBlob`. - **`InputChannelIdsBlob`** (`byte[]`, read/write) UTF-8 encoded blob of channel IDs joined by `CultureInfo.InvariantCulture.TextInfo.ListSeparator`. - **`CFCForInputChannels`** (`string`) Filter class for input channels; defaults to `""`. - **`ChannelFilterClassForOutput`** (`string`) Filter class for output; defaults to `""`. - **`TestSetupName`**, **`Name`** (`string`) Test setup and calculated channel names. ### `LevelTriggerChannel` - **`TestSetupName`**, **`GroupSerialNumber`**, **`TestObjectChannelId`**, **`HardwareChannelId`**, **`SensorSerialNumber`** (`string`) Identifiers for test context and hardware. - **`GreaterThanEnabled`** (`bool`) Whether high-threshold triggering is enabled; defaults to `true`. - **`GreaterThanThresholdEU`**, **`LessThanThresholdEU`** (`double`) High and low threshold values in engineering units. - **`LessThanEnabled`** (`bool`) Whether low-threshold triggering is enabled. - **`TriggerBetweenBounds`**, **`TriggerOutsideBounds`** (`bool`) Bounds-triggering modes. - **`InsideUpperLevelEU`**, **`InsideLowerLevelEU`**, **`OutsideUpperLevelEU`**, **`OutsideLowerLevelEU`** (`double`) Upper/lower bounds for inside/outside triggering. ### `TestObjectChannel` - **`Disabled`** (`bool`) Whether the channel is excluded from data collection. - **`ChannelIdx`** (`int`) Channel index; `CHANNEL_IDX_UNKNOWN = -1` if unset. - **`SensorSerialNumber`**, **`HardwareId`** (`string`) Sensor and hardware channel identifiers; `HardwareId` setter normalizes format (e.g., strips `x` separators). - **`SquibChannelType`** (`SquibChannelTypes` enum) Channel type: `None`, `Voltage`, or `Current`. - **`TestObject`** (`ISO.TestObject`) Parent test object instance. - **`CompareTo(TestObjectChannel)`** (`int`) Comparison for sorting: by `DisplayOrder`, then `Name`, then `TestObject.SerialNumberOrOriginalSerialNumber`. - **`GetGraphId()`**, **`GetId()`**, **`GetIdWithSpecificChannelId(long)`** (`string`) Generate unique channel identifiers; `GetGraphId()` appends `DTS.Common.Constants.CURRENT_SUFFIX` for current-type squib channels. ### `TemplateRegion` - **`TemplateName`**, **`TemplateZone`** (`string`, read-only) Template and zone names. - **`RegionNumber`**, **`RegionName`**, **`RegionDescription`** (`int`, `string`) Region metadata. - **`TestObject`**, **`Position`**, **`MainLocation`**, **`FineLocation1–3`**, **`PhysicalDimension`**, **`Direction`**, **`FilterClass`** (`string`) Spatial and classification attributes. - **`LocalOnly`** (`bool`, read-only) Whether region is local-only. - **`UpperLeft`**, **`LowerRight`** (`System.Drawing.Point`) Bounding box coordinates. - **`GetAllRegions(string templateName, string zoneName)`** (`TemplateRegion[]`, internal static) Fetches regions from database via stored procedure `sp_TemplateRegionsGet`. ### `IsoCode` - **`StringRepresentation`** (`string`, read/write) 16-character ISO code string; pads with `'?'` if shorter, truncates if longer. - **`GetString(MMEPossibleChannels, bool careAboutTestTimeFields)`** (`string`, static) Generates ISO code from channel metadata; masks `Test_Object` and `Default_Filter_Class` with `'?'` if `careAboutTestTimeFields` is `false`. - **`GetString(...)`** (`string`, static) Direct concatenation of ISO components. ### `TestEngineerDetails` - **`TestEngineerName`**, **`TestEngineerPhone`**, **`TestEngineerFax`**, **`TestEngineerEmail`** (`string`) Contact info; setters ignore empty strings. - **`LocalOnly`** (`bool`) Scope flag. - **`Name`**, **`LastModified`**, **`LastModifiedBy`**, **`Version`** (`string`, `DateTime`, `string`, `int`) Metadata fields. - **`DeleteAllTestEngineerDetails()`**, **`GetAllTestEngineerDetails()`** (`void`, `TestEngineerDetails[]`, static) Database CRUD operations. ### `TestSetting` - **`Id`**, **`Value`**, **`DefaultValue`** (`string`) Setting identifier, current value, and default value. - **`ToSerializeString()`** (`string`) Serializes as `Id=SEPARATOR=SEPARATOR=Value`. - **`TryParse(string, out TestSetting)`** (`bool`, static) Parses serialized string; sets `DefaultValue = Value` on success. ### `TestSettingDictionary` - **`GetValue(string id, string defaultValue)`** (`string`) Returns `Value` if present, else `DefaultValue`. - **`SetValue(TestSetting, string)`**, **`SetValue(TestSetting)`**, **`SetValue(string, string)`** (`void`) Updates or adds settings. - **`ToSerializeString()`**, **`LoadSettings(string)`** (`string`, `void`) Serializes/deserializes settings using `ListSeparator` as delimiter. ### `HardwareChannel` - **`ParentDAS`** (`Hardware`) Parent data acquisition system. - **`SupportedBridges`**, **`SupportedExcitations`**, **`SupportedDigitalInputModes`**, **`SupportedDigitalOutputModes`**, **`SupportedSquibFireModes`** (`int`) Hardware capabilities. - **`ChannelIdx`**, **`DASDisplayOrder`**, **`ModuleSerialNumber`**, **`ModuleArrayIndex`** (`int`, `int`, `string`, `int`) Channel identification and positioning. - **`LocalOnly`** (`bool`) Scope flag. - **`PhysicalCompare(HardwareChannel, HardwareChannel)`** (`int`, static) Compares by `ChannelIdx`. ### `TestObjectMetaData`, `TestSetupMetaData` - **`TestObject`** (`char`) Test object identifier (e.g., `'?'`). - **`Version`** (`double`) Schema version (`1.06`). - **`NOVALUE`** (`const string`) Placeholder for unset values (`"NOVALUE"`). - **`SetProperty(MetaData)`** (`void`) Adds/updates metadata properties. - **`MetaData`** - `Name`, `IsOptional`, `Value`, `Version` (`string`, `bool`, `string`, `double`) - Represents a single metadata field. ### `CustomerDetails` - **`CustomerName`**, **`CustomerTestRefNumber`**, **`ProjectRefNumber`**, **`CustomerOrderNumber`**, **`CustomerCostUnit`** (`string`) Customer-related identifiers; setters ignore empty strings for non-required fields. - **`LocalOnly`**, **`Name`**, **`LastModified`**, **`LastModifiedBy`**, **`Version`** (`bool`, `string`, `DateTime`, `string`, `int`) Metadata fields. - **`ReadXML(XmlElement)`**, **`WriteXML(ref XmlWriter)`**, **`DeleteCustomerDetails(string)`** (`CustomerDetails`, `void`, `void`, static) XML persistence and deletion. ### `LabratoryDetails` - **`LabratoryName`**, **`LabratoryContactName`**, **`LabratoryContactPhone`**, **`LabratoryContactFax`**, **`LabratoryContactEmail`**, **`LabratoryTestRefNumber`**, **`LabratoryProjectRefNumber`** (`string`) Laboratory contact and reference data. - **`Name`**, **`LocalOnly`**, **`LastModified`**, **`LastModifiedBy`**, **`Version`** (`string`, `bool`, `DateTime`, `string`, `int`) Metadata fields. - **`ReadXML(XmlElement)`**, **`DeleteLabratoryDetails()`** (`LabratoryDetails`, `void`, static) XML persistence and deletion. ## 3. Invariants - **`TemplateZone.ZoneName`**: Defaults to `"Default zone"` if database `ZoneName` is `DBNull`. - **`TemplateZone.Description`**: Defaults to `""` if database `ZoneDescription` is `DBNull`. - **`CalculatedValueClass.InputChannelIds`**: Stored as a `byte[]` blob using `CultureInfo.InvariantCulture.TextInfo.ListSeparator` as delimiter; deserialization splits on this separator. - **`TestObjectChannel.HardwareId`**: Setter enforces format `prefix_number` (e.g., strips `x` separators beyond the first two segments). - **`IsoCode.StringRepresentation`**: Always exactly 16 characters; missing characters padded with `'?'`, excess truncated. - **`TestSettingDictionary`**: Preserves `DefaultValue` from existing settings during `LoadSettings`; only updates `Value`. - **`TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`**: Contact fields (`Phone`, `Fax`, `Email`) ignore empty-string assignments. - **`LevelTriggerChannel`**: Constructor silently ignores exceptions during field parsing (commented logging). - **`TemplateRegion.GetAllRegions`**: Returns empty array on failure; logs exceptions (commented). - **`HardwareChannel`**: Implements `INotifyPropertyChanged`; `SetProperty` raises `PropertyChanged` only on change. ## 4. Dependencies - **Database Layer**: - `DbOperations`, `DbOperationsEnum.StoredProcedure`, `DTS.Common.Storage.DbOperations` (e.g., `TestEngineerDetailsGet`, `CustomerDetailsDelete`, `LabratoryDetailsDelete`, `sp_TemplateRegionsGet`). - `System.Data`, `System.Data.SqlClient` (ADO.NET types). - **Core Types**: - `DTS.Common.Constants.CURRENT_SUFFIX` (used in `TestObjectChannel.GetGraphId()`). - `DTS.Common.Interface.TestMetaData.ITestEngineerDetailsDbRecord` (used in `TestEngineerDetails` constructor). - `System.Drawing.Point` (used in `TemplateRegion`). - **Serialization**: - `System.Xml` (XML persistence in `CustomerDetails`, `LabratoryDetails`). - `System.Text.Encoding`, `System.Globalization.CultureInfo` (used in `CalculatedValueClass` and `TestSetting`). - **Inheritance/Usage**: - `TestObjectChannel` extends `TestObjectTemplateChannel` and implements `IComparable`. - `HardwareChannel` implements `INotifyPropertyChanged`. ## 5. Gotchas - **`TemplateRegion.GetAllRegions`**: Uses `internal` access and database calls; not testable without database connectivity. - **`LevelTriggerChannel` constructor**: Swallows all exceptions during deserialization (commented logging); may silently fail to populate fields. - **`CalculatedValueClass.InputChannelIdsBlob`**: Uses `CultureInfo.InvariantCulture.TextInfo.ListSeparator` (typically `','`), but this may conflict with IDs containing commas. - **`TestObjectChannel.HardwareId` setter**: Normalizes input by stripping `x` separators beyond the first two segments; may alter expected values unexpectedly. - **`IsoCode`**: Masks `Test_Object` and `Default_Filter_Class` with `'?'` when `careAboutTestTimeFields` is `false`, but does not validate input strings (e.g., null/empty `Direction` may cause `IndexOutOfRangeException`). - **`TestSettingDictionary.ToSerializeString`**: Uses `ListSeparator` as delimiter between settings, but escapes `=` with `SEPARATOR = "_x_"` or `"_X_"`; mismatched separators in `LoadSettings` could cause parsing errors. - **`TestEngineerDetails`, `CustomerDetails`, `LabratoryDetails`**: Contact fields ignore empty strings, but `NOVALUE` is used as default—this may cause confusion if `NOVALUE` is stored in the database. - **`TemplateZone`**: `TemplateRegions` is populated only in the `DataRow` constructor; the parameterized constructor does not initialize regions. - **`TestObjectMetaData`/`TestSetupMetaData`**: `NOVALUE` is used as default, but `TestSetupMetaData` replaces `NOVALUE` with `string.Empty` for specific fields when `requireXCrashCompatibilityForISOExports` is `true`.