Move FillPosition logic to separate method
This commit is contained in:
parent
b4763bd03c
commit
ca575bef2d
@ -38,42 +38,7 @@ namespace RehauSku.PriceListTools
|
|||||||
|
|
||||||
foreach (var kvp in dictionary)
|
foreach (var kvp in dictionary)
|
||||||
{
|
{
|
||||||
Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
|
FillPosition(kvp, columns, ref missing, ref groupColumn);
|
||||||
if (foundCell == null)
|
|
||||||
{
|
|
||||||
missing.Add(kvp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
string foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
foreach (var column in columns)
|
|
||||||
{
|
|
||||||
Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column];
|
|
||||||
if (sumCell.Value2 == null)
|
|
||||||
{
|
|
||||||
sumCell.Value2 = kvp.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sumCell.Value2 += kvp.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing.Count > 0)
|
if (missing.Count > 0)
|
||||||
@ -86,6 +51,46 @@ namespace RehauSku.PriceListTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected private void FillPosition(KeyValuePair<Position, double> kvp, int[] columns, ref List<KeyValuePair<Position, double>> missing, ref object[,] groupColumn)
|
||||||
|
{
|
||||||
|
Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
|
||||||
|
if (foundCell == null)
|
||||||
|
{
|
||||||
|
missing.Add(kvp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
foreach (var column in columns)
|
||||||
|
{
|
||||||
|
Range sumCell = TargetFile.Sheet.Cells[foundCell.Row, column];
|
||||||
|
if (sumCell.Value2 == null)
|
||||||
|
{
|
||||||
|
sumCell.Value2 = kvp.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sumCell.Value2 += kvp.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected private void FilterByAmount()
|
protected private void FilterByAmount()
|
||||||
{
|
{
|
||||||
AutoFilter filter = TargetFile.Sheet.AutoFilter;
|
AutoFilter filter = TargetFile.Sheet.AutoFilter;
|
||||||
|
Loading…
Reference in New Issue
Block a user