Пример #1
0
        private void LoadLog(int pos, int count, bool print = false)
        {
            if (pos < 0)
            {
                return;
            }
            var dateBefore = DateTime.Now.AddYears(-1);

            CalcRowsCount(lvLogView);
            int linescount;
            var results = Data.GetChangeLogRecords(pos, count, dateBefore, out linescount, true);

            if (count <= 0)
            {
                return;
            }
            _reportrows.Clear();
            var row = 0;

            foreach (string[] rec in results)
            {
                if (rec.Length != 12)
                {
                    continue;
                }
                var item = new ListViewItem(rec[0]);
                if (row % 2 != 0)
                {
                    item.BackColor = Color.FromKnownColor(KnownColor.WhiteSmoke);
                }
                var overpass = rec[2];
                var way      = rec[3];
                var product  = Data.GetFineProductName(rec[4]);
                var riser    = rec[5];
                var addr     = FineAddr(overpass, way, product, riser);
                item.SubItems.Add(addr);
                var param = rec[7];
                item.SubItems.Add(param);
                var oldstate = rec[8];
                item.SubItems.Add(oldstate);
                var newstate = rec[9];
                item.SubItems.Add(newstate);
                var user = rec[10];
                item.SubItems.Add(user);
                var desc = rec[11];
                item.SubItems.Add(desc);
                _reportrows.Add(item);
                row++;
            }
            UpdateColumnWidths(lvLogView);
            if (print)
            {
                return;
            }
            lvLogView.BeginUpdate();
            try
            {
                lvLogView.Items.Clear();
                lvLogView.Items.AddRange(_reportrows.ToArray());
            }
            finally
            {
                lvLogView.EndUpdate();
            }
        }