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 static string GetMiniPhotoGalleryeHTML(string WebPhotoGallery)
    {
        PhotoCollection collection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(WebPhotoGallery);
        List <Photo>    photos     = Photo.GetPhotoByPhotoCollectionIDWithJoinPager(collection.PhotoCollectionID, 1, 9);

        string MiniHTML = string.Empty;

        if (photos != null)
        {
            StringBuilder sbHTML = new StringBuilder();

            for (int i = 0; i < 9; i++)
            {
                if (i >= photos.Count)
                {
                    break;
                }

                object[] parameters = new object[2];

                parameters[0] = ParallelServer.Get(photos[i].ThumbnailResourceFile.FullyQualifiedURL) + photos[i].ThumbnailResourceFile.FullyQualifiedURL;
                parameters[1] = i.ToString();

                sbHTML.AppendFormat(@"<li>
                                    <a href=''><img src='{0}' alt='thumb' /></a>
                                </li>", parameters);
            }


            MiniHTML = "<ul class='profile_gallery clearfix'>" + sbHTML.ToString() + "</ul>";
        }

        return(MiniHTML);
    }
Ejemplo n.º 3
0
        public void UploadPhoto(String nickname, String password, String webPhotoCollectionID, Byte[] photoFileBytes, DateTime takenDT)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (photoFileBytes == null)
            {
                throw new ArgumentNullException("photoFileBytes");
            }

            try
            {
                var member          = Member.GetMemberViaNicknamePassword(nickname, password);
                var photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(webPhotoCollectionID);
                data.Photo.ProcessMemberPhoto(member, photoCollection.PhotoCollectionID, photoFileBytes, takenDT, true);
                NotifyPhotoUploaded(member, photoCollection);
            }
            catch (Exception e)
            {
                Log.Logger(String.Format(CultureInfo.InvariantCulture, "UploadPhoto exception: {0}", e.Message), Identifier);
                Trace.Tracer(e.ToString());
                throw e;
            }
        }
Ejemplo n.º 4
0
    private int GetObjectID(CommentType type, string WebID)
    {
        if (type == CommentType.Wall)
        {
            Member m = Member.GetMemberViaWebMemberID(WebID);
            return(m.MemberID);
        }
        else if (type == CommentType.Video)
        {
            Video v = Video.GetVideoByWebVideoIDWithJoin(WebID);
            return(v.VideoID);
        }
        else if (type == CommentType.AskAFriend)
        {
            AskAFriend aaf = AskAFriend.GetAskAFriendByWebAskAFriendID(WebID);
            return(aaf.AskAFriendID);
        }
        else if (type == CommentType.Blog)
        {
            BlogEntry blog = BlogEntry.GetBlogEntryByWebBlogEntryID(WebID);
            return(blog.BlogEntryID);
        }
        else if (type == CommentType.Photo)
        {
            Photo photo = Photo.GetPhotoByWebPhotoIDWithJoin(WebID);
            return(photo.PhotoID);
        }
        else if (type == CommentType.PhotoGallery)
        {
            PhotoCollection photoColl = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(WebID);
            return(photoColl.PhotoCollectionID);
        }

        return(-1);
    }
Ejemplo n.º 5
0
        public void RenameCollection(String nickname, String password, String webPhotoCollectionID, String newName)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (String.IsNullOrEmpty(webPhotoCollectionID))
            {
                throw new ArgumentNullException("webPhotoCollectionID");
            }
            if (String.IsNullOrEmpty(newName))
            {
                throw new ArgumentNullException("newName");
            }

            var member     = Member.GetMemberViaNicknamePassword(nickname, password);
            var collection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(webPhotoCollectionID);

            if (collection.MemberID != member.MemberID)
            {
                throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, Resources.Argument_InvalidPhotoCollectionModifier, webPhotoCollectionID));
            }
            collection.Name = newName;
            collection.Save();
        }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(MyPhotoGallery));

        // create the JS Arrays for autopopulating Tags from cats
        CategoryTagsArrays = GenerateCategoryTagsArrays();

        string strPage = Request.Params["p"];

        CurrentPageIndex = Pager.TryGetPageIndex(strPage);

        member = (Member)Session["Member"];

        string strPhotoCollectionDeleteID = Request.Params["d"];
        string strReload = Request.Params["reload"];

        if (strPhotoCollectionDeleteID != null)
        {
            PhotoCollection photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(strPhotoCollectionDeleteID);

            if (photoCollection != null)
            {
                if (photoCollection.MemberID == member.MemberID)
                {
                    photoCollection.Delete();
                }
            }
        }

        DefaultWebPhotoCollectionID = Request.Params["pc"];

        // hack to reload photocollection
        member.PhotoCollection = null;

        // if a photocollectionid has been specified then load the new collection
        if (DefaultWebPhotoCollectionID != null && !IsPostBack)
        {
            PhotoCollection photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(DefaultWebPhotoCollectionID);
            if (photoCollection.MemberID == member.MemberID)
            {
                DefaultPhotoCollectionID            = photoCollection.PhotoCollectionID;
                Session["DefaultPhotoCollectionID"] = DefaultPhotoCollectionID;
                Bind(CurrentPageIndex);
            }
        }
        else if (!IsPostBack && DefaultWebPhotoCollectionID == null)
        {
            // get the default photo collectionid on initial load
            DefaultPhotoCollectionID            = member.PhotoCollection[0].PhotoCollectionID;
            DefaultWebPhotoCollectionID         = member.PhotoCollection[0].WebPhotoCollectionID;
            Session["DefaultPhotoCollectionID"] = DefaultPhotoCollectionID;
            Bind(CurrentPageIndex);
        }

        DefaultPhotoCollectionID = (int)Session["DefaultPhotoCollectionID"];

        GenerateGalleries();
    }
Ejemplo n.º 7
0
        public PhotoItem[] GetPhotosByCollection(String nickname, String password, String webPhotoCollectionID)
        {
            if (String.IsNullOrEmpty(nickname))
            {
                throw new ArgumentNullException("nickname");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }
            if (String.IsNullOrEmpty(webPhotoCollectionID))
            {
                throw new ArgumentNullException("webPhotoCollectionID");
            }

            try
            {
                var member            = Member.GetMemberViaNicknamePassword(nickname, password);
                var photoCollection   = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(webPhotoCollectionID);
                var photoCollectionID = photoCollection.PhotoCollectionID;
                var photos            = data.Photo.GetPhotoByPhotoCollectionIDWithJoin(photoCollectionID);

                var result = new PhotoItem[photos.Length];

                for (var i = 0; i < photos.Length; i++)
                {
                    var item = new PhotoItem();
                    item.WebPhotoID = photos[i].WebPhotoID;

                    if (photos[i].PhotoResourceFile != null)
                    {
                        item.MainPhotoURL = _baseUrl + photos[i].PhotoResourceFile.FullyQualifiedURL;
                    }
                    if (photos[i].ThumbnailResourceFile != null)
                    {
                        item.ThumbnailURL = _baseUrl + photos[i].ThumbnailResourceFile.FullyQualifiedURL;
                    }

                    result[i] = item;
                }

                return(result);
            }
            catch (Exception e)
            {
                Log.Logger(String.Format(CultureInfo.InvariantCulture, "GetPhotosByCollection exception: {0}", e.Message), Identifier);
                Trace.Tracer(e.ToString());
                throw e;
            }
        }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(ViewGallery));

        member = (Member)Session["Member"];

        if (member != null)
        {
            IsLoggedIn = true;
        }

        LoginUrl = @"/signup.aspx?u=" + Server.UrlEncode(Request.Url.AbsoluteUri);

        string strPage = Request.Params["p"];

        CurrentPageIndex = Pager.TryGetPageIndex(strPage);

        // load the members photo
        string strGalleryPhoto = Request.Params["g"];

        if (strGalleryPhoto != null)
        {
            URLPhotoCollectionID = strGalleryPhoto;
            ViewingMember        = Member.GetMemberByPhotoCollectionID(strGalleryPhoto);
            DefaultGallery       = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(strGalleryPhoto);
            GalleryNameHTML      = DefaultGallery.Name;
            GetGalleryDrop();
            GetGalleryLister(CurrentPageIndex);
            GetPhotoJSArray();
        }
        else
        {
            // the member failed to load from the URL param.. throw a friendly
        }

        if (member != null)
        {
            if (ViewingMember.MemberID == member.MemberID)
            {
                IsMyPage = true;
            }
        }

        Comments1.CommentType       = CommentType.Photo;
        forwardToFriend.ObjectWebID = URLPhotoCollectionID;
        forwardToFriend.ContentType = CommentType.PhotoGallery;
    }
Ejemplo n.º 9
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.º 10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        member = (Member)Session["Member"];
        bool Update = false;

        if (member != null)
        {
            for (int i = 0; i < PhotoRepeater.Items.Count; i++)
            {
                HiddenField HiddenFieldWebPhotoID = (HiddenField)PhotoRepeater.Items[i].FindControl("WebPhotoID");
                string      WebPhotoID            = HiddenFieldWebPhotoID.Value;

                Photo photo = GetLocalPhotoByWebPhotoID(WebPhotoID);

                if (photo != null)
                {
                    if (photo.MemberID == member.MemberID)
                    {
                        CheckBox chbDelete = (CheckBox)PhotoRepeater.Items[i].FindControl("chbDelete");
                        bool     DoDelete  = chbDelete.Checked;

                        DropDownList    drpGallery = (DropDownList)PhotoRepeater.Items[i].FindControl("drpGallery");
                        string          NewWebPhotoCollectionID = drpGallery.SelectedValue;
                        PhotoCollection NewCollectionObject     = GetLocalGalleryByWebPhotoColletionID(NewWebPhotoCollectionID);

                        if (DoDelete)
                        {
                            photo.Delete();
                        }
                        else
                        {
                            // determine if a gallery move has been requested
                            if (photo.PhotoCollectionID != NewCollectionObject.PhotoCollectionID)
                            {
                                photo.PhotoCollectionID = NewCollectionObject.PhotoCollectionID;
                                Update = true;
                            }

                            HiddenField HiddenFieldRotation = (HiddenField)PhotoRepeater.Items[i].FindControl("Rotation");
                            string      Rotation            = HiddenFieldRotation.Value;
                            int         RotationValue       = Int32.Parse(Rotation);
                            HiddenFieldRotation.Value = "0";

                            if (RotationValue != 0)
                            {
                                Photo.RotateGalleryImage(member, WebPhotoID, ASP.global_asax.DiskUserRoot, RotationValue);
                            }


                            TextBox txtCaption = (TextBox)PhotoRepeater.Items[i].FindControl("txtCaption");
                            //DropDownList drpCategories = (DropDownList)PhotoRepeater.Items[i].FindControl("drpCategories");
                            //TextBox txtTags = (TextBox)PhotoRepeater.Items[i].FindControl("txtTags");



                            ////if (photo.CategoryID.ToString() != drpCategories.SelectedValue)
                            //{
                            //    photo.CategoryID = Int32.Parse(drpCategories.SelectedValue);
                            //    Update = true;
                            //}


                            if (photo.Caption != txtCaption.Text)
                            {
                                photo.Caption = txtCaption.Text;
                                Update        = true;
                            }

                            if (Update)
                            {
                                photo.Save();
                            }
                        }
                    }
                }
            }
        }

        string strPhotoCollectionID = Request.Params["pc"];

        // if a photocollectionid has been specified then load the new collection
        if (strPhotoCollectionID != null)
        {
            PhotoCollection photoCollection = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(strPhotoCollectionID);
            DefaultPhotoCollectionID = photoCollection.PhotoCollectionID;
        }

        Bind(CurrentPageIndex);
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(ViewGalleryPB));

        member = (Member)Session["Member"];

        if (member != null)
        {
            IsLoggedIn = true;
        }

        // set the default forwarding if the member is not logged in
        LoginUrl          = @"signup.aspx?u=" + Request.Url.AbsoluteUri;
        SubscribeLink     = LoginUrl;
        SendMessageLink   = LoginUrl;
        BlockMemberLink   = LoginUrl;
        AddToFriendsLink  = LoginUrl;
        AddFavouritesLink = LoginUrl;

        // load the members photo
        string strGalleryPhoto = Request.Params["g"];
        string strPhoto        = Request.Params["p"];

        if (strGalleryPhoto != null)
        {
            ViewingMember        = Member.GetMemberByPhotoCollectionID(strGalleryPhoto);
            ViewingMemberProfile = ViewingMember.MemberProfile[0];
            DefaultNumberOfViews = (++ViewingMemberProfile.NumberOfViews).ToString();
            ViewingMemberProfile = ViewingMember.MemberProfile[0];
            DefaultGallery       = PhotoCollection.GetPhotoCollectionByWebPhotoCollectionID(strGalleryPhoto);
            GalleryNameHTML      = DefaultGallery.Name;

            GetGalleryDrop();
            GetPhotoJSArray();
            DisplayGallery = "block";
        }
        else
        {
            // the member failed to load from the URL param.. throw a friendly
        }

        if (strPhoto != null)
        {
            DefaultPhoto        = Photo.GetPhotoByWebPhotoIDWithJoin(strPhoto);
            DefaultPhotoURL     = ParallelServer.Get(DefaultPhoto.PhotoResourceFile.FullyQualifiedURL) + DefaultPhoto.PhotoResourceFile.FullyQualifiedURL;
            DefaultPhotoCaption = DefaultPhoto.Caption;
            DefaultWebPhotoID   = DefaultPhoto.WebPhotoID;
            DisplayPhoto        = "block";
            DisplayCurrentIndex = "block";
            DisplayComments     = "block";
            SetPagerButtons();
        }
        else
        {
            GetGalleryLister();
        }

        if (member != null)
        {
            if (ViewingMember.MemberID == member.MemberID)
            {
                IsMyPage = true;
            }
        }

        try
        {
            NumberOfVideos  = ViewingMemberProfile.NumberOfVideos;
            NumberOfPhotos  = ViewingMemberProfile.NumberOfPhotos;
            NumberOfFriends = FriendRequest.GetNumberOfFriends(ViewingMember.MemberID);
        }
        catch { }
    }