// Copyright (C), 2014, CEU Co., Ltd. // USR Changed by 2014-10-14T12:27:59 Fandy Xie 谢宇帆 // Version : 1.0 // Description : 将table/view的fields添加到.net dataColumnCollection // Return : static System.Data.DataColumnCollection getTableColumnsCollection( System.Data.DataColumnCollection _colCollection, tableId _tableId) { DictTable dicTable; DictField dictField, dfArray; set setLabel = new set(types::String); map mapField = new map(types::Integer, types::String); mapEnumerator me; fieldId fieldId; int a, fieldCnt,m; name fieldName, fieldLabel; container con, fieldCon; identifiername extend; types type; System.Type netType; ; dicTable = new DictTable(_tableId); fieldCnt = dicTable.fieldCnt(); if(dicTable.isMap())// || dicTable.isSystemTable() || dicTable.isView()) return _colCollection; for(m = 1;m <= fieldCnt; m++) { dictField = new DictField(dicTable.id(),dicTable.fieldCnt2Id(m)); fieldId = dictField.id(); fieldName = dictField.name(dbBackend::Sql); fieldLabel = dictField.label(); type = dictField.baseType(); if(dictField.isSystem() && fieldName != "DATAAREAID") continue; if (!fieldName) continue; if (type == types::Container) continue; if (fieldName like "del_*") continue; extend = global::extendedTypeId2name(dictField.typeId()); if (dictField.arraySize() > 1) // 数组 Dimension { for(a = 1; a <= dictField.arraySize(); a++) { dfArray = new dictField(dicTable.id(), fieldId2Ext(dictField.id(), a)); fieldId = dfArray.id(); fieldName = dfArray.name(dbBackend::Sql); fieldLabel = dfArray.label(); if (!fieldLabel) fieldLabel = fieldName; if (setLabel.in(fieldLabel)) continue; setLabel.add(fieldLabel); mapField.insert(fieldId, fieldName); _colCollection.Add(fieldName); } } else { if (!fieldLabel) fieldLabel = fieldName; if (setLabel.in(fieldLabel)) continue; setLabel.add(fieldLabel); mapField.insert(fieldId, fieldName); _colCollection.Add(fieldName); //_colCollection.Add(fieldName, netType = System.Type::GetType("System.Int32");//int //System.Int64;//int64; /* System.String;//str; System.Int64;//int64; System.Int64;//int64; System.Int64;//int64;*/ } } /* me = mapField.getEnumerator(); while (me.moveNext()) { fieldId = me.currentKey(); fieldName = me.currentValue(); lastCol++; } */ return _colCollection; }