Example #1
0
        /// <summary>
        /// Retrieves the row in the TypeDefs data table in the Header Data Set object linked to the DataAccess class with the name specified
        /// in the function's TypeDefName parameter.
        /// </summary>
        /// <param name="strTypeDefName"></param>
        /// <returns></returns>
        public CHeaderDataSet.tblTypeDefsRow GetTypeDef(string strTypeDefName)
        {
            try
            {
                CHeaderDataSet.tblTypeDefsRow rowTypeDef = TypeDefsTable.FindByTypeDefName(strTypeDefName);

                return(rowTypeDef);
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in GetTypeDef function of DataAccess class.");
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Queries the data type associated with the field with the specified key passed to the function.  The linked data type record will be returned
        /// by the function.   Depending on what type of data type is associated with the field, will determine whether a structure data row, typedef data row
        /// or primitive data object is returned by the function.  Primtive data types will not be stored in the Header Data Set and will have its data returned
        /// from the Global Primitive data object.
        /// </summary>
        /// <param name="strFieldKey"></param>
        /// <returns></returns>
        public object QueryFieldTypeDataByKey(string strFieldKey)
        {
            try
            {
                CHeaderDataSet.tblFieldsRow rowField = FieldsTable.FindByFieldKey(strFieldKey);

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

                switch ((FieldTypeEnum)rowField.FieldType)
                {
                case FieldTypeEnum.Primitive:
                case FieldTypeEnum.Enum:
                case FieldTypeEnum.Pointer:
                    object[] aryPrimTypeData = new object[] { rowField.FieldTypeName, DataAccess.PrimDataTypes[rowField.FieldTypeName] };

                    return(aryPrimTypeData);

                case FieldTypeEnum.TypeDef:
                    CHeaderDataSet.tblTypeDefsRow rowTypeDef = TypeDefsTable.FindByTypeDefName(rowField.FieldTypeName);

                    return(rowTypeDef);

                case FieldTypeEnum.Structure:
                    CHeaderDataSet.tblStructuresRow rowStruct = StructuresTable.FindByStructName(rowField.FieldTypeName);

                    return(rowStruct);
                }
                ;

                return(null);
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in QueryFieldTypeDataByKey function of DataAccess class.");

                return(null);
            }
        }