Esempio n. 1
0
        /// <summary>
        /// format the shortname for a partner in a standardized way
        /// </summary>
        /// <param name="AName">surname of partner</param>
        /// <param name="ATitle">title</param>
        /// <param name="AFirstName">first name</param>
        /// <param name="AMiddleName">middle name</param>
        /// <returns>formatted shortname</returns>
        public static String DeterminePartnerShortName(String AName, String ATitle, String AFirstName, String AMiddleName)
        {
            String ShortName = "";

            try
            {
                if (AName.Trim().Length > 0)
                {
                    ShortName = AName.Trim();
                }

                if (AFirstName.Trim().Length > 0)
                {
                    ShortName = ShortName + ", " + AFirstName.Trim();
                }

                if (AMiddleName.Trim().Length > 0)
                {
                    ShortName = ShortName + ' ' + AMiddleName.Trim().Substring(0, 1);
                }

                if (ATitle.Trim().Length > 0)
                {
                    ShortName = ShortName + ", " + ATitle.Trim();
                }

                if (ShortName.Length == 0)
                {
                    ShortName = StrNoNameInfoAvailable;
                }
                else
                {
                    if (ShortName.Length > PPartnerTable.GetPartnerShortNameLength())
                    {
                        ShortName = ShortName.Substring(0, PPartnerTable.GetPartnerShortNameLength());
                    }
                }
            }
            catch (Exception Exp)
            {
                TLogging.Log("Exception occured in DeterminePartnerShortName (" + AName + "): " + Exp.ToString());
            }
            return(ShortName);
        }