public virtual bool Equals(ExportField other) { if (other == null) { return(false); } return((this._tableName == other._tableName) && (this._columnName == other._columnName) && (this._fieldName == other._fieldName)); }
public virtual bool Equals(ExportField other) { if (other == null) return false; return ((this._tableName == other._tableName) && (this._columnName == other._columnName) && (this._fieldName == other._fieldName)); }
//--------------------------------------------------------------------- /// <summary> /// Adds the export column to the export table. /// </summary> /// <param name="numFields">The number of occurrences of this field.</param> /// <param name="columnName">The name of the exported column.</param> /// <param name="dataType">The data type of the column.</param> /// <param name="maxLength">The maximum length of the column.</param> /// <param name="exportTable">The export table.</param> /// <param name="lutDescrColOrdinals">The lut description col ordinals.</param> private void AddExportColumn(int numFields, string tableName, string columnName, string fieldName, int fieldType, int maxLength, string fieldFormat, ref List<ExportField> exportFields) { Type dataType = null; int fieldLength = 0; bool autoNum = false; int attributeLength = 0; // Increment each time a different table is referenced. if (tableName != _lastTableName) _tableCount += 1; //--------------------------------------------------------------------- // FIX: 048 Enable fields to be exported using a different // data type. switch (fieldType) { case 3: // Integer dataType = System.Type.GetType("System.Int32"); attributeLength = 2; break; case 6: // Single dataType = System.Type.GetType("System.Single"); attributeLength = 4; break; case 7: // Double dataType = System.Type.GetType("System.Double"); attributeLength = 8; break; case 8: // Date/Time dataType = System.Type.GetType("System.DateTime"); attributeLength = 8; break; case 10: // Text dataType = System.Type.GetType("System.String"); if (maxLength > 0) { fieldLength = Math.Min(maxLength, 254); attributeLength = fieldLength; } else { fieldLength = 254; attributeLength = fieldLength; } break; case 99: // Autonumber dataType = System.Type.GetType("System.Int32"); autoNum = true; attributeLength = 4; break; default: dataType = System.Type.GetType("System.String"); fieldLength = maxLength; attributeLength = maxLength; break; } //--------------------------------------------------------------------- // If this field has multiple occurrences. if (numFields > 0) { int fieldCount = exportFields.Count + 1; for (int i = 1; i <= numFields; i++) { ExportField fld = new ExportField(); //--------------------------------------------------------------------- // FIX: 043 Enable new 'empty' fields to be included in exports. if (tableName.ToLower() == "<none>") fld.FieldOrdinal = -1; else fld.FieldOrdinal = _fieldCount; //--------------------------------------------------------------------- fld.TableName = tableName; fld.ColumnName = columnName; //--------------------------------------------------------------------- // FIX: 049 Enable the multi-record counter to be inserted // 'within' the export field name. // // Include the occurrence counter in the field name, either // where the user chooses or at the end. if (Regex.IsMatch(fieldName, @"(<no>)", RegexOptions.IgnoreCase)) fld.FieldName = fieldName.Replace("<no>", i.ToString()); else fld.FieldName = String.Format("{0}_{1}", fieldName, i); //--------------------------------------------------------------------- fld.FieldType = dataType; //--------------------------------------------------------------------- // FIX: 045 Interweave multiple record fields from the same // table together. fld.FieldOrder = (_tableCount * 1000) + (i * 100) + fieldCount; //--------------------------------------------------------------------- fld.FieldLength = fieldLength; fld.FieldsCount = numFields; fld.FieldFormat = fieldFormat; fld.AutoNum = autoNum; exportFields.Add(fld); // Add the field attribute length to the running total. _attributesLength += attributeLength; } } else { ExportField fld = new ExportField(); //--------------------------------------------------------------------- // FIX: 043 Enable new 'empty' fields to be included in exports. if (tableName.ToLower() == "<none>") fld.FieldOrdinal = -1; else fld.FieldOrdinal = _fieldCount; //--------------------------------------------------------------------- fld.TableName = tableName; fld.ColumnName = columnName; fld.FieldName = fieldName; fld.FieldType = dataType; //--------------------------------------------------------------------- // FIX: 045 Interweave multiple record fields from the same // table together. fld.FieldOrder = (_tableCount * 1000) + exportFields.Count + 1; //--------------------------------------------------------------------- fld.FieldLength = fieldLength; fld.FieldsCount = numFields; fld.FieldFormat = fieldFormat; fld.AutoNum = autoNum; exportFields.Add(fld); // Add the field attribute length to the running total. _attributesLength += attributeLength; } // Store the last table referenced. _lastTableName = tableName; // Increment the field counter. if (tableName.ToLower() != "<none>") _fieldCount += 1; }