Exemplo n.º 1
0
        internal DiffTemplate(CremaDataTable diffTable1, CremaDataTable diffTable2, CremaDataTable dataTable1, CremaDataTable dataTable2)
        {
            this.diffTable1 = diffTable1.CloneTo(new CremaDataSet());
            this.diffTable2 = diffTable2.CloneTo(new CremaDataSet());

            foreach (var item in diffTable1.Columns)
            {
                var column = this.diffTable1.Columns[item.ColumnName];
                DiffUtility.SetDiffState(column, DiffUtility.GetDiffState(item));
            }

            foreach (var item in diffTable2.Columns)
            {
                var column = this.diffTable2.Columns[item.ColumnName];
                DiffUtility.SetDiffState(column, DiffUtility.GetDiffState(item));
            }

            this.dataTable1 = dataTable1;
            this.dataTable2 = dataTable2;

            this.diffSource1 = Create(this.diffTable1);
            this.diffSource2 = Create(this.diffTable2);
            this.diffSource1.ExtendedProperties[typeof(DiffTemplate)] = this;
            this.diffSource2.ExtendedProperties[typeof(DiffTemplate)] = this;
            this.dummy1 = this.diffSource1.TableName.StartsWith(DiffUtility.DiffDummyKey);
            this.dummy2 = this.diffSource2.TableName.StartsWith(DiffUtility.DiffDummyKey);

            this.AttachEventHandler(this.diffSource1, diffTable1);
            this.AttachEventHandler(this.diffSource2, diffTable2);
        }