public void BindReportData(ImportReport report)
        {
            if (report == null)
                throw new ArgumentNullException("report");

            _ltrFilename.Text = report.Filename;
            _ltrMode.Text = report.Mode == ImportMode.Smart ? "вставка/обновление" : "массированный";
            _ltrElapsed.Text = report.Elapsed.ToString();
            _ltrFound.Text = report.TotalCount.ToString();
            _ltrSkipped.Text = report.InvalidCount.ToString();
            _ltrRemoved.Text = report.Counters.Deleted.ToString();
            _ltrAdded.Text = report.Counters.Added.ToString();
            _ltrUpdated.Text = report.Counters.Updated.ToString();

            if (report.HasErrors)
            {
                _rptDbErrors.DataSource = report.Errors;
                _rptDbErrors.DataBind();
            }

            if (report.HasValidationErrors)
            {
                _rptValidationErrors.DataSource = report.ValidationErrors;
                _rptValidationErrors.DataBind();
            }
        }
Esempio n. 2
0
        public ImportReport ImportData( Stream stream, string filename )
        {
            if( _disposed )
                throw new ObjectDisposedException( "ImporterBase" );
            if( stream == null )
                throw new ArgumentNullException( "stream" );
            if( string.IsNullOrEmpty( filename ) )
                throw new ArgumentException( "Filename cannot be empty", "filename" );

            _CurrentReport = new ImportReport() { Filename = filename, Mode = _Activity.Mode };

            var sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            _Activity.Run( stream );

            sw.Stop();
            _CurrentReport.Elapsed = sw.Elapsed;
            LockerManager._releaseAppLock(_Connection);
            return _CurrentReport;
        }