Ejemplo n.º 1
0
        protected void ActivitiesGridView_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow         row = ActivitiesGridView.Rows[e.RowIndex];
            SueetieMediaGallery _SueetieMediaGallery = ((SueetieMediaGallery)row.DataItem);
            DropDownList        ddDisplayTypes       = (DropDownList)row.FindControl("ddDisplayTypes") as DropDownList;

            e.NewValues.Remove("displayTypeID");
            e.NewValues.Add("displayTypeID", int.Parse(ddDisplayTypes.SelectedValue));

            CheckBox chkPublic = (CheckBox)row.FindControl("chkPublic") as CheckBox;
            CheckBox chkLogged = (CheckBox)row.FindControl("chkLogged") as CheckBox;

            e.NewValues.Add("isPublic", chkPublic.Checked);
            e.NewValues.Add("isLogged", chkLogged.Checked);
        }
Ejemplo n.º 2
0
        protected void ActivitiesGridView_OnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && ((e.Row.RowState & DataControlRowState.Edit) > 0))
            {
                SueetieMediaGallery _SueetieMediaGallery = ((SueetieMediaGallery)e.Row.DataItem);

                DropDownList ddDisplayTypes = (DropDownList)e.Row.FindControl("ddDisplayTypes") as DropDownList;
                Array        values         = Enum.GetValues(typeof(SueetieDisplayType));
                foreach (SueetieDisplayType displayType in Enum.GetValues(typeof(SueetieDisplayType)))
                {
                    ddDisplayTypes.Items.Add(new ListItem(Enum.GetName(typeof(SueetieDisplayType), displayType), displayType.ToString("D")));
                }
                ddDisplayTypes.Items.FindByValue(_SueetieMediaGallery.DisplayTypeID.ToString()).Selected = true;
                ddDisplayTypes.DataBind();
                this.GalleryID = _SueetieMediaGallery.GalleryID;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the <paramref name="zipContentFile"/> as a media object to the <paramref name="album"/>.
        /// </summary>
        /// <param name="zipContentFile">A reference to a file in a ZIP archive.</param>
        /// <param name="album">The album to which the file should be added as a media object.</param>
        /// // Sueetie Modified - passing i for single logging of action
        private void AddMediaObjectToGallery(ZipEntry zipContentFile, IAlbum album, int i)
        {
            string zipFileName = Path.GetFileName(zipContentFile.Name).Trim();

            if (zipFileName.Length == 0)
            {
                return;
            }

            string uniqueFilename = HelperFunctions.ValidateFileName(album.FullPhysicalPathOnDisk, zipFileName);
            string uniqueFilepath = Path.Combine(album.FullPhysicalPathOnDisk, uniqueFilename);

            // Extract the file from the zip stream and save as the specified filename.
            ExtractFileFromZipStream(uniqueFilepath);

            // Get the file we just saved to disk.
            FileInfo mediaObjectFile = new FileInfo(uniqueFilepath);

            try
            {
                IGalleryObject mediaObject = Factory.CreateMediaObjectInstance(mediaObjectFile, album);
                HelperFunctions.UpdateAuditFields(mediaObject, this._userName);

                // Sueetie Modified - Fixes a weird bug where zipped Image file titles are empty when zipped from my machine
                if (mediaObject.Title.Trim().Length == 0)
                {
                    mediaObject.Title = mediaObjectFile.Name;
                }

                mediaObject.Save();

                if ((_discardOriginalImage) && (mediaObject is Business.Image))
                {
                    ((Business.Image)mediaObject).DeleteHiResImage();
                    mediaObject.Save();
                }

                // Sueetie Modified - Add mediaobject to Sueetie_Content - Single File

                SueetieContent sueetieContent = new SueetieContent
                {
                    SourceID      = mediaObject.Id,
                    ContentTypeID = SueetieMedia.ConvertContentType((int)mediaObject.MimeType.TypeCategory),
                    ApplicationID = (int)SueetieApplications.Current.ApplicationID,
                    UserID        = SueetieContext.Current.User.UserID,
                    IsRestricted  = ((Album)mediaObject.Parent).IsPrivate,
                    Permalink     = SueetieMedia.SueetieMediaObjectUrl(mediaObject.Id, mediaObject.GalleryId)
                };
                SueetieCommon.AddSueetieContent(sueetieContent);

                // Add Sueetie-specific data to Sueetie_gs_MediaObject

                SueetieMediaObject _sueetieMediaObject = new SueetieMediaObject();
                _sueetieMediaObject.MediaObjectID    = mediaObject.Id;
                _sueetieMediaObject.ContentTypeID    = SueetieMedia.ConvertContentType((int)mediaObject.MimeType.TypeCategory);
                _sueetieMediaObject.AlbumID          = mediaObject.Parent.Id;
                _sueetieMediaObject.InDownloadReport = false;
                SueetieMedia.CreateSueetieMediaObject(_sueetieMediaObject);

                SueetieMediaAlbum   sueetieAlbum   = SueetieMedia.GetSueetieMediaAlbum(mediaObject.Parent.Id);
                SueetieMediaGallery sueetieGallery = SueetieMedia.GetSueetieMediaGallery(((Album)mediaObject.Parent).GalleryId);
                if (i == 0 && sueetieGallery.IsLogged)
                {
                    SueetieLogs.LogUserEntry((UserLogCategoryType)sueetieAlbum.AlbumMediaCategoryID, sueetieAlbum.ContentID, SueetieContext.Current.User.UserID);
                }

                SueetieMedia.ClearMediaPhotoListCache(0);
                SueetieMedia.ClearSueetieMediaObjectListCache(mediaObject.GalleryId);
            }
            catch (ErrorHandler.CustomExceptions.UnsupportedMediaObjectTypeException ex)
            {
                this._skippedFiles.Add(new KeyValuePair <string, string>(mediaObjectFile.Name, ex.Message));
                File.Delete(mediaObjectFile.FullName);
            }
        }