コード例 #1
0
        protected EmployeeWraper Init(EmployeeWraper result, UserInfo userInfo)
        {
            result.Id          = userInfo.ID;
            result.DisplayName = DisplayUserSettingsHelper.GetFullUserName(userInfo);
            if (!string.IsNullOrEmpty(userInfo.Title))
            {
                result.Title = userInfo.Title;
            }

            var userInfoLM = userInfo.LastModified.GetHashCode();

            if (HttpContext.Check("avatarSmall"))
            {
                result.AvatarSmall = UserPhotoManager.GetSmallPhotoURL(userInfo.ID, out var isdef) + (isdef ? "" : $"?_={userInfoLM}");
            }

            if (result.Id != Guid.Empty)
            {
                var profileUrl = CommonLinkUtility.GetUserProfile(userInfo, false);
                result.ProfileUrl = CommonLinkUtility.GetFullAbsolutePath(profileUrl);
            }

            return(result);
        }
コード例 #2
0
        public GroupWrapperFull(GroupInfo group, bool includeMembers, ApiContext context)
        {
            Id       = group.ID;
            Category = group.CategoryID;
            Parent   = group.Parent != null ? group.Parent.ID : Guid.Empty;
            Name     = group.Name;
            Manager  = EmployeeWraper.Get(CoreContext.UserManager.GetUsers(context.Tenant.TenantId, CoreContext.UserManager.GetDepartmentManager(context.Tenant.TenantId, group.ID)), context);

            if (includeMembers)
            {
                Members = new List <EmployeeWraper>(CoreContext.UserManager.GetUsersByGroup(context.Tenant, group.ID).Select(r => EmployeeWraper.Get(r, context)));
            }
        }