private void btnGetDiscrepency_Click(object sender, EventArgs e) { try { richTxtDiscrepency.Text = ""; ClassCoreUtility.CaluculateAll(PBarDiscrepency); //ClassCoreUtility.CaluculateAll(pgrDiscrepency); if (string.IsNullOrEmpty(cmbDatabases.Text.ToString()) || string.IsNullOrEmpty(txtCoreAccountss.Text.ToString())) { MessageBox.Show("Please select Coredatabase and Account"); return; } string SQL; int count = 0; //Check whether Database exists on the SQL Server if (!(ClassCoreUtility.checkIfDatabaseExistsOnSQL(cmbDatabases.Text.ToString(), this.server.ToString(), txtUserID.Text.ToString(), txtPasswordsss.Text.ToString()))) { MessageBox.Show("Database does not exist on SQL Server"); return; } //Check whether database is Core Database if (!(ClassCoreUtility.checkIfCoreDatabase(cmbDatabases.Text.ToString(), this.server.ToString(), txtUserID.Text.ToString(), txtPasswordsss.Text.ToString()))) { MessageBox.Show("Selected Database not a Core Database!!"); return; } //Check whether Database exist in CORE if (!(ClassCoreUtility.checkIfDatabaseAlreadyAddedToCore(cmbDatabases.Text.ToString(), this.server.ToString(), txtUserID.Text.ToString(), txtPasswordsss.Text.ToString()))) { MessageBox.Show("Database does not exist Core"); return; } //Get discrepency in Core database Dictionary <string, string> dctDiscrepency = ClassCoreUtility.GetDiscrepency(cmbDatabases.Text.ToString(), this.server.ToString(), txtUserID.Text.ToString(), txtPasswordsss.Text.ToString()); foreach (var item in dctDiscrepency) { string comment = item.Key.ToString(); int lencomment = comment.Length; richTxtDiscrepency.Text += comment; //richTxtDiscrepency.Select(richTxtDiscrepency.Text.IndexOf("--"), lencomment); //richTxtDiscrepency.ForeColor = System.Drawing.Color.Green; //richTxtDiscrepency.SelectionColor = Color.Green; //richTxtDiscrepency.SelectedText = Environment.NewLine + item.Value; richTxtDiscrepency.AppendText(Environment.NewLine); int lenSQL = item.Value.Length; richTxtDiscrepency.Text += item.Value.ToString(); richTxtDiscrepency.AppendText(Environment.NewLine); richTxtDiscrepency.AppendText(Environment.NewLine); } if (richTxtDiscrepency.Text == "") { MessageBox.Show("No Discrepency found!!"); } else { MessageBox.Show("Copy the Discrepencies!!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }