/// <summary> /// Binds the repeater and title controls and the visibilities of form elements. /// </summary> /// <param name="isNewAlbum">if set to <c>true</c> [is new album].</param> private void BindVariousControls(bool isNewAlbum) { this.Delete.Visible = !isNewAlbum; if (!isNewAlbum) { this.txtTitle.Text = LegacyDb.album_gettitle(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("a")); var albumList = LegacyDb.album_image_list(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("a"), null); this.List.DataSource = albumList; this.List.Visible = albumList.Rows.Count > 0; } this.DataBind(); }
/// <summary> /// Binds the data. /// </summary> private void BindData() { this.PagerTop.PageSize = this.Get <YafBoardSettings>().AlbumImagesPerPage; string albumTitle = LegacyDb.album_gettitle(this.AlbumID); // if (UserID == PageContext.PageUserID) // ltrTitle.Visible = false; this.ltrTitleOnly.Text = this.HtmlEncode(albumTitle); this.ltrTitle.Text = albumTitle == string.Empty ? this.GetText("ALBUM_CHANGE_TITLE") : this.HtmlEncode(albumTitle); // set the Datatable var dtAlbumImageList = LegacyDb.album_image_list(this.AlbumID, null); var dtAlbum = LegacyDb.album_list(null, this.AlbumID); // Does this album has a cover? this._coverImageID = dtAlbum.Rows[0]["CoverImageID"] == DBNull.Value ? string.Empty : dtAlbum.Rows[0]["CoverImageID"].ToString(); if ((dtAlbumImageList == null) || (dtAlbumImageList.Rows.Count <= 0)) { return; } this.PagerTop.Count = dtAlbumImageList.Rows.Count; // Create paged data source for the album image list var pds = new PagedDataSource { DataSource = dtAlbumImageList.DefaultView, AllowPaging = true, CurrentPageIndex = this.PagerTop.CurrentPageIndex, PageSize = this.PagerTop.PageSize }; this.AlbumImages.DataSource = pds; this.DataBind(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.Get <YafBoardSettings>().EnableAlbum) { YafBuildLink.AccessDenied(); } if (this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u") == null || this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("a") == null) { YafBuildLink.AccessDenied(); } var userId = Security.StringToLongOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("u")); var albumId = Security.StringToLongOrRedirect( this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("a")); var displayName = this.Get <IUserDisplayName>().GetName((int)userId); // Generate the page links. this.PageLinks.Clear(); this.PageLinks.AddRoot(); this.PageLinks.AddLink(displayName, YafBuildLink.GetLink(ForumPages.profile, "u={0}&name={1}", userId, displayName)); this.PageLinks.AddLink(this.GetText("ALBUMS"), YafBuildLink.GetLink(ForumPages.albums, "u={0}", userId)); this.PageLinks.AddLink(this.GetText("TITLE"), string.Empty); // Set the title text. this.LocalizedLabel1.Param0 = this.Server.HtmlEncode(displayName); this.LocalizedLabel1.Param1 = this.Server.HtmlEncode(LegacyDb.album_gettitle(albumId)); this.Back.Text = this.GetText("BACK_ALBUMS"); // Initialize the Album Image List control. this.AlbumImageList1.UserID = (int)userId; this.AlbumImageList1.AlbumID = (int)albumId; }