RhSolutions-AddIn/RhSolutions.AddIn/Controllers/MergeTool.cs
2023-03-22 08:36:13 +03:00

47 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using RhSolutions.Models;
using System;
using System.Collections.Generic;
using System.Linq;
namespace RhSolutions.Controllers
{
internal class MergeTool : ToolBase
{
private List<SourcePriceList> SourceFiles { get; set; }
public MergeTool()
{
string[] files = Dialog.GetMultiplyFiles();
if (files != null)
{
SourceFiles = SourcePriceList.GetSourceLists(files);
}
else
{
throw new Exception("Не выбраны файлы");
}
}
public override void FillTarget()
{
using (ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count)))
using (ResultBar = new ResultBar())
{
foreach (SourcePriceList source in SourceFiles)
{
foreach (var kvp in source.PositionAmount)
{
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
ProgressBar.Update();
}
}
FilterByAmount();
ResultBar.Update();
}
}
}
}