Ejemplo n.º 1
0
        private static void UploadPhoto(Member member, String photoCollectionID, String base64StringPhoto, String dateTime)
        {
            var byteImage = Convert.FromBase64String(base64StringPhoto);
            var longDateTime = Int64.Parse(dateTime);
            var takenDT = new DateTime(longDateTime);

            try
            {
                var img = data.Photo.ByteArrayToImage(byteImage);
            }
            catch
            {
                //throw new ArgumentException(Resources.Argument_InvalidBase64PhotoString);
            }


            var photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(photoCollectionID);

            if (photoCollection == null)
            {
                photoCollection = new PhotoCollection()
                {
                    DTCreated = DateTime.Now,
                    //Description = Resources.SnapUp_DefaultGalleryDescrpiption,
                    MemberID = member.MemberID,
                    //Name = Resources.SnapUp_DefaultGalleryName
                };
                photoCollection.Save();
            }

            data.Photo.ProcessMemberPhoto(member, photoCollection.PhotoCollectionID, byteImage, takenDT);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of PhotoCollections
        /// </summary>
        public static List<PhotoCollection> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<PhotoCollection> arr = new List<PhotoCollection>();

            PhotoCollection obj;

            while (dr.Read())
            {
                obj = new PhotoCollection();
                if (list.IsColumnPresent("PhotoCollectionID")) { obj._photoCollectionID = (int)dr["PhotoCollectionID"]; }
                if (list.IsColumnPresent("WebPhotoCollectionID")) { obj._webPhotoCollectionID = (string)dr["WebPhotoCollectionID"]; }
                if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("Name")) { obj._name = (string)dr["Name"]; }
                if (list.IsColumnPresent("Description")) { obj._description = (string)dr["Description"]; }
                if (list.IsColumnPresent("DTCreated")) { obj._dTCreated = (DateTime)dr["DTCreated"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of PhotoCollections
        /// </summary>
        public static List<PhotoCollection> PopulatePhotoCollectionWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

            List<PhotoCollection> arr = new List<PhotoCollection>();

            PhotoCollection obj;

            while (dr.Read())
            {
                obj = new PhotoCollection();
                obj._photoCollectionID = (int)dr["PhotoCollectionID"];
                obj._webPhotoCollectionID = (string)dr["WebPhotoCollectionID"];
                obj._memberID = (int)dr["MemberID"];
                obj._name = (string)dr["Name"];
                obj._description = (string)dr["Description"];
                obj._dTCreated = (DateTime)dr["DTCreated"];

                if (list.IsColumnPresent("NumberOfPhotos")) { obj.NumberOfPhotos = (int)dr["NumberOfPhotos"]; }
                if (list.IsColumnPresent("DefaultThumbnailURL")) { obj.DefaultThumbnailURL = (string)dr["DefaultThumbnailURL"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
Ejemplo n.º 6
0
                /// <summary>
        /// Gets all the PhotoComment in the database for the member
        /// </summary>
        public static PhotoCollection GetOrCreatePhotoGalleryForToday(int MemberID)
        {
            List<PhotoCollection> photoCollections = PhotoCollection.GetPhotoGalleryForToday(MemberID);

            PhotoCollection photoCollection = null;

            bool CreateGallery = true;

            if (photoCollections.Count > 0)
            {
                photoCollection = photoCollections[0];

                if (photoCollection.DTCreated.Date == DateTime.Now.Date)
                {
                    CreateGallery = false;
                }
            }

            if (CreateGallery)
            {
                photoCollection = new PhotoCollection()
                {
                    MemberID = MemberID,
                    WebPhotoCollectionID = Next2Friends.Misc.UniqueID.NewWebID(),
                    Name = DateTime.Now.Date.ToLongDateString(),
                    DTCreated = DateTime.Now
                };

                photoCollection.Save();

            }

            return photoCollection;
        }
Ejemplo n.º 7
0
        public static string NSpotXMLGallery(int NSpotID)
        {
            List <PhotoCollection> collections = new List <PhotoCollection>();

            List <Photo> DynamicPhotos = Photo.GetNSpotPhotosByNSpotID(NSpotID);

            PhotoCollection NewCollection    = new PhotoCollection();
            int             MemberID         = -1;
            int             MemberPhotoCount = 0;

            for (int i = 0; i < DynamicPhotos.Count; i++)
            {
                if (DynamicPhotos[i].MemberID != MemberID)
                {
                    NewCollection      = new PhotoCollection();
                    NewCollection.Name = DynamicPhotos[i].Member.NickName;
                    MemberID           = DynamicPhotos[i].MemberID;
                    MemberPhotoCount   = 0;
                }

                MemberPhotoCount++;

                NewCollection.Photo.Add(DynamicPhotos[i]);

                // if the next photo is a differnt member of this is the last loop then add
                if (i == (DynamicPhotos.Count - 1))
                {
                    NewCollection.Description = "Photos " + MemberPhotoCount.ToString();
                    collections.Add(NewCollection);
                }
                else if (DynamicPhotos[i + 1].MemberID != MemberID)
                {
                    NewCollection.Description = "Photos " + MemberPhotoCount.ToString();
                    collections.Add(NewCollection);
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
            sb.Append(@"<gallery>");

            for (int i = 0; i < collections.Count; i++)
            {
                List <Photo> photos = collections[i].Photo;

                if (photos.Count > 0)
                {
                    string NickName = photos[0].Member.NickName;

                    string ThumbPath = "user/" + NickName + "/" + "pthmb/";
                    string LargePath = "user/" + NickName + "/" + "plrge/";

                    object[] AlbumParameters = new object[6];
                    AlbumParameters[0] = collections[i].WebPhotoCollectionID;
                    AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL;
                    AlbumParameters[2] = LargePath;
                    AlbumParameters[3] = ThumbPath;
                    AlbumParameters[4] = collections[i].Name;
                    AlbumParameters[5] = collections[i].Description;
                    //AlbumParameters[6] = collections[i].Description;

                    //gallery title
                    sb.AppendFormat(@"  <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters);

                    for (int j = 0; j < photos.Count; j++)
                    {
                        object[] PhotoParameters = new object[2];
                        PhotoParameters[0] = photos[j].PhotoResourceFile.FileName;
                        PhotoParameters[1] = string.Empty;

                        sb.AppendFormat(@"      <img src=""{0}"" caption=""{1}"" />", PhotoParameters);
                    }

                    sb.Append(@"    </album>");
                }
            }

            sb.Append(@"</gallery>");

            return(sb.ToString());
        }
Ejemplo n.º 8
0
        private void UploadPhoto(Member member, String photoCollectionID, String base64StringPhoto, String dateTime, Boolean SnappedFromMobile)
        {
            var byteImage = Convert.FromBase64String(base64StringPhoto);
            var longDateTime = Int64.Parse(dateTime);
            var takenDT = new DateTime(longDateTime);

            Image img = null;

            try
            {
                img = data.Photo.ByteArrayToImage(byteImage);
            }
            catch
            {
                throw new ArgumentException(Resources.Argument_InvalidBase64PhotoString);
            }

            var photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(photoCollectionID);

            if (photoCollection == null)
            {
                photoCollection = new PhotoCollection()
                {
                    DTCreated = DateTime.Now,
                    Description = Resources.SnapUp_DefaultGalleryDescrpiption,
                    MemberID = member.MemberID,
                    Name = Resources.SnapUp_DefaultGalleryName
                };
                photoCollection.Save();
            }

            if (member.ProfilePhotoResourceFileID == 1 && !data.Photo.MemberHasAnyPhotos(member.MemberID))
                data.Photo.ProcessProfilePhoto(member, img);

            data.Photo.ProcessMemberPhoto(member, photoCollection.PhotoCollectionID, byteImage, takenDT, SnappedFromMobile);
            NotifyPhotoUploaded(member, photoCollection);
        }
Ejemplo n.º 9
0
 private void NotifyPhotoUploaded(Member member, PhotoCollection photoCollection)
 {
     System.Diagnostics.Debug.Assert(member != null, "member != null");
     var memberAccount = MemberAccount.GetMemberAccountByMemberID(member.MemberID);
     if (MemberAccount.IsTwitterReady(memberAccount))
     {
         if (TwitterService.CanPost(MemberAccountActivity.GetLastActivity(member.MemberID, 1 /* Twitter */, 2 /* PhotoGallery */)))
         {
             TwitterService.NotifyPhotoUploaded(memberAccount.Username, memberAccount.Password, member.WebMemberID, photoCollection.WebPhotoCollectionID);
             MemberAccountActivity.SetLastActivity(member.MemberID, 1 /* Twitter */, 2 /* PhotoGallery */);
         }
     }
 }
Ejemplo n.º 10
0
        public static string NSpotXMLGallery(int NSpotID)
        {
            List<PhotoCollection> collections = new List<PhotoCollection>();

            List<Photo> DynamicPhotos = Photo.GetNSpotPhotosByNSpotID(NSpotID);

            PhotoCollection NewCollection = new PhotoCollection();
            int MemberID = -1;
            int MemberPhotoCount = 0;

            for (int i = 0; i < DynamicPhotos.Count; i++)
            {
                if (DynamicPhotos[i].MemberID != MemberID)
                {
                    NewCollection = new PhotoCollection();
                    NewCollection.Name = DynamicPhotos[i].Member.NickName;
                    MemberID = DynamicPhotos[i].MemberID;
                    MemberPhotoCount = 0;
                }

                MemberPhotoCount++;

                NewCollection.Photo.Add(DynamicPhotos[i]);

                // if the next photo is a differnt member of this is the last loop then add
                if (i == (DynamicPhotos.Count - 1))
                {
                    NewCollection.Description = "Photos " + MemberPhotoCount.ToString();
                    collections.Add(NewCollection);
                }
                else if (DynamicPhotos[i + 1].MemberID != MemberID)
                {
                    NewCollection.Description = "Photos " + MemberPhotoCount.ToString();
                    collections.Add(NewCollection);
                }
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(@"<?xml version=""1.0"" encoding=""UTF-8""?>");
            sb.Append(@"<gallery>");

            for (int i = 0; i < collections.Count; i++)
            {
                List<Photo> photos = collections[i].Photo;

                if (photos.Count > 0)
                {
                    string NickName = photos[0].Member.NickName;

                    string ThumbPath = "user/" + NickName + "/" + "pthmb/";
                    string LargePath = "user/" + NickName + "/" + "plrge/";

                    object[] AlbumParameters = new object[6];
                    AlbumParameters[0] = collections[i].WebPhotoCollectionID;
                    AlbumParameters[1] = ParallelServer.Get(photos[0].ThumbnailResourceFile.FullyQualifiedURL) + photos[0].ThumbnailResourceFile.FullyQualifiedURL;
                    AlbumParameters[2] = LargePath;
                    AlbumParameters[3] = ThumbPath;
                    AlbumParameters[4] = collections[i].Name;
                    AlbumParameters[5] = collections[i].Description;
                    //AlbumParameters[6] = collections[i].Description;

                    //gallery title
                    sb.AppendFormat(@"  <album id=""{0}"" title=""{4}"" tn=""{1}"" lgPath=""{2}"" tnPath=""{3}"" description=""{5}"" >", AlbumParameters);

                    for (int j = 0; j < photos.Count; j++)
                    {
                        object[] PhotoParameters = new object[2];
                        PhotoParameters[0] = photos[j].PhotoResourceFile.FileName;
                        PhotoParameters[1] = string.Empty;

                        sb.AppendFormat(@"      <img src=""{0}"" caption=""{1}"" />", PhotoParameters);
                    }

                    sb.Append(@"    </album>");
                }
            }

            sb.Append(@"</gallery>");

            return sb.ToString();
        }