public int FillBlock(DataTable table) { int rowIndex = startRowIndex; for (int valueIndex = 0; valueIndex < table.Rows.Count; valueIndex++) { countedMap.Clear(); // fill key for each line, and count Data. // Check is Need Row ; if (dColumn != null && !dCloumnsCreated) { dColumn.CheckColumn(this, holder, rowIndex, table, valueIndex); } // fill key for each line, and count Data. for (int j = 0; j < gkeyList.Count; j++) { GroupValueSearchKey gkey = gkeyList [j]; if (gkey.rKey == null) { SearchKey key = new SearchKey(); key.colName = gkey.valueColName; gkey.rKey = ReusedKey.FindReusedKey(key); } gkey = gkey.Copy(); if (gkey.key != null) { gkey.key.FillKey(table, valueIndex); } holder.AddValue(countedMap, gkey, table, valueIndex); } // fill Data for (int j = 0; j < lineList.Count; j++) { TplLine line = lineList[j]; /* * if (j == 4) * j = 4 ; */ int nl = line.FillLine(holder, rowIndex, table, valueIndex); if (nl > 0) { FillLastLine(j, lastUsedLine, rowIndex - 1, table, lastUsedLineValueIndex); lastUsedLine = line; lastUsedLineValueIndex = valueIndex; // is LastLine, update current line if (valueIndex + 1 >= table.Rows.Count) { FillLastLine(j, line, rowIndex, table, lastUsedLineValueIndex); } } /*else * { * // Ensure Each Column is OK. * if (dColumn != null && lastUsedLine != null && lastUsedLine == line) * { * if (! lastUsedLine.containsHGroup) * lastUsedLine.UpdateRowData (holder, rowIndex - 1, table, valueIndex); * * if (updateAllRow) * { * for (int k = 0 ; k <= j ; k ++) * { * TplLine hLine = lineList [k] ; * if (hLine.containsHGroup && hLine.insertedRowList.Count > 0) * { * hLine.UpdateRowData(holder, * hLine.insertedRowList[hLine.insertedRowList.Count - 1], * table, valueIndex); * } * } * } * * } * }*/ rowIndex += nl; rowCount += nl; } } MergeHGroupCells(); //if the table is custum empty ,ignor the MergeVGroupCells if (table.ExtendedProperties.ContainsKey("TableType") && table.ExtendedProperties["TableType"].ToString() == "CustumEmpty") { return(rowCount); } MergeVGroupCells(); return(rowCount); }
public void AddValue(Dictionary <GroupValueSearchKey, bool> map, GroupValueSearchKey gkey, System.Data.DataTable table, int valueIndex) { if (map.ContainsKey(gkey)) { // ignored. return; } // judge Data is Match if (gkey.key != null) { SearchKey tmpKey = gkey.key; while (tmpKey != null) { if (tmpKey.rKey == null) { tmpKey.rKey = ReusedKey.FindReusedKey(tmpKey); } if (tmpKey.isFixedValue) { // Compare Fixed value Key only object keyValue = null; keyValue = tmpKey.rKey.GetReusedValue(table, valueIndex); // RangeHelper.GetColValue (table, valueIndex, tmpKey.colName) ; // Not match, return . if (!Equals(keyValue, tmpKey.keyValue)) { return; } } tmpKey = tmpKey.nextKey; } /*SearchKey copyKey = gkey.key.Copy0 (false) ; * copyKey.FillKey (table, valueIndex); * * // not match. * if (! copyKey.Equals (gkey.key)) * return ;*/ } object lastValue; if (!valueList.TryGetValue(gkey, out lastValue)) { lastValue = 0; valueList.Add(gkey, lastValue); } if (gkey.rKey == null) { SearchKey key = new SearchKey(); key.colName = gkey.valueColName; gkey.rKey = ReusedKey.FindReusedKey(key); } valueList [gkey] = CalculateForumla(gkey.formula, lastValue, gkey.rKey.GetReusedValue(table, valueIndex)); map[gkey /*.Copy()*/] = true; }