Exemple #1
0
        internal static void SyncColumns(CremaDataTable diffTable1, CremaDataTable diffTable2, CremaDataTable dataTable1, CremaDataTable dataTable2)
        {
            var inlineBuilder = new SideBySideDiffBuilder(new Differ());
            var columnText1   = dataTable1 == null ? string.Empty : GetString(dataTable1.Columns);
            var columnText2   = dataTable2 == null ? string.Empty : GetString(dataTable2.Columns);
            var columnDiff    = inlineBuilder.BuildDiffModel(columnText1, columnText2);

            diffTable1.Clear();
            diffTable2.Clear();
            diffTable1.Columns.Clear();
            diffTable2.Columns.Clear();
            FillColumns(diffTable1, dataTable1, columnDiff.OldText.Lines);
            FillColumns(diffTable2, dataTable2, columnDiff.NewText.Lines);

            if (dataTable1 == null)
            {
                foreach (var item in diffTable1.Columns)
                {
                    DiffUtility.SetDiffState(item, DiffState.Imaginary);
                }
            }

            if (dataTable2 == null)
            {
                foreach (var item in diffTable2.Columns)
                {
                    DiffUtility.SetDiffState(item, DiffState.Imaginary);
                }
            }
        }
Exemple #2
0
        internal static void InitializeChildRows(CremaDataTable diffTable1, CremaDataTable diffTable2, CremaDataTable dataTable1, CremaDataTable dataTable2)
        {
            var diffParent1 = diffTable1.Parent;
            var diffParent2 = diffTable2.Parent;

            diffTable1.Clear();
            diffTable2.Clear();

            for (var i = 0; i < diffParent1.Rows.Count; i++)
            {
                var dr1 = diffParent1.Rows[i];
                var dr2 = diffParent2.Rows[i];
                var sr1 = (CremaDataRow)diffParent1.ExtendedProperties[dr1];
                var sr2 = (CremaDataRow)diffParent2.ExtendedProperties[dr2];

                InitializeChildRows(dr1, dr2, sr1, sr2, diffTable1, diffTable2, dataTable1, dataTable2);
            }
        }