Example #1
0
        protected override void Start()
        {
            string dat = SearthCellFromMark("Выгрузка от:", false).StringCellValue;

            YM = (int)MyTools.StringDATE_In_intDate(dat.Substring(dat.IndexOf(':') + 1), MyTools.EInputDate.YM, MyTools.EInputDate.YM);
            TextBlock text = new TextBlock();

            text.Background = Brushes.LightCoral;
            text.FontSize   = 20;
            text.Text       = dat;
            wpText.Children.Add(text);

            shows = new List <show>();
            progressOpenFile openFile = new progressOpenFile(sheet.LastRowNum - StartRow, new  Func <int, bool>(
                                                                 RowIndex =>
            {
                IRow row   = sheet.GetRow(RowIndex);
                int select = 0;
                Dictionary <string, decimal> value = new Dictionary <string, decimal>();
                foreach (var one in ColumnsBook)
                {
                    if (one.Key == col.select)
                    {
                        select = row.GetCell(one.Value).ToString().TryParseInt();
                    }
                    else
                    {
                        if (one.Value > 0 && row.GetCell(one.Value).ToString() != "0")
                        {
                            value.Add(one.Key, row.GetCell(one.Value).ToString().TryParseDecimal());
                        }
                    }
                }
                if (select != 0)
                {
                    shows.Add(new show(select, value));
                }
                return(true);
            }));

            _progress = new Progress_Form(openFile);
            _progress.ShowDialog();
            DG.ItemsSource = shows;
        }
Example #2
0
        protected override void Start()
        {
            string dat = SearthCellFromMark("Дата начала: ", false).StringCellValue;

            YM = (int)MyTools.StringDATE_In_intDate(dat.Substring(dat.IndexOf(':') + 1), MyTools.EInputDate.YMDHMS, MyTools.EInputDate.YM);
            LoadSelection();
            shows = new List <show>();
            progressOpenFile openFile = new progressOpenFile(sheet.LastRowNum - StartRow, new Func <int, bool>(
                                                                 RowIndex =>
            {
                IRow row     = sheet.GetRow(RowIndex);
                calc[] _calc = null;
                Dictionary <string, object> value = new Dictionary <string, object>();
                foreach (var one in ColumnsBook)
                {
                    string val = row.GetCell(one.Value).ToString();
                    if (one.Key == col.ls)
                    {
                        if (!val.Contains('\''))
                        {
                            throw new Exception($"Колонка {col.ls} не содержит символ: \'");
                        }
                        val   = val.Replace("\'", "");
                        _calc = calcs.Where(x => x.objecte.Accounts.Contains(val)).ToArray();
                    }
                    if (_calc.Length == 0 && one.Key == col.inn)
                    {
                        _calc = calcs.Select(x => new { client = x.client, calc = x }).Where(x => x.client.INN == val).Select(x => x.calc).ToArray();
                    }

                    value.Add(one.Key, val);
                }
                shows.Add(new show(_calc, value));
                return(true);
            }));

            _progress = new Progress_Form(openFile);
            _progress.ShowDialog();
            DG.ItemsSource = shows;
        }