aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools/PriceListTool.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2022-01-28 12:27:10 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2022-01-28 12:27:10 +0300
commit952ca22316b4e4ac25004cd453baac1afac5adaf (patch)
tree7a9fab04599cc5b9d0e64a7dd70005c3cbd1f9cd /src/PriceListTools/PriceListTool.cs
parent711cc313e0eaed646c5058ef294de6d89770e352 (diff)
Implement filling positions to correct sku group
Diffstat (limited to 'src/PriceListTools/PriceListTool.cs')
-rw-r--r--src/PriceListTools/PriceListTool.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/PriceListTools/PriceListTool.cs b/src/PriceListTools/PriceListTool.cs
index 127912b..cf2cd59 100644
--- a/src/PriceListTools/PriceListTool.cs
+++ b/src/PriceListTools/PriceListTool.cs
@@ -34,19 +34,27 @@ namespace RehauSku.PriceListTools
protected private void FillColumn(IEnumerable<KeyValuePair<Position, double>> dictionary, int column)
{
List<KeyValuePair<Position, double>> missing = new List<KeyValuePair<Position, double>>();
+ object[,] groupColumn = TargetFile.groupCell.EntireColumn.Value2;
foreach (var kvp in dictionary)
{
- Range cell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
+ Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
+ string foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
- if (cell == null)
+ while (foundCell != null && foundCellGroup != kvp.Key.Group)
+ {
+ foundCell = TargetFile.skuCell.EntireColumn.FindNext(foundCell);
+ foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
+ }
+
+ if (foundCell == null)
{
missing.Add(kvp);
}
else
{
- Range sumCell = TargetFile.Sheet.Cells[cell.Row, column];
+ Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column];
if (sumCell.Value2 == null)
{