/// <summary> /// Initializes the users profile. /// </summary> private void InitializeUsersProfile() { this.ProfileMusicList.UserId = this.UserId; this.WrittenBattlesList.UserId = this.UserId; this.AudioBattlesList.UserId = this.UserId; this.ProfileHood.UserId = this.UserId; this.ProfileAlbumList.UserID = this.UserId; this.ProfileMusicAdd.UserId = this.UserId; this.ProfileMusicList.UserId = this.UserId; this.ProfileUserComments.UserId = this.UserId; this.UsersWrittenVerses.UserId = this.UserId; this.UsersAudioVerses.UserId = this.UserId; this.AddVerseAudio.UserId = this.UserId; this.AddVerseWritten.UserId = this.UserId; this.UserOverviewStats.UserId = this.UserId; this.UserOverviewStats.UserData = this.UserData; this.UserAudioStats.UserId = this.UserId; this.UserWrittenStats.UserId = this.UserId; this.UserProfileLink.UserID = this.UserId; this.ProfileImage.ImageUrl = this.Get<IAvatars>().GetAvatarUrlForUser(UserId); var headerImage = new UserProfile(this.UserId).GetHeaderImage(); this.Bio = new UserProfile(this.UserId).GetBio(); if (this.Bio.IsNotSet() && this.UserId == this.PageUserId) { this.Bio = this.Text("PROFILE", "EDIT_BIO"); }else if (this.Bio.IsNotSet()) { this.Bio = this.Text("PROFILE", "NO_BIO"); } if (headerImage != null) { this.HeaderImage.ImageUrl = this.GetService<ResourceProvider>() .GetClientPath(RapResource.HeaderPictures, headerImage); if (this.IsMobile) { this.HeaderImage.Height = Unit.Pixel(200); this.HeaderImage.Width = Unit.Pixel(275); } else { this.HeaderImage.Height = Unit.Pixel(200); this.HeaderImage.Width = Unit.Pixel(450); } } else { this.HeaderImage.Hidden = true; } }
/// <summary> /// Handles the OnClick event of the HeaderUpload control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DirectEventArgs" /> instance containing the event data.</param> protected void HeaderUpload_OnClick([NotNull] object sender,[NotNull] EventArgs e) { if (this.HeaderUploader.PostedFile.ContentType.Contains("image")) { var file = Guid.NewGuid() + Path.GetExtension(this.HeaderUploader.FileName); this.HeaderUploader.PostedFile.SaveAs( this.GetService<ResourceProvider>().GetPath(RapResource.HeaderPictures, file)); var up = new UserProfile(this.UserId); up.UploadHeaderImage(file); this.AddLoadMessageSession(this.Text("PROFILE", "HEADERIMG")); this.GetService<UrlProvider>().RefreshPage(); } else { this.PageContext.AddLoadMessage(this.Text("COMMON", "INVALID_IMAGE"), MessageTypes.Error); } }