Example #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <returns></returns>
        public String DetermineCurrentEmailAddress()
        {
            DataRow CurrentDR = this.CurrentDataRow;
            String  EmailAddress;

            if (CurrentDR != null)
            {
                // get Email Address of current DataRow
                EmailAddress = Convert.ToString(CurrentDR[PPartnerLocationTable.GetEmailAddressDBName()]);
            }
            else
            {
                EmailAddress = "";
            }

            // MessageBox.Show(EmailAddress.ToString);
            return(EmailAddress);
        }
Example #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);
        }