Example #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);
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public byte[] GetUserPic(string userName)
        {
            //using (var db = new StationContext())
            //{
            //    if (db.Database.Exists())
            //    {
            //        db.Database.Delete();
            //        db.Database.Create();
            //    }
            //}

            var membUserGuid = (Guid)Membership.GetUser(userName)?.ProviderUserKey;

            return(HrManager.StaticGetStaffByGuid(membUserGuid)?.Person?.PhotoIdentity);
        }