RhSolutions-AddIn/src/PriceListTools/TargetPriceList.cs

34 lines
1010 B
C#
Raw Normal View History

2022-01-27 09:59:33 +03:00
using Microsoft.Office.Interop.Excel;
using System;
using System.Linq;
2022-01-27 09:59:33 +03:00
namespace RehauSku.PriceListTools
{
2022-02-02 18:05:49 +03:00
internal class TargetPriceList : AbstractPriceList
2022-01-27 09:59:33 +03:00
{
private const string oldSkuHeader = "Прежний материал";
public Range oldSkuCell { get; private set; }
2022-02-02 18:05:49 +03:00
public TargetPriceList(Workbook workbook)
2022-01-27 09:59:33 +03:00
{
Sheet = workbook.ActiveSheet;
2022-01-27 17:34:03 +03:00
Name = workbook.FullName;
2022-01-27 09:59:33 +03:00
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)
};
2022-01-27 09:59:33 +03:00
if (cells.Any(x => x == null))
2022-01-27 09:59:33 +03:00
{
2022-01-27 17:34:03 +03:00
throw new ArgumentException($"Шаблон { Name } не является прайс-листом");
2022-01-27 09:59:33 +03:00
}
}
}
}