From b4763bd03c410433e3f8b885e5db6704337318d5 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 28 Jan 2022 15:11:39 +0300 Subject: [PATCH] Change column parameter to parameters array --- src/PriceListTools/CombineTool.cs | 5 ++--- src/PriceListTools/PriceListTool.cs | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/PriceListTools/CombineTool.cs b/src/PriceListTools/CombineTool.cs index a5864b7..474fd99 100644 --- a/src/PriceListTools/CombineTool.cs +++ b/src/PriceListTools/CombineTool.cs @@ -1,6 +1,5 @@ using Microsoft.Office.Interop.Excel; using System.Collections.Generic; -using System.Linq; namespace RehauSku.PriceListTools { @@ -22,8 +21,8 @@ namespace RehauSku.PriceListTools newColumnHeader.Value2 = $"{source.Name}"; newColumnHeader.WrapText = true; - FillColumn(source.PositionAmount, TargetFile.amountCell.Column - 1); - FillColumn(source.PositionAmount, TargetFile.amountCell.Column); + FillColumn(source.PositionAmount, TargetFile.amountCell.Column - 1, TargetFile.amountCell.Column); + //FillColumn(source.PositionAmount, ); } FilterByAmount(); diff --git a/src/PriceListTools/PriceListTool.cs b/src/PriceListTools/PriceListTool.cs index c3cc137..9aebd25 100644 --- a/src/PriceListTools/PriceListTool.cs +++ b/src/PriceListTools/PriceListTool.cs @@ -31,7 +31,7 @@ namespace RehauSku.PriceListTools } } - protected private void FillColumn(IEnumerable> dictionary, int column) + protected private void FillColumn(IEnumerable> dictionary, params int[] columns) { List> missing = new List>(); object[,] groupColumn = TargetFile.groupCell.EntireColumn.Value2; @@ -60,16 +60,18 @@ namespace RehauSku.PriceListTools else { - Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column]; - - if (sumCell.Value2 == null) + foreach (var column in columns) { - sumCell.Value2 = kvp.Value; - } + Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column]; + if (sumCell.Value2 == null) + { + sumCell.Value2 = kvp.Value; + } - else - { - sumCell.Value2 += kvp.Value; + else + { + sumCell.Value2 += kvp.Value; + } } } }