/// <inheritdoc />
        public void Process(ImportParameters importParameters)
        {
            var lookupChunksData = _importDataProvider.Get(importParameters.ImportSessionId);

            if (!lookupChunksData.Any())
            {
                lookupChunksData = GetLookupChunkData(importParameters);
                SaveLookupChunksData(lookupChunksData);
            }

            var handler = new ChunkLookupValuesHandler(UserConnection);

            handler.ProcessError += SendProcessError;
            try {
                foreach (var item in lookupChunksData.Where(l => l.State == ImportChunkState.ToProcess))
                {
                    if (_importParametersRepository.GetIsImportSessionCanceled(importParameters.ImportSessionId))
                    {
                        break;
                    }
                    handler.Execute(item);
                }
            } finally {
                handler.ProcessError -= SendProcessError;
            }
            _lookupProcessedValues = new LookupProcessedValues(UserConnection);
            _lookupProcessedValues.RestoreState(JoinLookupProcessedValues(lookupChunksData.Select(c => c.Data.ProcessedValuesState).ToList()));
        }
예제 #2
0
        /// <inheritdoc />
        public void Process(ImportParameters importParameters)
        {
            var lookupChunksData = GetOrCreateDataChuncks(importParameters);

            var handler = new ChunkLookupValuesHandler(UserConnection);

            handler.ProcessError += SendProcessError;
            try {
                foreach (var item in lookupChunksData.Where(l => l.State == ImportChunkState.ToProcess))
                {
                    if (importParameters.GetIsImportCancelled(UserConnection))
                    {
                        break;
                    }
                    handler.Execute(item);
                }
            } finally {
                handler.ProcessError -= SendProcessError;
            }
            _lookupProcessedValues = new LookupProcessedValues(UserConnection);
            _lookupProcessedValues.RestoreState(JoinLookupProcessedValues(lookupChunksData.Select(c => c.Data.ProcessedValuesState).ToList()));
        }