Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="profileGuid"></param>
        /// <returns></returns>

        public User GetUser(Guid profileGuid)
        {
            try {
                var membUser = Membership.GetUser(profileGuid);

                if (membUser == null)
                {
                    return(null);
                }

                var theStaff = HrManager.StaticGetStaffByGuid(profileGuid);
                return(new User {
                    // ReSharper disable once PossibleNullReferenceException
                    UserGuid = (Guid)membUser.ProviderUserKey,
                    UserName = membUser.UserName,
                    FullName = theStaff?.Person?.FullName,
                    PhotoIdentity = theStaff?.Person?.PhotoIdentity,
                    EmailAdress = membUser.Email,
                    IsApproved = membUser.IsApproved && !membUser.IsLockedOut,
                    IsLockedOut = membUser.IsLockedOut,
                    IsOnline = membUser.IsOnline,
                    //UserSpace     =(UserSpace)Enum.Parse(typeof(UserSpace), GetSetting(ProfileSettings.UserSpace, membUser.UserName)),
                    UserSpaces = UserSpaces(membUser.UserName)
                });
            } catch (Exception ex) {
                DebugHelper.WriteException(ex);
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public byte[] GetUserPic(string userName)
        {
            try {
                var membUser = Membership.GetUser(userName);

                // ReSharper disable once PossibleNullReferenceException
                return(membUser == null ? null :
                       HrManager.StaticGetStaffByGuid((Guid)membUser.ProviderUserKey).Person.PhotoIdentity);
            } catch (Exception ex) {
                DebugHelper.WriteException(ex);
                return(null);
            }
        }