コード例 #1
0
        /// <summary>
        /// Получить ФИО в указанном падеже.
        /// </summary>
        /// <param name="declensionCase">Падеж.</param>
        /// <returns>ФИО в указанном падеже.</returns>
        public virtual Structures.Employee.PersonFullName GetFullNameInDeclension(Sungero.Core.DeclensionCase declensionCase)
        {
            var fullName = CommonLibrary.PersonFullName.Create(_obj.Person.LastName,
                                                               _obj.Person.FirstName,
                                                               _obj.Person.MiddleName);

            var gender = CommonLibrary.Gender.NotDefined;

            if (_obj.Person.Sex != null)
            {
                gender = _obj.Person.Sex == Sungero.Parties.Person.Sex.Female ?
                         CommonLibrary.Gender.Feminine :
                         CommonLibrary.Gender.Masculine;
            }

            // Для фамилий типа Ардо (Иванова) неправильно склоняется через API. Баг 32895.
            var fullNameInDeclension = CommonLibrary.Padeg.ConvertPersonFullNameToTargetDeclension(fullName,
                                                                                                   (CommonLibrary.DeclensionCase)(int) declensionCase,
                                                                                                   gender);

            var lastName   = fullNameInDeclension.LastName;
            var firstName  = fullNameInDeclension.FirstName;
            var middleName = string.IsNullOrWhiteSpace(_obj.Person.MiddleName) ? string.Empty : fullNameInDeclension.MiddleName;

            return(Structures.Employee.PersonFullName.Create(lastName, firstName, middleName));
        }
コード例 #2
0
        public static string GetJobTitle(IEmployee employee, Sungero.Core.DeclensionCase declensionCase)
        {
            if (employee == null)
            {
                return(string.Empty);
            }

            if (employee.JobTitle == null)
            {
                return(string.Empty);
            }

            return(CaseConverter.ConvertJobTitleToTargetDeclension(employee.JobTitle.Name,
                                                                   declensionCase));
        }
コード例 #3
0
        public virtual string GetShortName(Sungero.Core.DeclensionCase declensionCase, bool platformLogic)
        {
            var fullNameInDeclension = Functions.Employee.GetFullNameInDeclension(_obj, declensionCase);
            var lastName             = fullNameInDeclension.LastName;
            var firstName            = fullNameInDeclension.FirstName;
            var middleName           = fullNameInDeclension.MiddleName;

            // ФИО в формате "Фамилия И.О." или "Фамилия Имя". Аналогично платформенной логике построения краткого имени в переписке.
            if (platformLogic && string.IsNullOrEmpty(_obj.Person.MiddleName))
            {
                using (TenantInfo.Culture.SwitchTo())
                    return(Sungero.Parties.People.Resources.FullNameWithoutMiddleFormat(firstName, lastName));
            }

            return(Parties.PublicFunctions.Person.GetSurnameAndInitialsInTenantCulture(firstName, middleName, lastName));
        }
コード例 #4
0
        public virtual string GetFullName(Sungero.Core.DeclensionCase declensionCase)
        {
            var gender = CommonLibrary.Gender.NotDefined;

            if (_obj.Sex != null)
            {
                gender = _obj.Sex == Sungero.Parties.Person.Sex.Female ?
                         CommonLibrary.Gender.Feminine :
                         CommonLibrary.Gender.Masculine;
            }

            // Для фамилий типа Ардо (Иванова) неправильно склоняется через API. Баг 32895.
            var fullName             = CommonLibrary.PersonFullName.Create(_obj.LastName, _obj.FirstName, _obj.MiddleName);
            var fullNameInDeclension = CommonLibrary.Padeg.ConvertPersonFullNameToTargetDeclension(fullName,
                                                                                                   (CommonLibrary.DeclensionCase)(int) declensionCase,
                                                                                                   gender);

            var middleName = string.IsNullOrWhiteSpace(_obj.MiddleName) ? string.Empty : fullNameInDeclension.MiddleName;

            using (TenantInfo.Culture.SwitchTo())
                return(Sungero.Parties.People.Resources.FullNameFormat(fullNameInDeclension.FirstName, middleName, fullNameInDeclension.LastName, "\u00A0"));
        }