Beispiel #1
0
 void distribute(DataRow row, string[] cols)
 {
     if (needUpdate(row, cols))
     {
         bool drivedUpdateMode = flags.isFlagEnabled(UpdateTypeFlags.__spe__updateIfDrived);
         if (drivedUpdateMode)
         {
             bool hasFull = false;
             for (int i = 0; i < allChildCol.Length; ++i)
             {
                 if (ToolColumn.isColumnFullName(allChildCol[i]))
                 {
                     hasFull = true;
                 }
             }
             if (!hasFull)
             {
                 return;
             }
         }
         //getData
         source.getBuilder().reset();
         for (int i = 0; i < cols.Length; ++i)
         {
             string col = ToolColumn.extractColumnName(getColMap(cols[i]));
             string tab = ToolColumn.extractTableName(getColMap(cols[i]));
             object val = row[cols[i]];
             if ((tab != string.Empty) && (col != string.Empty))
             {
                 source.getBuilder().addParameterValueTable(tab, col, val);
             }
             else
             if (col != string.Empty)
             {
                 source.getBuilder().addParameterValue(col, val);
             }
             else
             if (col == string.Empty)
             {
                 source.getBuilder().addFreeParameterValue(val);
             }
         }
         IDictionary dicData = ToolRow.convertFirstToDictionary(source.getAll());
         //
         if (dicData != null)
         { //Has data
             string[] tmpChildCol = (drivedUpdateMode ? ToolColumn.selectFullNameCols(updateChildCol) : updateChildCol);
             for (int i = 0; i < tmpChildCol.Length; ++i)
             {
                 ToolCell.set(row, tmpChildCol[i], dicData[getColMap(tmpChildCol[i])]);
             }
         }
         else
         { //No data
             if (!flags.isFlagEnabled(UpdateTypeFlags.disableEditCancel))
             {
                 row.CancelEdit();
             }
             else
             {
                 if (flags.isFlagEnabled(UpdateTypeFlags.setTypeDefaultToDrivedChild))
                 {
                     ToolRow.initTableNewRow(row, (drivedUpdateMode ? ToolColumn.selectFullNameCols(childCol) : childCol));
                 }
                 if (flags.isFlagEnabled(UpdateTypeFlags.setTypeDefaultToRelChild))
                 {
                     ToolRow.initTableNewRow(row, (drivedUpdateMode ? ToolColumn.selectFullNameCols(bindChildCol) : bindChildCol));
                 }
             }
         }
     }
 }