private void FillConacts(EmployeeWraperFull employeeWraperFull, UserInfo userInfo)
        {
            if (userInfo.ContactsList == null)
            {
                return;
            }

            var contacts = new List <Contact>();

            for (var i = 0; i < userInfo.ContactsList.Count; i += 2)
            {
                if (i + 1 < userInfo.ContactsList.Count)
                {
                    contacts.Add(new Contact(userInfo.ContactsList[i], userInfo.ContactsList[i + 1]));
                }
            }

            if (contacts.Any())
            {
                employeeWraperFull.Contacts = contacts;
            }
        }
        public EmployeeWraperFull GetFull(UserInfo userInfo)
        {
            var result = new EmployeeWraperFull
            {
                UserName         = userInfo.UserName,
                FirstName        = userInfo.FirstName,
                LastName         = userInfo.LastName,
                Birthday         = ApiDateTime.FromDate(TenantManager, TimeZoneConverter, userInfo.BirthDate),
                Status           = userInfo.Status,
                ActivationStatus = userInfo.ActivationStatus & ~EmployeeActivationStatus.AutoGenerated,
                Terminated       = ApiDateTime.FromDate(TenantManager, TimeZoneConverter, userInfo.TerminatedDate),
                WorkFrom         = ApiDateTime.FromDate(TenantManager, TimeZoneConverter, userInfo.WorkFromDate),
                Email            = userInfo.Email,
                IsVisitor        = userInfo.IsVisitor(UserManager),
                IsAdmin          = userInfo.IsAdmin(UserManager),
                IsOwner          = userInfo.IsOwner(Context.Tenant),
                IsLDAP           = userInfo.IsLDAP(),
                IsSSO            = userInfo.IsSSO()
            };

            Init(result, userInfo);

            if (userInfo.Sex.HasValue)
            {
                result.Sex = userInfo.Sex.Value ? "male" : "female";
            }

            if (!string.IsNullOrEmpty(userInfo.Location))
            {
                result.Location = userInfo.Location;
            }

            if (!string.IsNullOrEmpty(userInfo.Notes))
            {
                result.Notes = userInfo.Notes;
            }

            if (!string.IsNullOrEmpty(userInfo.MobilePhone))
            {
                result.MobilePhone = userInfo.MobilePhone;
            }

            result.MobilePhoneActivationStatus = userInfo.MobilePhoneActivationStatus;

            if (!string.IsNullOrEmpty(userInfo.CultureName))
            {
                result.CultureName = userInfo.CultureName;
            }

            FillConacts(result, userInfo);

            if (Context.Check("groups") || Context.Check("department"))
            {
                var groups = UserManager.GetUserGroups(userInfo.ID)
                             .Select(x => new GroupWrapperSummary(x, UserManager))
                             .ToList();

                if (groups.Count > 0)
                {
                    result.Groups     = groups;
                    result.Department = string.Join(", ", result.Groups.Select(d => d.Name.HtmlEncode()));
                }
                else
                {
                    result.Department = "";
                }
            }

            var userInfoLM = userInfo.LastModified.GetHashCode();

            if (Context.Check("avatarMax"))
            {
                result.AvatarMax = UserPhotoManager.GetMaxPhotoURL(userInfo.ID, out var isdef) + (isdef ? "" : $"?_={userInfoLM}");
            }

            if (Context.Check("avatarMedium"))
            {
                result.AvatarMedium = UserPhotoManager.GetMediumPhotoURL(userInfo.ID, out var isdef) + (isdef ? "" : $"?_={userInfoLM}");
            }

            if (Context.Check("avatar"))
            {
                result.Avatar = UserPhotoManager.GetBigPhotoURL(userInfo.ID, out var isdef) + (isdef ? "" : $"?_={userInfoLM}");
            }

            if (Context.Check("listAdminModules"))
            {
                var listAdminModules = userInfo.GetListAdminModules(WebItemSecurity);

                if (listAdminModules.Any())
                {
                    result.ListAdminModules = listAdminModules;
                }
            }

            return(result);
        }