Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of AskAFriendPhotos
        /// </summary>
        public static List<AskAFriendPhoto> PopulateObject(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

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

            AskAFriendPhoto obj;

            while (dr.Read())
            {
                obj = new AskAFriendPhoto();
                if (list.IsColumnPresent("AskAFriendPhotoID")) { obj._askAFriendPhotoID = (int)dr["AskAFriendPhotoID"]; }
                if (list.IsColumnPresent("AskAFriendID")) { obj._askAFriendID = (int)dr["AskAFriendID"]; }
                if (list.IsColumnPresent("PhotoResourceFileID")) { obj._photoResourceFileID = (int)dr["PhotoResourceFileID"]; }
                if (list.IsColumnPresent("IndexOrder")) { obj._indexOrder = (int)dr["IndexOrder"]; }

                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Takes an prepopulated IDataReader and creates an array of AskAFriendPhotos
        /// </summary>
        public static List<AskAFriendPhoto> PopulateObjectWithJoin(IDataReader dr)
        {
            ColumnFieldList list = new ColumnFieldList(dr);

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

            AskAFriendPhoto obj;

            while (dr.Read())
            {
                obj = new AskAFriendPhoto();
                if (list.IsColumnPresent("AskAFriendPhotoID")) { obj._askAFriendPhotoID = (int)dr["AskAFriendPhotoID"]; }
                if (list.IsColumnPresent("AskAFriendID")) { obj._askAFriendID = (int)dr["AskAFriendID"]; }
                if (list.IsColumnPresent("PhotoResourceFileID")) { obj._photoResourceFileID = (int)dr["PhotoResourceFileID"]; }
                if (list.IsColumnPresent("IndexOrder")) { obj._indexOrder = (int)dr["IndexOrder"]; }

                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"]; }


                arr.Add(obj);
            }

            dr.Close();

            return arr;
        }
Exemplo n.º 4
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();
        }