2022-01-27 09:59:33 +03:00
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
|
|
using System;
|
2022-02-01 20:32:29 +03:00
|
|
|
|
using System.Linq;
|
2022-01-27 09:59:33 +03:00
|
|
|
|
|
|
|
|
|
namespace RehauSku.PriceListTools
|
|
|
|
|
{
|
2022-02-02 18:03:49 +03:00
|
|
|
|
internal class Target : AbstractPriceList
|
2022-01-27 09:59:33 +03:00
|
|
|
|
{
|
2022-02-01 20:32:29 +03:00
|
|
|
|
private const string oldSkuHeader = "Прежний материал";
|
|
|
|
|
public Range oldSkuCell { get; private set; }
|
|
|
|
|
|
2022-01-27 10:22:30 +03:00
|
|
|
|
public Target(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
|
|
|
|
|
2022-02-01 20:32:29 +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
|
|
|
|
|
2022-02-01 20:32:29 +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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|