Пример #1
0
        public Task <StepResult> Execute(GetUniqueRowsStepParameters parameters, CancellationToken cancel)
        {
            _parameters = parameters;

            var primaryDataset    = _datasetPool.GetDataSet(parameters.PrimaryDatasetName);
            var uniqueRowsDataset = new DataTable();

            foreach (DataColumn column in primaryDataset.Columns)
            {
                uniqueRowsDataset.Columns.Add(column.ColumnName);
            }

            foreach (DataRow row in primaryDataset.Rows)
            {
                var matchValues = parameters.ComparisonColumns
                                  .Select(c => new MatchValue
                {
                    ColumnMapping = c,
                    SourceValue   = row[c.SourceColumnName].ToString(),
                })
                                  .ToList();

                if (!MatchInComparisonDataset(matchValues))
                {
                    uniqueRowsDataset.Rows.Add(row.ItemArray);
                }
            }

            _datasetPool.InsertOrReplace(_parameters.OutputDatasetName, uniqueRowsDataset);

            return(Task.FromResult(new StepResult()));
        }
Пример #2
0
        public async Task <StepResult> Execute(LoadCsvStepParameters parameters, CancellationToken cancel)
        {
            var data = await _fileProvider.ReadFromCsv(parameters.FileName);

            _datasetPool.InsertOrReplace(parameters.OutputDatasetName, data);

            return(new StepResult
            {
                OutputDatasetName = parameters.OutputDatasetName
            });
        }