aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools/Target.cs
diff options
context:
space:
mode:
authorSerghei Cebotari <51533848+schebotar@users.noreply.github.com>2022-02-01 20:33:33 +0300
committerGitHub <noreply@github.com>2022-02-01 20:33:33 +0300
commit180807d749f4eb3a16c1f136d42b90ea2945008f (patch)
tree24298e02436da95fd3b24b98ae61fb2b88c3f7e9 /src/PriceListTools/Target.cs
parent62cfb27784ce601acf8c45ed8470769d454921db (diff)
parent7e5020ec253df1d0d32304ba72cdaa62937bb26b (diff)
Merge pull request #14 from schebotar/dev
Dev
Diffstat (limited to 'src/PriceListTools/Target.cs')
-rw-r--r--src/PriceListTools/Target.cs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/PriceListTools/Target.cs b/src/PriceListTools/Target.cs
index a7e87ec..996a092 100644
--- a/src/PriceListTools/Target.cs
+++ b/src/PriceListTools/Target.cs
@@ -1,21 +1,29 @@
using Microsoft.Office.Interop.Excel;
using System;
+using System.Linq;
namespace RehauSku.PriceListTools
{
internal class Target : PriceList
{
+ private const string oldSkuHeader = "Прежний материал";
+ public Range oldSkuCell { get; private set; }
+
public Target(Workbook workbook)
{
Sheet = workbook.ActiveSheet;
Name = workbook.FullName;
- amountCell = Sheet.Cells.Find(amountHeader);
- skuCell = Sheet.Cells.Find(skuHeader);
- groupCell = Sheet.Cells.Find(groupHeader);
- nameCell = Sheet.Cells.Find(nameHeader);
+ Range[] cells = new[]
+ {
+ amountCell = Sheet.Cells.Find(amountHeader),
+ skuCell = Sheet.Cells.Find(skuHeader),
+ groupCell = Sheet.Cells.Find(groupHeader),
+ nameCell = Sheet.Cells.Find(nameHeader),
+ oldSkuCell = Sheet.Cells.Find(oldSkuHeader)
+ };
- if (amountCell == null || skuCell == null || groupCell == null || nameCell == null)
+ if (cells.Any(x => x == null))
{
throw new ArgumentException($"Шаблон { Name } не является прайс-листом");
}