Exemplo n.º 1
0
        /// <summary>
        /// Build an array of the records contained within the <c>SELFTEST</c> table of the data dictionary. This array is used to access the
        /// parameters associated with the self tests defined in the table. The array element is mapped to the self test number field of the table.
        /// </summary>
        /// <param name="dataTable">Reference to the <c>SELFTEST</c> table of the data dictionary.</param>
        /// <returns>An array of the records contained within the <c>SELFTEST</c> table of the data dictionary, if the parameters are valid; otherwise, null.</returns>
        protected override SelfTestRecord[] BuildDataTable(DataDictionary.SELFTESTDataTable dataTable)
        {
            // Local copy of the data table.
            SelfTestRecord[] records;

            if (dataTable == null)
            {
                return(null);
            }

            try
            {
                // Determine the maximum value of the identifier field in the data table, it cannot be assumed that the table is sorted by identifier.
                int iDMax     = 0;
                int iDCurrent = 0;
                for (int recordIndex = 0; recordIndex < dataTable.Count; recordIndex++)
                {
                    iDCurrent = dataTable[recordIndex].SELFTESTNUMBER;
                    if (iDCurrent > iDMax)
                    {
                        iDMax = iDCurrent;
                    }
                }

                m_IdentifierMax = iDMax;

                // Instantiate the lookup array.
                records = new SelfTestRecord[iDMax + 1];

                // Populate the lookup table;
                int identifier;
                DataDictionary.SELFTESTRow row;
                for (int recordIndex = 0; recordIndex < dataTable.Count; recordIndex++)
                {
                    row        = dataTable[recordIndex];
                    identifier = row.SELFTESTNUMBER;

                    // Instantiate a new structure to contain the data and copy the data across.
                    SelfTestRecord record = new SelfTestRecord();
                    record.Identifier     = (short)row.SELFTESTID;
                    record.SelfTestNumber = row.SELFTESTNUMBER;
                    record.Description    = row.DESCRIPTION;
                    record.HelpIndex      = row.HELPINDEX;

                    // Add the record to the correct element of the array.
                    records[identifier] = record;
                }
            }
            catch (Exception)
            {
                return(null);
            }

            return(records);
        }
        /// <summary>
        /// Build an array of the records contained within the <c>SELFTEST</c> table of the data dictionary. This array is used to access the 
        /// parameters associated with the self tests defined in the table. The array element is mapped to the self test number field of the table. 
        /// </summary>
        /// <param name="dataTable">Reference to the <c>SELFTEST</c> table of the data dictionary.</param>
        /// <returns>An array of the records contained within the <c>SELFTEST</c> table of the data dictionary, if the parameters are valid; otherwise, null.</returns>
        protected override SelfTestRecord[] BuildDataTable(DataDictionary.SELFTESTDataTable dataTable)
        {
            // Local copy of the data table.
            SelfTestRecord[] records;

            if (dataTable == null)
            {
                return null;
            }

            try
            {
                // Determine the maximum value of the identifier field in the data table, it cannot be assumed that the table is sorted by identifier.
                int iDMax = 0;
                int iDCurrent = 0;
                for (int recordIndex = 0; recordIndex < dataTable.Count; recordIndex++)
                {
                    iDCurrent = dataTable[recordIndex].SELFTESTNUMBER;
                    if (iDCurrent > iDMax)
                    {
                        iDMax = iDCurrent;
                    }
                }

                m_IdentifierMax = iDMax;

                // Instantiate the lookup array.
                records = new SelfTestRecord[iDMax + 1];

                // Populate the lookup table;
                int identifier;
                DataDictionary.SELFTESTRow row;
                for (int recordIndex = 0; recordIndex < dataTable.Count; recordIndex++)
                {
                    row = dataTable[recordIndex];
                    identifier = row.SELFTESTNUMBER;

                    // Instantiate a new structure to contain the data and copy the data across.
                    SelfTestRecord record = new SelfTestRecord();
                    record.Identifier = (short)row.SELFTESTID;
                    record.SelfTestNumber = row.SELFTESTNUMBER;
                    record.Description = row.DESCRIPTION;
                    record.HelpIndex = row.HELPINDEX;

                    // Add the record to the correct element of the array.
                    records[identifier] = record;
                }
            }
            catch (Exception)
            {
                return null;
            }

            return records;
        }