aboutsummaryrefslogtreecommitdiff
path: root/src/PriceListTools/ConvertTool.cs
blob: 3b634eb8fa705073a66ad65cc90a5694e9136fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using RehauSku.Interface;
using System;

namespace RehauSku.PriceListTools
{
    internal class ConvertTool : AbstractTool
    {
        private SourcePriceList Current;

        public void GetCurrent()
        {
            try
            {
                Current = new SourcePriceList(ExcelApp.ActiveWorkbook);
            }

            catch (Exception exception)
            {
                System.Windows.Forms.MessageBox.Show
                    (exception.Message,
                    "Ошибка распознавания",
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Information);
                throw exception;
            }
        }

        public void FillTarget()
        {
            ProgressBar bar = new ProgressBar("Заполняю строки...", Current.PositionAmount.Count);

            foreach (var kvp in Current.PositionAmount)
            {
                FillPositionAmountToColumns(kvp, TargetFile.amountCell.Column);
                bar.DoProgress();
            }

            FilterByAmount();

            Dialog.SaveWorkbookAs();
        }
    }
}