public void RunOperations(IEnumerable <ObfuscationInfo> obfuscationOps)
        {
            StatusChanged?.Invoke(new StatusInformation {
                Message = $"Starting operations..."
            }, null);

            var operationIndex     = 0;
            var numberOfOperations = obfuscationOps.Count();

            foreach (var obfuscation in obfuscationOps)
            {
                var status = new StatusInformation
                {
                    Message  = $"Obfuscating {obfuscation.Destination.Name}.({string.Join(",", obfuscation.Destination.Columns.Select(c => c.Name))})",
                    Progress = ++operationIndex,
                    Total    = numberOfOperations
                };
                StatusChanged?.Invoke(status, null);
                RunOperation(obfuscation, status);
            }

            StatusChanged?.Invoke(new StatusInformation {
                Message = $"DONE"
            }, null);
        }
        private void RunOperation(ObfuscationInfo obfuscationOperation, StatusInformation status = null)
        {
            IEnumerable <string> originData = null;

            DataPersistence.ConnectionString = obfuscationOperation.Destination.ConnectionString;
            var       dataSet            = DataPersistence.GetTableData(obfuscationOperation);
            DataTable scrambledDataTable = null;

            switch (obfuscationOperation.Origin.DataSourceType)
            {
            case DataSourceType.CSV:
                originData = GetSourceData(obfuscationOperation);
                break;

            case DataSourceType.DNIGenerator:
                originData = DniNie.GenerateDNI(dataSet.Tables[0].Rows.Count);
                break;

            case DataSourceType.NIEGenerator:
                originData = DniNie.GenerateNIE(dataSet.Tables[0].Rows.Count);
                break;

            case DataSourceType.NIFGenerator:
                originData = DniNie.GenerateNIF(dataSet.Tables[0].Rows.Count);
                break;

            case DataSourceType.Scramble:
                scrambledDataTable = ScrambleDataSet(obfuscationOperation.Destination, dataSet);
                break;

            default:
                originData = new List <string>();
                break;
            }

            if (status == null)
            {
                status = new StatusInformation();
            }

            if (obfuscationOperation.Origin.DataSourceType == DataSourceType.Scramble)
            {
                UpdateDataSet(dataSet, scrambledDataTable, obfuscationOperation);
            }
            else
            {
                UpdateDataset(dataSet, originData, obfuscationOperation.Destination.Columns[0].Name);
            }

            status.Message = $"...Saving obfuscation on {obfuscationOperation.Destination.Name}";
            StatusChanged?.Invoke(status, null);
            DataPersistence.PersistOfuscation(obfuscationOperation, dataSet);
        }