예제 #1
0
 private static void IncrementCommentCount(CommentType type, int ObjID)
 {
     if (type == CommentType.Wall)
     {
         //Do Nothing
     }
     else if (type == CommentType.Video)
     {
         Next2Friends.Data.Video v = Next2Friends.Data.Video.GetVideoByVideoIDWithJoin(ObjID);
         v.NumberOfComments++;
         v.Save();
     }
     else if (type == CommentType.AskAFriend)
     {
         //Do Nothing
     }
     else if (type == CommentType.Blog)
     {
         //Do Nothing
     }
     else if (type == CommentType.Photo)
     {
         Next2Friends.Data.Photo p = Next2Friends.Data.Photo.GetPhotoByPhotoIDWithJoin(ObjID);
         p.NumberOfComments++;
         p.Save();
     }
 }
예제 #2
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of Photos
        /// </summary>
        public static List<Photo> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

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

            Photo obj;

            while (dr.Read())
            {
                obj = new Photo();
                if (list.IsColumnPresent("PhotoID")) { obj._photoID = (int)dr["PhotoID"]; }
                if (list.IsColumnPresent("WebPhotoID")) { obj._webPhotoID = (string)dr["WebPhotoID"]; }
                if (list.IsColumnPresent("PhotoCollectionID")) { obj._photoCollectionID = (int)dr["PhotoCollectionID"]; }
                if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("PhotoResourceFileID")) { obj._photoResourceFileID = (int)dr["PhotoResourceFileID"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileID")) { obj._thumbnailResourceFileID = (int)dr["ThumbnailResourceFileID"]; }
                if (list.IsColumnPresent("Width")) { obj._width = (int)dr["Width"]; }
                if (list.IsColumnPresent("Height")) { obj._height = (int)dr["Height"]; }
                if (list.IsColumnPresent("Title")) { obj._title = (string)dr["Title"]; }
                if (list.IsColumnPresent("Caption")) { obj._caption = (string)dr["Caption"]; }
                if (list.IsColumnPresent("TotalVoteScore")) { obj._totalVoteScore = (int)dr["TotalVoteScore"]; }
                if (list.IsColumnPresent("NumberOfViews")) { obj._numberOfViews = (int)dr["NumberOfViews"]; }
                if (list.IsColumnPresent("NumberOfComments")) { obj._numberOfComments = (int)dr["NumberOfComments"]; }
                if (list.IsColumnPresent("Active")) { obj._active = (bool)dr["Active"]; }
                if (list.IsColumnPresent("Mobile")) { obj._mobile = (bool)dr["Mobile"]; }
                if (list.IsColumnPresent("CategoryID")) { obj._categoryID = (int)dr["CategoryID"]; }
                if (list.IsColumnPresent("Tags")) { obj._tags = (string)dr["Tags"]; }
                if (list.IsColumnPresent("TakenDT")) { obj._takenDT = (DateTime)dr["TakenDT"]; }
                if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
예제 #3
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of Photos
        /// </summary>
        public static List<Photo> PopulateObjectWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

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

            Photo obj;

            while (dr.Read())
            {
                obj = new Photo();
                if (list.IsColumnPresent("PhotoID")) { obj._photoID = (int)dr["PhotoID"]; }
                if (list.IsColumnPresent("WebPhotoID")) { obj._webPhotoID = (string)dr["WebPhotoID"]; }
                if (list.IsColumnPresent("PhotoCollectionID")) { obj._photoCollectionID = (int)dr["PhotoCollectionID"]; }
                if (list.IsColumnPresent("MemberID")) { obj._memberID = (int)dr["MemberID"]; }
                if (list.IsColumnPresent("PhotoResourceFileID")) { obj._photoResourceFileID = (int)dr["PhotoResourceFileID"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileID")) { obj._thumbnailResourceFileID = (int)dr["ThumbnailResourceFileID"]; }
                if (list.IsColumnPresent("Width")) { obj._width = (int)dr["Width"]; }
                if (list.IsColumnPresent("Height")) { obj._height = (int)dr["Height"]; }
                if (list.IsColumnPresent("Title")) { obj._title = (string)dr["Title"]; }
                if (list.IsColumnPresent("Caption")) { obj._caption = (string)dr["Caption"]; }
                if (list.IsColumnPresent("TotalVoteScore")) { obj._totalVoteScore = (int)dr["TotalVoteScore"]; }
                if (list.IsColumnPresent("NumberOfViews")) { obj._numberOfViews = (int)dr["NumberOfViews"]; }
                if (list.IsColumnPresent("NumberOfComments")) { obj._numberOfComments = (int)dr["NumberOfComments"]; }
                if (list.IsColumnPresent("Active")) { obj._active = (bool)dr["Active"]; }
                if (list.IsColumnPresent("Mobile")) { obj._mobile = (bool)dr["Mobile"]; }
                if (list.IsColumnPresent("CategoryID")) { obj._categoryID = (int)dr["CategoryID"]; }
                if (list.IsColumnPresent("Tags")) { obj._tags = (string)dr["Tags"]; }
                if (list.IsColumnPresent("TakenDT")) { obj._takenDT = (DateTime)dr["TakenDT"]; }
                if (list.IsColumnPresent("CreatedDT")) { obj._createdDT = (DateTime)dr["CreatedDT"]; }

                obj.ParentPhotoCollection = new PhotoCollection();
                if (list.IsColumnPresent("ParentPhotoCollectionPhotoCollectionID")) { obj.ParentPhotoCollection.PhotoCollectionID = (int)dr["ParentPhotoCollectionPhotoCollectionID"]; }
                if (list.IsColumnPresent("ParentPhotoCollectionWebPhotoCollectionID")) { obj.ParentPhotoCollection.WebPhotoCollectionID = (string)dr["ParentPhotoCollectionWebPhotoCollectionID"]; }
                if (list.IsColumnPresent("ParentPhotoCollectionMemberID")) { obj.ParentPhotoCollection.MemberID = (int)dr["ParentPhotoCollectionMemberID"]; }
                if (list.IsColumnPresent("ParentPhotoCollectionName")) { obj.ParentPhotoCollection.Name = (string)dr["ParentPhotoCollectionName"]; }
                if (list.IsColumnPresent("ParentPhotoCollectionDescription")) { obj.ParentPhotoCollection.Description = (string)dr["ParentPhotoCollectionDescription"]; }
                if (list.IsColumnPresent("ParentPhotoCollectionDTCreated")) { obj.ParentPhotoCollection.DTCreated = (DateTime)dr["ParentPhotoCollectionDTCreated"]; }

                obj.PhotoResourceFile = new ResourceFile();
                if (list.IsColumnPresent("PhotoResourceFileResourceFileID")) { obj.PhotoResourceFile.ResourceFileID = (int)dr["PhotoResourceFileResourceFileID"]; }
                if (list.IsColumnPresent("PhotoResourceFileWebResourceFileID")) { obj.PhotoResourceFile.WebResourceFileID = (string)dr["PhotoResourceFileWebResourceFileID"]; }
                if (list.IsColumnPresent("PhotoResourceFileResourceType")) { obj.PhotoResourceFile.ResourceType = (int)dr["PhotoResourceFileResourceType"]; }
                if (list.IsColumnPresent("PhotoResourceFileStorageLocation")) { obj.PhotoResourceFile.StorageLocation = (int)dr["PhotoResourceFileStorageLocation"]; }
                if (list.IsColumnPresent("PhotoResourceFileServer")) { obj.PhotoResourceFile.Server = (int)dr["PhotoResourceFileServer"]; }
                if (list.IsColumnPresent("PhotoResourceFilePath")) { obj.PhotoResourceFile.Path = (string)dr["PhotoResourceFilePath"]; }
                if (list.IsColumnPresent("PhotoResourceFileFileName")) { obj.PhotoResourceFile.FileName = (string)dr["PhotoResourceFileFileName"]; }
                if (list.IsColumnPresent("PhotoResourceFileCreatedDT")) { obj.PhotoResourceFile.CreatedDT = (DateTime)dr["PhotoResourceFileCreatedDT"]; }

                obj.ThumbnailResourceFile = new ResourceFile();
                if (list.IsColumnPresent("ThumbnailResourceFileResourceFileID")) { obj.ThumbnailResourceFile.ResourceFileID = (int)dr["ThumbnailResourceFileResourceFileID"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileWebResourceFileID")) { obj.ThumbnailResourceFile.WebResourceFileID = (string)dr["ThumbnailResourceFileWebResourceFileID"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileResourceType")) { obj.ThumbnailResourceFile.ResourceType = (int)dr["ThumbnailResourceFileResourceType"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileStorageLocation")) { obj.ThumbnailResourceFile.StorageLocation = (int)dr["ThumbnailResourceFileStorageLocation"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileServer")) { obj.ThumbnailResourceFile.Server = (int)dr["ThumbnailResourceFileServer"]; }
                if (list.IsColumnPresent("ThumbnailResourceFilePath")) { obj.ThumbnailResourceFile.Path = (string)dr["ThumbnailResourceFilePath"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileFileName")) { obj.ThumbnailResourceFile.FileName = (string)dr["ThumbnailResourceFileFileName"]; }
                if (list.IsColumnPresent("ThumbnailResourceFileCreatedDT")) { obj.ThumbnailResourceFile.CreatedDT = (DateTime)dr["ThumbnailResourceFileCreatedDT"]; }

                obj.Member = new Member();
                if (list.IsColumnPresent("MemberMemberID")) { obj.Member.MemberID = (int)dr["MemberMemberID"]; }
                if (list.IsColumnPresent("MemberWebMemberID")) { obj.Member.WebMemberID = (string)dr["MemberWebMemberID"]; }
                if (list.IsColumnPresent("MemberAdminStatusID")) { obj.Member.AdminStatusID = (int)dr["MemberAdminStatusID"]; }
                if (list.IsColumnPresent("MemberNickName")) { obj.Member.NickName = (string)dr["MemberNickName"]; }
                if (list.IsColumnPresent("MemberChannelID")) { obj.Member.ChannelID = (int)dr["MemberChannelID"]; }
                if (list.IsColumnPresent("MemberPassword")) { obj.Member.Password = (string)dr["MemberPassword"]; }
                if (list.IsColumnPresent("MemberEmail")) { obj.Member.Email = (string)dr["MemberEmail"]; }
                if (list.IsColumnPresent("MemberGender")) { obj.Member.Gender = (int)dr["MemberGender"]; }
                if (list.IsColumnPresent("MemberFirstName")) { obj.Member.FirstName = (string)dr["MemberFirstName"]; }
                if (list.IsColumnPresent("MemberLastName")) { obj.Member.LastName = (string)dr["MemberLastName"]; }
                if (list.IsColumnPresent("MemberProfilePhotoResourceFileID")) { obj.Member.ProfilePhotoResourceFileID = (int)dr["MemberProfilePhotoResourceFileID"]; }
                if (list.IsColumnPresent("MemberDOB")) { obj.Member.DOB = (DateTime)dr["MemberDOB"]; }
                if (list.IsColumnPresent("MemberISOCountry")) { obj.Member.ISOCountry = (string)dr["MemberISOCountry"]; }
                if (list.IsColumnPresent("MemberAccountType")) { obj.Member.AccountType = (int)dr["MemberAccountType"]; }
                if (list.IsColumnPresent("MemberZipPostcode")) { obj.Member.ZipPostcode = (string)dr["MemberZipPostcode"]; }
                if (list.IsColumnPresent("MemberPhoneNumber")) { obj.Member.PhoneNumber = (string)dr["MemberPhoneNumber"]; }
                if (list.IsColumnPresent("MemberMobilePhoneID")) { obj.Member.MobilePhoneID = (int)dr["MemberMobilePhoneID"]; }
                if (list.IsColumnPresent("MemberIPLocationID")) { obj.Member.IPLocationID = (int)dr["MemberIPLocationID"]; }
                if (list.IsColumnPresent("MemberCreatedDT")) { obj.Member.CreatedDT = (DateTime)dr["MemberCreatedDT"]; }


                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
예제 #4
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;
        }