Ejemplo n.º 1
0
        /// <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);

            // Record current 'Best Address' and it's Phone Number and Email Address of the PERSON
            if (FMainDS.Tables[PartnerEditTDSPPartnerLocationTable.GetTableName()] != null)
            {
                DetermineAddressComponents(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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Determines the 'Best Address' of the PERSON and its Phone Number and Email Address.
        /// </summary>
        /// <param name="APhoneNumberOfPerson">Phone Number of the PERSON in international format.</param>
        /// <param name="AEmailAddressOfPerson">Email Address of the PERSON.</param>
        /// <returns><see cref="Ict.Petra.Shared.MPartner.TLocationPK" /> pointing to the 'Best Address' of the PERSON.</returns>
        private TLocationPK DetermineAddressComponents(out string APhoneNumberOfPerson, out string AEmailAddressOfPerson)
        {
            TLocationPK ReturnValue = Ict.Petra.Shared.MPartner.Calculations.DetermineBestAddress(
                FMainDS.Tables[PartnerEditTDSPPartnerLocationTable.GetTableName()]);
            DataRow BestPartnerLocationDR;
            DataRow BestLocationDR;
            string  TelephoneNumber;
            string  Extension;
            string  CountryCode;

            // Initialise out Arguments
            APhoneNumberOfPerson  = null;
            AEmailAddressOfPerson = null;

            BestPartnerLocationDR = FMainDS.Tables[PartnerEditTDSPPartnerLocationTable.GetTableName()].Rows.Find(new object[]
                                                                                                                 { FMainDS.PPerson[0].PartnerKey, ReturnValue.SiteKey, ReturnValue.LocationKey });

            if (BestPartnerLocationDR != null)
            {
                BestLocationDR = FMainDS.Tables[PLocationTable.GetTableName()].Rows.Find(new object[]
                                                                                         { ReturnValue.SiteKey, ReturnValue.LocationKey });

                if (!BestPartnerLocationDR.IsNull(PPartnerLocationTable.GetTelephoneNumberDBName()))
                {
                    TelephoneNumber = (string)BestPartnerLocationDR[PPartnerLocationTable.GetTelephoneNumberDBName()];
                }
                else
                {
                    TelephoneNumber = String.Empty;
                }

                if (!BestPartnerLocationDR.IsNull(PPartnerLocationTable.GetExtensionDBName()))
                {
                    Extension = ((int)BestPartnerLocationDR[PPartnerLocationTable.GetExtensionDBName()]).ToString();
                }
                else
                {
                    Extension = String.Empty;
                }

                if (!BestLocationDR.IsNull(PLocationTable.GetCountryCodeDBName()))
                {
                    CountryCode = (string)BestLocationDR[PLocationTable.GetCountryCodeDBName()];
                }
                else
                {
                    CountryCode = String.Empty;
                }

                APhoneNumberOfPerson = Ict.Petra.Shared.MPartner.Calculations.FormatIntlPhoneNumber(
                    TelephoneNumber,
                    Extension,
                    CountryCode,
                    @TDataCache.GetCacheableDataTableFromCache);

                if (!BestPartnerLocationDR.IsNull(PPartnerLocationTable.GetEmailAddressDBName()))
                {
                    AEmailAddressOfPerson = (string)BestPartnerLocationDR[PPartnerLocationTable.GetEmailAddressDBName()];
                }
                else
                {
                    AEmailAddressOfPerson = String.Empty;
                }
            }
            else
            {
                MessageBox.Show("Unexpected condition: 'Best Address of PERSON is null'", DEV_FIX);
            }

            return(ReturnValue);
        }
Ejemplo n.º 3
0
        /// <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[PartnerEditTDSPPartnerLocationTable.GetTableName()] != null)
                {
                    // Check for change of 'Best Address' and it's Phone Number and Email Address
                    DetermineAddressComponents(out PhoneOfPerson, out EmailOfPerson);

                    if (PhoneOfPerson != null)
                    {
                        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();
            }
        }