Пример #1
0
 public static TableLookupResult ConstructResult(
     bool isResultDBTable, string tableName, string fieldName, string foreignKeyFieldName,
     bool fieldsExactMatch, Dictionary<string, string> fieldsMap, bool isGeneric, DocumentClass documentClass)
 {
     TableLookupResult newResult = new TableLookupResult();
     newResult.isResultDBTable = isResultDBTable;
     newResult.tableName = tableName;
     newResult.fieldName = fieldName;
     newResult.foreignKeyFieldName = foreignKeyFieldName;
     newResult.fieldsExactMatch = fieldsExactMatch;
     if (!fieldsExactMatch)
         newResult.fieldsMap = fieldsMap;
     newResult.isGeneric = isGeneric;
     if (!isGeneric)
         newResult.docClass = documentClass;
     return newResult;
 }
Пример #2
0
 public static void BuildChildRelationship(DataTable childTable, DataTable parentTable, TableLookupResult result)
 {
     foreach (DataRow parentRow in parentTable.Rows)
     {
         //get the parent key column
         DataColumn parentKeyColumn = parentTable.PrimaryKey[0];
         
         //get the query value                                
         string queryValue = string.Empty;
         string queryKey = string.Empty;
         string selectColumn = "*";
         if (result.ForeignKeyFieldName != TableLookupResult.SAMEASPARENTKEY)
         {
             queryKey = result.ForeignKeyFieldName;
             queryValue = parentRow[result.ForeignKeyFieldName].ToString();
         }
         if (!result.IsResultDBTable)
         {
             selectColumn = result.FieldName;
         }
         PopulateTable(childTable, result.TableName, queryKey, queryValue, true, parentKeyColumn.ColumnName, Convert.ToInt32(parentRow[parentKeyColumn]), selectColumn);                
     }
 }