/// <summary>
 /// Determines the 'Primary Phone Number' and the 'Primary E-mail Address' of the PERSON.
 /// </summary>
 /// <param name="APrimaryPhoneNumberOfPerson">'Primary Phone Number' of the PERSON.</param>
 /// <param name="APrimaryEmailAddressOfPerson">'Primary E-mail Address'.</param>
 private void DeterminePrimaryEmailAndPrimaryPhone(out string APrimaryPhoneNumberOfPerson,
                                                   out string APrimaryEmailAddressOfPerson)
 {
     Ict.Petra.Shared.MPartner.Calculations.GetPrimaryEmailAndPrimaryPhone(
         (PPartnerAttributeTable)FMainDS.Tables[PPartnerAttributeTable.GetTableName()],
         out APrimaryPhoneNumberOfPerson, out APrimaryEmailAddressOfPerson);
 }
        /// <summary>
        /// Calls the normal ShowData() Method and then performs the rest of the
        /// setting up of the data that is shown in the screen.
        /// </summary>
        /// <returns>void</returns>
        private void SpecialShowData()
        {
            ShowData((PPersonRow)FMainDS.PPerson.Rows[0]);

            // Check for unexpected condition...
            if (FMainDS.SummaryData.Rows.Count == 0)
            {
                MessageBox.Show("FMainDS.SummaryData holds NO ROWS!", DEV_FIX);
            }

            // Show note about multiple Churches/Pastors, if applicable
            SetupMultipleRecordsInfoText();

            // Setup Jobs/Commitments Grid
            DataView myDataView = FMainDS.JobAssignmentStaffDataCombined.DefaultView;

            myDataView.AllowNew   = false;
            myDataView.Sort       = PmJobAssignmentTable.GetFromDateDBName() + " DESC";
            grdDetails.DataSource = new DevAge.ComponentModel.BoundDataView(myDataView);

            // Determine the 'Primary Phone Number' and the 'Primary E-mail Address' of the PERSON
            if (FMainDS.Tables[PPartnerAttributeTable.GetTableName()] != null)
            {
                DeterminePrimaryEmailAndPrimaryPhone(out FPhoneOfPerson, out FEmailOfPerson);
            }

            // Record current relationship(s) that are supporting Church(es) of the PERSON
            if (FMainDS.Tables[PPartnerRelationshipTable.GetTableName()] != null)
            {
                DetermineChurchRelationships(out FSupportingChurchesPartnerKeys);
            }
        }
        /// <summary>
        /// Called when data got saved in the screen. Performs a check whether reloading
        /// of the 'SummaryData' is necessary to reflect changes that were done elsewhere
        /// in the Partner Edit screen and which just got saved.
        /// </summary>
        /// <returns>void</returns>
        public void CheckForRefreshOfDisplayedData(bool AJobAndStaffDataGridNeedsRefresh)
        {
            bool   RefreshNecessary = false;
            string PhoneOfPerson;
            string EmailOfPerson;

            if (!AJobAndStaffDataGridNeedsRefresh)
            {
                Int64[] SupportingChurchesPartnerKeys = new long[0];

                if (FMainDS.Tables[PPartnerAttributeTable.GetTableName()] != null)
                {
                    // Check for change of the 'Primary Phone Number' and the 'Primary E-mail Address' of the PERSON
                    DeterminePrimaryEmailAndPrimaryPhone(out PhoneOfPerson, out EmailOfPerson);

                    if ((PhoneOfPerson != FPhoneOfPerson) ||
                        (EmailOfPerson != FEmailOfPerson))
                    {
                        RefreshNecessary = true;
                    }
                }

                if (FMainDS.Tables[PPartnerRelationshipTable.GetTableName()] != null)
                {
                    // Check for change in supporting Church/es relationship(s)
                    DetermineChurchRelationships(out SupportingChurchesPartnerKeys);

                    if ((FSupportingChurchesPartnerKeys == null) ||
                        (FSupportingChurchesPartnerKeys.Length != SupportingChurchesPartnerKeys.Length))
                    {
                        RefreshNecessary = true;
                    }
                    else
                    {
                        for (int Counter = 0; Counter < SupportingChurchesPartnerKeys.Length; Counter++)
                        {
                            if (SupportingChurchesPartnerKeys[Counter] != FSupportingChurchesPartnerKeys[Counter])
                            {
                                RefreshNecessary = true;
                            }
                        }
                    }
                }
            }
            else
            {
                RefreshNecessary = true;
            }

            if (RefreshNecessary)
            {
                // Call WebConnector to retrieve SummaryData afresh!
                IndividualDataTDS FillDS = new IndividualDataTDS();
                FillDS.Merge(FMainDS.MiscellaneousData);

                TRemote.MPersonnel.Person.DataElements.WebConnectors.GetSummaryData(FMainDS.PPerson[0].PartnerKey, ref FillDS);

                FMainDS.SummaryData.Rows.Clear();
                FMainDS.Merge(FillDS.SummaryData);
                FMainDS.JobAssignmentStaffDataCombined.Rows.Clear();
                FMainDS.Merge(FillDS.JobAssignmentStaffDataCombined);

                // Refresh the displayed data
                SpecialShowData();
            }
        }