Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Create N upload_ click event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void CreateNUpload_Click(object sender, EventArgs e)
        {
            var album = new PhotoAlbumObject(AlbumName.Text.TrimEnd(' '));

            ErrMsg.Visible = false;
            if (AlbumName.Text.TrimEnd(' ').Length >= 20)
            {
                ErrMsg.Text    = "The length of album name has to be less then 20 characters.";
                ErrMsg.Visible = true;
            }
            else
            {
                if (!album.CreatePhotoAlbumItem(AlbumName.Text.TrimEnd(' '), string.Empty))
                {
                    if (!string.IsNullOrEmpty(album.PageErrorMsg))
                    {
                        ErrMsg.Text    = album.PageErrorMsg;
                        ErrMsg.Visible = true;
                    }
                    // check message property in class and show this message on registration page
                }
                else
                {
                    FeedHelper.CreateUserAlbumsFeed(album.CurrentAlbumItem);
                    FeedHelper.CreateAlbumFeed(album.CurrentAlbumItem);
                    // redirect to upload page
                    PhotoAlbumObject.RedirectToAlbumPage(Sitecore.Configuration.Settings.GetSetting("uploadPhotosPageItemID"), album.CurrentAlbumItem.ID.ToString());
                }
            }
        }