23 lines
837 B
C#
23 lines
837 B
C#
namespace RhSolutions.Tools;
|
|
|
|
internal class SleevesTool : Tool
|
|
{
|
|
private readonly IFittingsCalculator _sleevesCaluculator;
|
|
|
|
public SleevesTool(ReaderFactory readerFactory, WriterFactory writerFactory, IFittingsCalculator sleevesCaluculator) : base(readerFactory, writerFactory)
|
|
{
|
|
_sleevesCaluculator = sleevesCaluculator;
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
Application app = RhSolutionsAddIn.Excel.Application;
|
|
Worksheet worksheet = app.ActiveWorkbook.ActiveSheet;
|
|
_reader = _readerFactory.GetReader("Excel");
|
|
var products = _reader.ReadProducts(new[] { worksheet });
|
|
var sleeves = _sleevesCaluculator.Calculate(products.Select(p => p.Item2).First());
|
|
_writer = _writerFactory.GetWriter("CurrentPrice");
|
|
_writer.WriteProducts(sleeves);
|
|
}
|
|
}
|