// starts the merge process private void BtnOK_Click(Object Sender, EventArgs e) { FFromPartnerKey = Convert.ToInt64(txtMergeFrom.Text); FToPartnerKey = Convert.ToInt64(txtMergeTo.Text); if (CheckPartnersCanBeMerged() && (MessageBox.Show(Catalog.GetString("WARNING: A Partner Merge operation cannot be undone and the From-Partner will be no longer " + "accessible after the Partner Merge operation!") + "\n\n" + Catalog.GetString("Are you sure you want to continue?"), Catalog.GetString("Merge Partners"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)) { bool[] Categories = new bool[20]; for (int i = 1; i < 20; i++) { Categories[i] = true; } FSiteKeys = null; FLocationKeys = null; FMainBankingDetailsKey = -1; bool DifferentFamilies = false; // open a dialog to select which To Partner's addresses should be merged if (GetSelectedAddresses() == false) { MessageBox.Show(Catalog.GetString("Merge cancelled.")); return; } // open a dialog to select which bank account should be set to MAIN (if necessary) if (GetMainBankAccount() == false) { MessageBox.Show(Catalog.GetString("Merge cancelled.")); return; } // if ((((FFromPartnerClass == TPartnerClass.FAMILY) && (FToPartnerClass == TPartnerClass.FAMILY)) || (FFromPartnerClass == TPartnerClass.PERSON)) && (GiftDestinationToMerge(out Categories[0]) == false)) { MessageBox.Show(Catalog.GetString("Merge cancelled.")); return; } Thread t = new Thread(() => MergeTwoPartners(Categories, ref DifferentFamilies)); using (TProgressDialog dialog = new TProgressDialog(t)) { if ((dialog.ShowDialog() == DialogResult.Cancel) && (WebConnectorResult == true)) { MessageBox.Show(Catalog.GetString("Merge cancelled.")); return; } else if (!WebConnectorResult) // if merge is unsuccessful { MessageBox.Show(Catalog.GetString("Merge failed. Please check the Server.log file on the server")); dialog.Close(); return; } } if (DifferentFamilies) { MessageBox.Show(String.Format(Catalog.GetString("Partners were in different families.")) + "\n\n" + Catalog.GetString("FAMILY relations of the From Partner are not taken over to the To Partner!") + "\n\n" + Catalog.GetString("Please check the family relations of the To Partner after completion."), Catalog.GetString("Merge Partners"), MessageBoxButtons.OK, MessageBoxIcon.Information); } MessageBox.Show(String.Format(Catalog.GetString("Merge of Partner {0} into {1} complete."), FFromPartnerKey, FToPartnerKey) + "\n\n" + Catalog.GetString("If necessary, edit the merged Partner to correct any information that may not have been " + "merged and correct information that may have been overwritten.") + "\n\n" + Catalog.GetString("Tip: You can use the 'Work with Last Partner' command in the Partner module and the " + "'Work with Last Person' command in the Personnel module to view and edit the merged Partner."), Catalog.GetString("Merge Partners"), MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } }