2022-02-04 17:13:47 +03:00
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
2022-12-20 12:27:47 +03:00
|
|
|
|
using RhSolutions.Models;
|
2022-02-04 17:13:47 +03:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2022-12-20 12:27:47 +03:00
|
|
|
|
namespace RhSolutions.Services
|
2022-02-04 17:13:47 +03:00
|
|
|
|
{
|
|
|
|
|
public static class WorksheetExtensions
|
|
|
|
|
{
|
|
|
|
|
public static bool IsRehauSource(this Worksheet worksheet)
|
|
|
|
|
{
|
|
|
|
|
Range amountCell;
|
|
|
|
|
Range skuCell;
|
|
|
|
|
Range groupCell;
|
|
|
|
|
Range nameCell;
|
|
|
|
|
|
|
|
|
|
Range[] cells = new[]
|
|
|
|
|
{
|
2022-02-12 16:53:34 +03:00
|
|
|
|
amountCell = worksheet.Cells.Find(PriceListHeaders.Amount),
|
|
|
|
|
skuCell = worksheet.Cells.Find(PriceListHeaders.Sku),
|
|
|
|
|
groupCell = worksheet.Cells.Find(PriceListHeaders.Group),
|
|
|
|
|
nameCell = worksheet.Cells.Find(PriceListHeaders.Name)
|
2022-02-04 17:13:47 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return cells.All(x => x != null);
|
|
|
|
|
}
|
2022-02-08 16:19:49 +03:00
|
|
|
|
|
|
|
|
|
public static void AddValue(this Range range, double value)
|
|
|
|
|
{
|
|
|
|
|
if (range.Value2 == null)
|
|
|
|
|
{
|
|
|
|
|
range.Value2 = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
range.Value2 += value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-04 17:13:47 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|