public void BeginTransaction(DataPreprocessingChangedEventType type)
 {
     if (IsFiltered)
     {
         throw new InvalidOperationException("Transaction not possible while data is filtered");
     }
     originalData.BeginTransaction(type);
 }
        public bool ApplyTransformations(IEnumerable <ITransformation> transformations, bool preserveColumns, out string errorMsg)
        {
            bool success = false;

            errorMsg = string.Empty;
            preprocessingData.BeginTransaction(DataPreprocessingChangedEventType.Transformation);

            try {
                var doubleTransformations = transformations.OfType <Transformation <double> >().ToList();

                if (preserveColumns)
                {
                    PreserveColumns(doubleTransformations);
                }

                // all transformations are performed inplace. no creation of new columns for transformations
                ApplyDoubleTranformationsInplace(doubleTransformations, preserveColumns, out success, out errorMsg);

                if (preserveColumns)
                {
                    RenameTransformedColumsAndRestorePreservedColumns(doubleTransformations);
                    RenameTransformationColumnParameter(doubleTransformations);
                    InsertCopyColumTransformations(doubleTransformations);

                    originalColumns.Clear();
                    renamedColumns.Clear();
                }
                // only accept changes if everything was successful
                if (!success)
                {
                    preprocessingData.Undo();
                }
            } catch (Exception e) {
                preprocessingData.Undo();
                if (string.IsNullOrEmpty(errorMsg))
                {
                    errorMsg = e.Message;
                }
            } finally {
                preprocessingData.EndTransaction();
            }

            return(success);
        }