/// <summary> /// Compare databases and view relult /// </summary> /// <param name="left">MDB instance</param> /// <param name="right">MDB instance</param> private void Compare(MDB left, MDB right) { TextBlockOut.Text = String.Empty; //fully joined left and right MDB collections var allTablesList = left.Tables.FullOuterJoin(right.Tables, l => l.Name, r => r.Name, (l, r, Name) => new { l, r }); foreach (var tablePair in allTablesList.ToList()) { string tableHeaderText; tableHeaderText = tablePair.l != null ? tablePair.l.Name + " " + tablePair.l.Description : tablePair.r.Name + " " + tablePair.l.Description; TextBlockOut.Text += tableHeaderText + "\r\n"; List<MDBTableColumn> lefttable = tablePair.l.Rows; List<MDBTableColumn> righttable = tablePair.r.Rows; //fully joined table collections var allTableColumnsList = lefttable.FullOuterJoin(righttable, l => l.Name, r => r.Name, (l, r, Name) => new { l, r }); foreach (var columnsPair in allTableColumnsList) { MDBTableColumn l_col = columnsPair.l??new MDBTableColumn(); MDBTableColumn r_col = columnsPair.r ?? new MDBTableColumn(); if (l_col == r_col) TextBlockOut.Text += " " + l_col.ToString() + r_col.ToString() + "\r\n"; else TextBlockOut.Text += " ► " + l_col.ToString() + r_col.ToString() + "\r\n"; } } }
/// <summary> /// Validate selected files and compare Access files /// </summary> /// <param name="sender">Element with Text property</param> private void FileSelectingAndProcessing(object sender) { SelectFile(sender); if (FilesSelected()) { MDB leftMDB = new MDB(FilePath_L.Text, "Left"); MDB rightMDB = new MDB(FilePath_R.Text, "Right"); if (leftMDB.DataLoaded && rightMDB.DataLoaded) { Compare(leftMDB, rightMDB); } } }