Exemple #1
0
        public static void ProcessProfilePhotoWithCrop(Member member, Image Original, Image Cropped)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName    = GlobalWebID + @".jpg";

            //create the medium
            ResourceFile PhotoResourceFile = new ResourceFile();

            PhotoResourceFile.WebResourceFileID = GlobalWebID;
            PhotoResourceFile.ResourceType      = (int)ResourceFileType.PhotoLarge;
            PhotoResourceFile.Path     = member.NickName + "/" + "pmed" + "/";
            PhotoResourceFile.FileName = FileName;
            PhotoResourceFile.Save();
            Photo.SaveToDisk(Original, PhotoResourceFile.SavePath);

            //create the thumbnail
            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
            ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.PhotoThumbnail;
            ThumbnailResourceFile.Path     = member.NickName + "/" + "pthmb" + "/";
            ThumbnailResourceFile.FileName = FileName;
            ThumbnailResourceFile.Save();
            Photo.SaveToDisk(Cropped, ThumbnailResourceFile.SavePath);

            member.DefaultPhoto = ThumbnailResourceFile;
            member.ProfilePhotoResourceFileID = ThumbnailResourceFile.ResourceFileID;

            member.Save();
        }
Exemple #2
0
        public void CreateCollection(String nickname, String password, String collectionName)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (String.IsNullOrEmpty(collectionName))
            {
                throw new ArgumentNullException("collectionName");
            }
            if (collectionName.Length > 50)
            {
                throw new ArgumentException(Resources.Argument_LongCollectionName);
            }

            var member          = Member.GetMemberViaNicknamePassword(nickname, password);
            var photoCollection = new PhotoCollection()
            {
                MemberID             = member.MemberID,
                WebPhotoCollectionID = UniqueID.NewWebID(),
                Name = collectionName
            };

            photoCollection.Save();
        }
Exemple #3
0
        /// <summary>
        /// </summary>
        /// <param name="member"></param>
        /// <param name="image"></param>
        public static void ProcessProfilePhoto(Member member, Image image)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName    = GlobalWebID + @".jpg";

            //create the medium
            ResourceFile PhotoResourceFile = new ResourceFile();

            PhotoResourceFile.WebResourceFileID = GlobalWebID;
            PhotoResourceFile.ResourceType      = (int)ResourceFileType.PhotoLarge;
            PhotoResourceFile.Path     = member.NickName + "/" + "pmed" + "/";
            PhotoResourceFile.FileName = FileName;
            PhotoResourceFile.Save();
            System.Drawing.Image MediumImage = Photo.Resize480x480(image);
            Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath);

            //create the thumbnail
            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
            ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.PhotoThumbnail;
            ThumbnailResourceFile.Path     = member.NickName + "/" + "pthmb" + "/";
            ThumbnailResourceFile.FileName = FileName;
            ThumbnailResourceFile.Save();
            System.Drawing.Image ThumbnailImage = Photo.ResizeTo102x102(MediumImage);
            Photo.SaveToDisk(ThumbnailImage, ThumbnailResourceFile.SavePath);

            member.DefaultPhoto = ThumbnailResourceFile;
            member.ProfilePhotoResourceFileID = ThumbnailResourceFile.ResourceFileID;

            member.Save();
        }
Exemple #4
0
 public void Copy(int MemberID)
 {
     this.MemberID       = MemberID;
     this.WebMP3UploadID = UniqueID.NewWebID();
     this.Mp3UploadID    = 0;// set this to zero to perform an insert
     this.Save();
 }
Exemple #5
0
        public void SaveWithFriendRequest()
        {
            db = DatabaseFactory.CreateDatabase();

            DbCommand dbCommand = db.GetStoredProcCommand("HG_SaveWithFriendRequest");

            db.AddInParameter(dbCommand, "FriendTagID", DbType.Int32, FriendTagID);
            db.AddInParameter(dbCommand, "FirstMemberID", DbType.Int32, FirstMemberID);
            db.AddInParameter(dbCommand, "TagValidationString", DbType.String, TagValidationString);
            db.AddInParameter(dbCommand, "TaggedDT", DbType.DateTime, TaggedDT);
            db.AddInParameter(dbCommand, "SecondMemberID", DbType.Int32, SecondMemberID);
            db.AddInParameter(dbCommand, "CreatedDT", DbType.DateTime, CreatedDT);
            db.AddInParameter(dbCommand, "WebFriendRequestID1", DbType.String, UniqueID.NewWebID());
            db.AddInParameter(dbCommand, "WebFriendRequestID2", DbType.String, UniqueID.NewWebID());

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                if (dr.Read())
                {
                    int ID = Int32.Parse(dr[0].ToString());
                    //if the ID is NOT zero then the query was an insert
                    if (ID != 0)
                    {
                        this.FriendTagID = ID;
                    }
                }

                dr.Close();
            }
        }
Exemple #6
0
        private static data.Comment CreateComment(WebComment comment, Member member)
        {
            var inReplyToCommentID = comment.InReplyToCommentID;
            var inReplyToComment   = inReplyToCommentID == 0 ? null : data.Comment.GetComment(inReplyToCommentID);

            var result = new data.Comment()
            {
                ObjectID       = comment.ObjectID,
                MemberIDFrom   = member.MemberID,
                Text           = HttpUtility.HtmlEncode(comment.Text),
                DTCreated      = DateTime.Now,
                IsDeleted      = false,
                CommentType    = comment.CommentType,
                WebCommentID   = UniqueID.NewWebID(),
                Path           = inReplyToComment == null ? "/" : String.Format("/{0}/", inReplyToComment.InReplyToCommentID),
                SentFromMobile = 1
            };

            result.Save();

            result.ThreadNo           = inReplyToComment == null ? result.CommentID : inReplyToComment.ThreadNo;
            result.InReplyToCommentID = inReplyToCommentID == 0 ? result.CommentID : inReplyToCommentID;
            result.Save();

            try
            {
                IncrementCommentCount((CommentType)comment.CommentType, comment.ObjectID);
            }
            catch { }

            return(result);
        }
Exemple #7
0
        public static void ProcessProfilePhoto(Int32 memberId, String nickname, Image image)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }

            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            var webId    = UniqueID.NewWebID();
            var fileName = String.Concat(webId, @".jpg");

            /* Create medium image. */
            var photoResourceFile = new ResourceFile()
            {
                WebResourceFileID = webId,
                ResourceType      = (int)ResourceFileType.PhotoLarge,
                Path     = String.Concat(nickname, "/pmed/"),
                FileName = fileName
            };

            photoResourceFile.Save();

            var mediumImage = Photo.Resize480x480(image);

            Photo.SaveToDisk(mediumImage, photoResourceFile.SavePath);

            /* Create thumbnail. */
            var thumbnailResourceFile = new ResourceFile()
            {
                WebResourceFileID = webId,
                ResourceType      = (int)ResourceFileType.PhotoThumbnail,
                Path     = String.Concat(nickname, "/pthmb/"),
                FileName = fileName
            };

            thumbnailResourceFile.Save();

            var thumbnailImage = Photo.ResizeTo102x102(mediumImage);

            Photo.SaveToDisk(thumbnailImage, thumbnailResourceFile.SavePath);

            Member.UpdateProfilePhotoResourceFileId(memberId, thumbnailResourceFile.ResourceFileID);

            mediumImage.Dispose();
            thumbnailImage.Dispose();
        }
Exemple #8
0
        public static void ProcessAAFPhoto(Member member, AskAFriend AAF, Image image, int IndexOrder)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName    = GlobalWebID + @".jpg";

            AskAFriendPhoto photo = new AskAFriendPhoto();

            photo.AskAFriendID = AAF.AskAFriendID;
            photo.IndexOrder   = IndexOrder;

            //create the medium
            ResourceFile PhotoResourceFile = new ResourceFile();

            PhotoResourceFile.WebResourceFileID = GlobalWebID;
            PhotoResourceFile.ResourceType      = (int)ResourceFileType.AAFLarge;
            PhotoResourceFile.Path     = member.NickName + "/" + "aaflrge" + "/";
            PhotoResourceFile.FileName = FileName;
            PhotoResourceFile.Save();
            System.Drawing.Image MediumImage = Photo.Resize480x480(image);
            Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath);

            photo.PhotoResourceFileID = PhotoResourceFile.ResourceFileID;

            //create the thumbnail
            ResourceFile ThumbnailPhoto = new ResourceFile();

            ThumbnailPhoto.WebResourceFileID = GlobalWebID;
            ThumbnailPhoto.ResourceType      = (int)ResourceFileType.AAFThumbnail;
            ThumbnailPhoto.Path     = member.NickName + "/" + "aafthmb" + "/";
            ThumbnailPhoto.FileName = FileName;
            ThumbnailPhoto.Save();
            System.Drawing.Image ThumbnailImage = Photo.ResizeTo124x91(MediumImage);
            Photo.SaveToDisk(ThumbnailImage, ThumbnailPhoto.SavePath);

            photo.Save();

            if (IndexOrder == 1)
            {
                AAF.DefaultPhotoResourceFileID = ThumbnailPhoto.ResourceFileID;
            }

            AAF.Save();
        }
Exemple #9
0
        public static string ProcessMemberPhoto(Member member, int PhotoCollectionID, Image image, DateTime TakenDT, bool SnappedFromMobile)
        {
            string GlobalWebID = UniqueID.NewWebID();
            string FileName    = GlobalWebID + @".jpg";

            Bitmap bmp = (Bitmap)image;

            try
            {
                EXIFextractor exif = new EXIFextractor(ref bmp, string.Empty);

                if (exif.DTTaken.Year != 1900)
                {
                    TakenDT = exif.DTTaken;
                }
            }
            catch { }


            Photo photo = new Photo();

            photo.Active            = true;
            photo.Mobile            = SnappedFromMobile;
            photo.MemberID          = member.MemberID;
            photo.WebPhotoID        = GlobalWebID;
            photo.PhotoCollectionID = PhotoCollectionID;
            photo.TakenDT           = TakenDT;
            photo.CreatedDT         = DateTime.Now;

            // create the large photo
            // just store the large image.. dont make a resource record
            System.Drawing.Image MainImage = Photo.ResizeTo800x600(image);
            string Savepath = member.NickName + @"\" + "plrge" + @"\" + FileName;

            Photo.SaveToDiskNoCompression(MainImage, Savepath);

            //create the medium
            photo.PhotoResourceFile = new ResourceFile();
            photo.PhotoResourceFile.WebResourceFileID = GlobalWebID;
            photo.PhotoResourceFile.ResourceType      = (int)ResourceFileType.PhotoLarge;
            photo.PhotoResourceFile.Path     = member.NickName + "/" + "pmed" + "/";
            photo.PhotoResourceFile.FileName = FileName;
            photo.PhotoResourceFile.Save();
            System.Drawing.Image MediumImage = Photo.Resize480x480(MainImage);
            Photo.SaveToDisk(MediumImage, photo.PhotoResourceFile.SavePath);

            //create the thumbnail
            photo.ThumbnailResourceFile = new ResourceFile();
            photo.ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
            photo.ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.PhotoThumbnail;
            photo.ThumbnailResourceFile.Path     = member.NickName + "/" + "pthmb" + "/";
            photo.ThumbnailResourceFile.FileName = FileName;
            photo.ThumbnailResourceFile.Save();


            System.Drawing.Image ThumbnailImage = Photo.ScaledCropTo121x91(MediumImage);


            Photo.SaveToDisk(ThumbnailImage, photo.ThumbnailResourceFile.SavePath);

            // attached the resource ids to the photos
            photo.ThumbnailResourceFileID = photo.ThumbnailResourceFile.ResourceFileID;
            photo.PhotoResourceFileID     = photo.PhotoResourceFile.ResourceFileID;

            photo.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfPhotos++;
            memberProfile.Save();

            return(photo.WebPhotoID);
        }
Exemple #10
0
        public static NSpot ProcessNSpotPhoto(Member member, NSpot nSpot, Image image)
        {
            Database      db          = DatabaseFactory.CreateDatabase();
            DbConnection  conn        = db.CreateConnection();
            DbTransaction Transaction = null;

            try
            {
                conn.Open();
                Transaction = conn.BeginTransaction();

                string GlobalWebID = UniqueID.NewWebID();
                string FileName    = GlobalWebID + @".jpg";

                // create the large photo
                // just store the large image.. dont make a resource record
                System.Drawing.Image MainImage = Photo.Resize480x480(image);
                string Savepath = member.NickName + @"\" + "nslrge" + @"\" + FileName;
                Photo.SaveToDisk(MainImage, Savepath);

                //create the medium
                ResourceFile PhotoResourceFile = new ResourceFile();
                PhotoResourceFile.CreatedDT         = DateTime.Now;
                PhotoResourceFile.WebResourceFileID = GlobalWebID;
                PhotoResourceFile.ResourceType      = (int)ResourceFileType.NspotPhoto;
                PhotoResourceFile.Path     = member.NickName + "/" + "nsmed" + "/";
                PhotoResourceFile.FileName = FileName;
                PhotoResourceFile.Save(db);
                System.Drawing.Image MediumImage = Photo.Resize190x130(MainImage);
                Photo.SaveToDisk(MediumImage, PhotoResourceFile.SavePath);

                //create the thumbnail
                ResourceFile ThumbnailResourceFile = new ResourceFile();
                ThumbnailResourceFile.CreatedDT         = DateTime.Now;
                ThumbnailResourceFile.WebResourceFileID = GlobalWebID;
                ThumbnailResourceFile.ResourceType      = (int)ResourceFileType.NspotThumbnail;
                ThumbnailResourceFile.Path     = member.NickName + "/" + "nsthmb" + "/";
                ThumbnailResourceFile.FileName = FileName;
                ThumbnailResourceFile.Save(db);
                System.Drawing.Image ThumbnailImage = Photo.ResizeTo124x91(MediumImage);
                Photo.SaveToDisk(ThumbnailImage, ThumbnailResourceFile.SavePath);

                // attached the resource ids to the photos
                nSpot.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
                nSpot.PhotoResourceFileID     = PhotoResourceFile.ResourceFileID;

                nSpot.Save(db);

                Transaction.Commit();
            }
            catch (Exception ex)
            {
                Transaction.Rollback();
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return(nSpot);
        }
Exemple #11
0
        // <summary>
        /// Lawrence: This method appears to be obselete and was used as an interim solution for video encoder...
        /// </summary>
        /// <returns></returns>
        public static void ProxyProcessVideo(Stream FLVStream, Member member, string UNCPathToUserDirectory, string VideoTitle)
        {
            if (VideoTitle.Length > 35)
            {
                VideoTitle = VideoTitle.Substring(0, 35);
            }

            string VideoFileName = UniqueID.NewWebID() + ".flv";

            string SavePath = UNCPathToUserDirectory + member.NickName + @"\video\" + VideoFileName;

            int Length = 256;

            Byte[] buffer    = new Byte[256];
            int    bytesRead = FLVStream.Read(buffer, 0, Length);

            FileStream fs = new FileStream(SavePath, FileMode.Create);

            // write the required bytes
            while (bytesRead > 0)
            {
                fs.Write(buffer, 0, bytesRead);
                bytesRead = FLVStream.Read(buffer, 0, Length);
            }

            FLVStream.Close();

            fs.Flush();
            fs.Close();

            ResourceFile VideoResourceFile = new ResourceFile();

            VideoResourceFile.WebResourceFileID = UniqueID.NewWebID();
            VideoResourceFile.FileName          = VideoFileName;
            VideoResourceFile.Path         = @"/" + member.NickName + @"/video/";
            VideoResourceFile.ResourceType = (int)ResourceFileType.Video;
            VideoResourceFile.Save();


            Process FFMpegProcess;

            FFMpegProcess = new System.Diagnostics.Process();

            string ThumbnailName     = UniqueID.NewWebID();
            string ThumbnailSavePath = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\vthmb\";

            if (ThumbnailName.Length > 21)
            {
                ThumbnailName = ThumbnailName.Substring(0, 20);
            }

            string FullSavePath = ThumbnailSavePath + ThumbnailName;
            string arg          = "-i " + SavePath + " -an -ss 00:00:07 -t 00:00:01 -r 1 -y -s 160x120 " + FullSavePath + "%d.jpg";
            string cmd          = @"c:\ffmpeg.exe";

            FFMpegProcess = System.Diagnostics.Process.Start(cmd, arg);
            FFMpegProcess.WaitForExit();
            FFMpegProcess.Close();


            //ffmpeg must add a 1 to the end of the file
            ThumbnailName += "1.jpg";

            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID();
            ThumbnailResourceFile.FileName          = ThumbnailName;
            ThumbnailResourceFile.Path         = member.NickName + @"/vthmb/";
            ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail;
            ThumbnailResourceFile.Save();

            Video video = new Video();

            video.MemberID                = member.MemberID;
            video.WebVideoID              = UniqueID.NewWebID();
            video.Title                   = VideoTitle;
            video.Description             = "No Description";
            video.DTCreated               = DateTime.Now;
            video.VideoResourceFileID     = VideoResourceFile.ResourceFileID;
            video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
            video.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfVideos++;
            memberProfile.Save();
        }
Exemple #12
0
        /// <summary>
        /// Saves the video file to disk
        /// </summary>
        /// <returns></returns>
        public static void QueueVideoForEncoding(Video video, Stream FLVStream, string Extension, Member member, string VideoTitle)
        {
            if (VideoTitle.Length > 35)
            {
                VideoTitle = VideoTitle.Substring(0, 35);
            }

            string VideoFileName = UniqueID.NewWebID();
            string VideoPreprocessedInputFile = OSRegistry.GetDiskUserDirectory() + member.NickName + @"\video\" + VideoFileName + "." + Extension;

            string VideoInputFile  = member.NickName + @"\video\" + VideoFileName + "." + Extension;
            string VideoOutputFile = member.NickName + @"\video\" + VideoFileName + ".flv";

            int Length = 256;

            Byte[] buffer    = new Byte[256];
            int    bytesRead = FLVStream.Read(buffer, 0, Length);

            FileStream fs = new FileStream(VideoPreprocessedInputFile, FileMode.Create);

            // write the required bytes
            while (bytesRead > 0)
            {
                fs.Write(buffer, 0, bytesRead);
                bytesRead = FLVStream.Read(buffer, 0, Length);
            }

            FLVStream.Close();

            fs.Flush();
            fs.Close();

            ResourceFile VideoResourceFile = new ResourceFile();

            VideoResourceFile.WebResourceFileID = UniqueID.NewWebID();
            VideoResourceFile.FileName          = VideoFileName + ".flv";
            VideoResourceFile.Path         = @"/" + member.NickName + @"/video/";
            VideoResourceFile.ResourceType = (int)ResourceFileType.Video;
            VideoResourceFile.Save();

            string ThumbnailName     = UniqueID.NewWebID() + ".jpg";
            string ThumbnailSavePath = member.NickName + @"\vthmb\" + ThumbnailName;

            ResourceFile ThumbnailResourceFile = new ResourceFile();

            ThumbnailResourceFile.WebResourceFileID = UniqueID.NewWebID();
            ThumbnailResourceFile.FileName          = ThumbnailName;
            ThumbnailResourceFile.Path         = member.NickName + @"/vthmb/";
            ThumbnailResourceFile.ResourceType = (int)ResourceFileType.VideoThumbnail;
            ThumbnailResourceFile.Save();


            video.MemberID                = member.MemberID;
            video.WebVideoID              = UniqueID.NewWebID();
            video.Category                = 1;
            video.DTCreated               = DateTime.Now;
            video.VideoResourceFileID     = VideoResourceFile.ResourceFileID;
            video.ThumbnailResourceFileID = ThumbnailResourceFile.ResourceFileID;
            video.Status = (int)VideoStatus.EncoderQueue;
            video.Save();

            // update the number of photos
            MemberProfile memberProfile = member.MemberProfile[0];

            memberProfile.NumberOfVideos++;
            memberProfile.Save();

            VideoEncoderQueue VideoEncode = new VideoEncoderQueue();

            VideoEncode.VideoID             = video.VideoID;
            VideoEncode.VideoInputFile      = VideoInputFile;
            VideoEncode.VideoOutputFile     = VideoOutputFile;
            VideoEncode.ThumbnailOutputFile = ThumbnailSavePath;
            VideoEncode.Status = (int)VideoEncoderStatus.Ready;
            VideoEncode.Save();
        }
Exemple #13
0
        public Int32 CreateUser(String emailAddress, String nickname, String password, Int32 gender /* 0 - Girl, 1 - Boy, 2 - Not saying */)
        {
            if (String.IsNullOrEmpty(emailAddress) ||
                !RegexPatterns.TestEmailRegex(emailAddress))
            {
                return(-1); // emailAddress is not valid.
            }
            if (!Member.IsEmailAddressAvailable(emailAddress))
            {
                return(-2); // emailAddress already registered.
            }
            if (String.IsNullOrEmpty(nickname) ||
                !RegexPatterns.TestNickname(nickname))
            {
                return(-3); // nickname invalid.
            }
            if (!Member.IsNicknameAvailable(nickname))
            {
                return(-4); // nickname already registered.
            }
            if (String.IsNullOrEmpty(password) ||
                !RegexPatterns.TestPassword(password))
            {
                return(-5); // password minimum length is 7 characters.
            }
            if (gender < 0 || gender > 2)
            {
                return(-6); // gender should be 0 - Girl, 1 - Boy, 2 - Not saying.
            }
            var member = new Member()
            {
                AccountType = 0, /* Default */
                Email       = emailAddress,
                NickName    = nickname,
                FirstName   = nickname,
                Password    = password,
                Gender      = gender,
                ISOCountry  = "UNS",            /* Unspecified */
                ProfilePhotoResourceFileID = 1, /* Default */
                WebMemberID = UniqueID.NewWebID(),
                CreatedDT   = DateTime.Now
            };

            try
            {
                member.Save();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return(-7);
            }

            try
            {
                MemberSetUp(member);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                return(-8);
            }

            return(0);
        }
Exemple #14
0
        private static void MemberSetUp(Member member)
        {
            CreateUserDirectories(member);

            var defaultGallery = new PhotoCollection()
            {
                WebPhotoCollectionID = UniqueID.NewWebID(),
                MemberID             = member.MemberID,
                DTCreated            = DateTime.Now,
                Name        = member.NickName + "'s Gallery",
                Description = "My First Gallery!"
            };

            defaultGallery.Save();

            string StatusText = "New to next2Friends!";

            /* Create a new member profile for the member. */
            var profile = new MemberProfile()
            {
                MemberID                 = member.MemberID,
                DTLastUpdated            = DateTime.Now,
                DefaultPhotoCollectionID = defaultGallery.PhotoCollectionID,
                TagLine = StatusText
            };

            profile.Save();

            MemberStatusText.UpdateStatusText(member.MemberID, StatusText);

            var message = new Message()
            {
                Body         = "Welcome to Next2Friends",
                WebMessageID = UniqueID.NewWebID(),
                MemberIDFrom = 31,
                MemberIDTo   = member.MemberID,
                DTCreated    = DateTime.Now
            };

            message.Save();
            message.InReplyToID = message.MessageID;
            message.Save();

            /* Create the default settings for the member. */
            var settings = new MemberSettings()
            {
                NotifyNewPhotoComment   = true,
                NotifyNewProfileComment = true,
                NotifyNewVideoComment   = true,
                NotifyOnAAFComment      = true,
                NotifyOnFriendRequest   = true,
                NotifyOnNewMessage      = true,
                NotifyOnNewsLetter      = true,
                NotifyOnSubscriberEvent = true,
                MemberID = member.MemberID
            };

            settings.Save();

            var matchProfile = new MatchProfile()
            {
                MemberID = member.MemberID
            };

            matchProfile.Save();

            var device = new Device()
            {
                MemberID             = member.MemberID,
                PrivateEncryptionKey = UniqueID.NewEncryptionKey(),
                CreatedDT            = DateTime.Now,
                DeviceTagID          = Guid.NewGuid().ToString()
            };

            device.Save();

            // Lawrence: Added block to register default friends and profile views
            try
            {
                // Add Lawrence as Auto Friend
                Friend.AddFriend(1, member.MemberID);
                // Add Anthony as Auto Friend
                Friend.AddFriend(3, member.MemberID);
                // Add Hans as Auto Friend
                Friend.AddFriend(24, member.MemberID);
                // Add Becca as Auto Friend
                Friend.AddFriend(30, member.MemberID);

                ContentViewed(new Member(1), member.MemberID, CommentType.Member);
                ContentViewed(new Member(3), member.MemberID, CommentType.Member);
                ContentViewed(new Member(24), member.MemberID, CommentType.Member);
                ContentViewed(new Member(30), member.MemberID, CommentType.Member);
            }
            catch { }

            SetOnlineNow(member.MemberID);
        }