/// <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. This Method takes over changed data /// into FMainDS, which is different than the Partner Edit screen's FMainDS, in /// order to have current data on which decisions on whether to refresh certain /// parts of the 'Overview' need to be updated. /// </summary> /// <param name="APartnerAttributesOrRelationsChanged">NOT USED IN THIS CONTEXT! (Set to true by the SaveChanges Method /// of the Partner Edit screen if PartnerAttributes or Relationships have changed.)</param> public void RefreshPersonnelDataAfterMerge(bool APartnerAttributesOrRelationsChanged) { // // Need to merge Tables from PartnerEditTDS into IndividualDataTDS so the updated s_modification_id_t of modififed Rows is held correctly in IndividualDataTDS, too! // // ...but first empty relevant DataTables to ensure that DataRows that got deleted in FPartnerEditTDS are reflected in FMainDS (just performing a Merge wouldn't remove them!) if (FMainDS.Tables.Contains(PPartnerLocationTable.GetTableName())) { FMainDS.Tables[PPartnerLocationTable.GetTableName()].Rows.Clear(); } if (FMainDS.Tables.Contains(PLocationTable.GetTableName())) { FMainDS.Tables[PLocationTable.GetTableName()].Rows.Clear(); } if (FMainDS.Tables.Contains(PPartnerRelationshipTable.GetTableName())) { FMainDS.Tables[PPartnerRelationshipTable.GetTableName()].Rows.Clear(); } // Now perform the Merge operation FMainDS.Merge(FPartnerEditTDS); // Call AcceptChanges on IndividualDataTDS so that we don't have any changed data anymore (this is done to PartnerEditTDS, too, after this Method returns)! FMainDS.AcceptChanges(); }
/// <summary> /// Determines whether a PERSON has one or more 'Supporting Church' Relationship(s). /// </summary> /// <param name="ASupportingChurchesPartnerKeys">PartnerKeys of 'Supporting Churches'.</param> /// <returns>void</returns> private void DetermineChurchRelationships(out long[] ASupportingChurchesPartnerKeys) { DataRow[] SupportingChurches; // Initialise out Argument ASupportingChurchesPartnerKeys = new long[0]; SupportingChurches = FMainDS.Tables[PPartnerRelationshipTable.GetTableName()].Select( PPartnerRelationshipTable.GetRelationNameDBName() + "= 'SUPPCHURCH'"); if (SupportingChurches != null) { ASupportingChurchesPartnerKeys = new long[SupportingChurches.Length]; for (int Counter = 0; Counter < SupportingChurches.Length; Counter++) { ASupportingChurchesPartnerKeys[Counter] = (long)SupportingChurches[Counter][PPartnerRelationshipTable.GetPartnerKeyDBName()]; } } }
/// <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(); } }