aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2022-01-28 15:38:57 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2022-01-28 15:38:57 +0300
commit2cbce48654644542723b6ed07a020afdb5b5db87 (patch)
treec89cb26e3964ba0a1e9ce35279a468839cbfcb80 /src/PriceListTools
parentca575bef2dae6bb50b87f3dc46e24b60d5bc222d (diff)
Refactoring
Diffstat (limited to 'src/PriceListTools')
-rw-r--r--src/PriceListTools/PriceListTool.cs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/PriceListTools/PriceListTool.cs b/src/PriceListTools/PriceListTool.cs
index a80010b..1736835 100644
--- a/src/PriceListTools/PriceListTool.cs
+++ b/src/PriceListTools/PriceListTool.cs
@@ -9,6 +9,7 @@ namespace RehauSku.PriceListTools
{
protected private Application ExcelApp = (Application)ExcelDnaUtil.Application;
protected private Target TargetFile;
+ protected private List<KeyValuePair<Position, double>> Missing;
public void OpenNewPrice()
{
@@ -33,44 +34,44 @@ namespace RehauSku.PriceListTools
protected private void FillColumn(IEnumerable<KeyValuePair<Position, double>> dictionary, params int[] columns)
{
- List<KeyValuePair<Position, double>> missing = new List<KeyValuePair<Position, double>>();
+ Missing = new List<KeyValuePair<Position, double>>();
object[,] groupColumn = TargetFile.groupCell.EntireColumn.Value2;
foreach (var kvp in dictionary)
{
- FillPosition(kvp, columns, ref missing, ref groupColumn);
+ FillPosition(kvp, columns);
}
- if (missing.Count > 0)
+ if (Missing.Count > 0)
{
System.Windows.Forms.MessageBox.Show
- ($"{missing.Count} артикулов отсутствует в таблице заказов {RegistryUtil.PriceListPath} Попробовать найти новый вариант?",
+ ($"{Missing.Count} артикулов отсутствует в таблице заказов {RegistryUtil.PriceListPath} Попробовать найти новый вариант?",
"Отсутствует позиция в конечной таблице заказов",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Information);
}
}
- protected private void FillPosition(KeyValuePair<Position, double> kvp, int[] columns, ref List<KeyValuePair<Position, double>> missing, ref object[,] groupColumn)
+ protected private void FillPosition(KeyValuePair<Position, double> kvp, int[] columns)
{
Range foundCell = TargetFile.skuCell.EntireColumn.Find(kvp.Key.Sku);
if (foundCell == null)
{
- missing.Add(kvp);
+ Missing.Add(kvp);
return;
}
- string foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
+ string foundCellGroup = TargetFile.Sheet.Cells[foundCell.Row, TargetFile.groupCell.Column].Value2.ToString();
while (foundCell != null && foundCellGroup != kvp.Key.Group)
{
foundCell = TargetFile.skuCell.EntireColumn.FindNext(foundCell);
- foundCellGroup = groupColumn[foundCell.Row, 1].ToString();
+ foundCellGroup = TargetFile.Sheet.Cells[foundCell.Row, TargetFile.groupCell.Column].Value2.ToString();
}
if (foundCell == null)
{
- missing.Add(kvp);
+ Missing.Add(kvp);
}
else