Esempio n. 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();
     }
 }
Esempio n. 2
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);
        }
Esempio n. 3
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;
        }