38 lines
2.6 KiB
Markdown
38 lines
2.6 KiB
Markdown
---
|
|
source_files:
|
|
- DataPRO/Modules/Channels/ChannelCodes/Model/ChannelCodeType.cs
|
|
- DataPRO/Modules/Channels/ChannelCodes/Model/ChannelCode.cs
|
|
generated_at: "2026-04-17T15:58:37.735103+00:00"
|
|
model: "zai-org/GLM-5-FP8"
|
|
schema_version: 1
|
|
sha256: "d11e5910dac91aaa"
|
|
---
|
|
|
|
# Documentation: ChannelCodes.Model Namespace
|
|
|
|
## 1. Purpose
|
|
|
|
This module provides the domain model for managing channel codes within the DataPRO system. It consists of two classes: `ChannelCodeType`, an abstract class that retrieves channel code type lookups from the database, and `ChannelCode`, a concrete entity class that represents individual channel codes with CRUD operations. The module supports both database-backed channel codes and ISO channel codes loaded from a static file, merging them into a unified collection for application use.
|
|
|
|
---
|
|
|
|
## 2. Public Interface
|
|
|
|
### ChannelCodeType (abstract class)
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| `GetChannelCodeTypeLookup` | `public static IDictionary<short, string> GetChannelCodeTypeLookup()` | Retrieves all channel code types from the database via stored procedure `sp_ChannelCodeTypeGet`. Returns a dictionary mapping a short integer ID to a code type string. |
|
|
|
|
### ChannelCode
|
|
|
|
| Member | Signature | Description |
|
|
|--------|-----------|-------------|
|
|
| `HasValidId` | `public bool HasValidId()` | Returns `true` if `Id >= 0`. |
|
|
| `IsBlank` | `public bool IsBlank()` | Returns `true` if both `Name` and `Code` are null or empty. |
|
|
| `SelectedChannelType` | `public int SelectedChannelType { get; set; }` | Converts between `ChannelEnumsAndConstants.ChannelCodeType` enum and integer index (0 = ISO, 1 = User). Setter silently ignores values other than 0 or 1. |
|
|
| `PossibleChannels` | `public Dictionary<string, string> PossibleChannels { get; private set; }` | Property for storing possible channels. Not initialized in constructors visible in source. |
|
|
| `ChannelCode()` | `public ChannelCode()` | Default constructor. Sets `CodeType` to `ISO` and registers commands. |
|
|
| `ChannelCode(IChannelCode)` | `public ChannelCode(IChannelCode channelCode)` | Copy constructor that delegates to base class and registers commands. |
|
|
| `ChannelCode(IDataRecord, IDictionary<short, string>)` | `public ChannelCode(IDataRecord sqlReader, IDictionary<short, string> channelCodeLookup)` | Constructs instance from a database record. Maps `CodeTypeInt` to enum via the provided lookup dictionary. |
|
|
| `GetExistingChannelCodes` | `public static ChannelCode[] GetExistingChannelCodes(IDictionary<short, string> lookup)` | Retrieves all channel codes from the database via stored procedure |