Beispiel #1
0
        /// <summary>
        /// Returns the Languages of a Person from Personnel. It excludes the MainLanguage.
        /// </summary>
        /// <remarks>The Language Codes are sorted by Language Level so that the Language
        /// with the best level comes first, then the other Languages in descending Language
        /// Level order.</remarks>
        /// <param name="APartnerKey">PartnerKey of the PERSON.</param>
        /// <param name="AMainLanguage">MainLanguage of the PERSON.</param>
        /// <param name="AReadTransaction">Open DB Transaction.</param>
        /// <returns>A String containing all the Language Codes from Personnel, excluding the
        /// MainLanguage. The Language Codes are separated with a '|' (pipe) character.</returns>
        private static String GetPersonLanguagesFromPersonnel(Int64 APartnerKey, string AMainLanguage, TDBTransaction AReadTransaction)
        {
            const string LANG_SEPARATOR      = "|";
            String       AdditionalLanguages = "";

            PmPersonLanguageTable PersonLangDT = PmPersonLanguageAccess.LoadViaPPerson(APartnerKey, AReadTransaction);

            if (PersonLangDT != null)
            {
                // We want the list of Languages sorted by Language Level so that the Language with the
                // best level comes first, then the other Languages in descending Language Level order.
                DataView PersonLangDV = new DataView(PersonLangDT, "",
                                                     PmPersonLanguageTable.GetLanguageLevelDBName() + " DESC", DataViewRowState.CurrentRows);

                for (int Counter = 0; Counter < PersonLangDV.Count; Counter++)
                {
                    PmPersonLanguageRow PersonLangDR = (PmPersonLanguageRow)PersonLangDV[Counter].Row;

                    if (PersonLangDR.LanguageCode != AMainLanguage)
                    {
                        AdditionalLanguages = AdditionalLanguages + PersonLangDR.LanguageCode + LANG_SEPARATOR;
                    }
                }

                if (AdditionalLanguages.Length > 0)
                {
                    AdditionalLanguages = AdditionalLanguages.Substring(0, AdditionalLanguages.Length - LANG_SEPARATOR.Length);
                }
            }

            return(AdditionalLanguages);
        }