diff options
Diffstat (limited to 'RhSolutions.AddIn/Controllers/MergeTool.cs')
-rw-r--r-- | RhSolutions.AddIn/Controllers/MergeTool.cs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/RhSolutions.AddIn/Controllers/MergeTool.cs b/RhSolutions.AddIn/Controllers/MergeTool.cs new file mode 100644 index 0000000..dec8ff7 --- /dev/null +++ b/RhSolutions.AddIn/Controllers/MergeTool.cs @@ -0,0 +1,46 @@ +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(); + } + } + } +} |