public IProfile GetProfile() { ProfileService profileService = new ProfileService(Ioc.GetInstance<IProfileRepository>()); Guid userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); return profileService.GetProfileByUserId(userId); }
public void rptSongs_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.ToLower() == "choose") { var profileService = new ProfileService(Ioc.GetInstance<IProfileRepository>()); Guid songId = new Guid(e.CommandArgument.ToString()); var songs = profileService.GetAllVersions(songId); ddlFavoriteChoice.Items.Clear(); ddlFavoriteChoice.Items.AddRange((from s in songs select new ListItem(GetSongName(s.SetSongLength, s.ShowDate, s.City, s.State), string.Format("{0}^{1}", s.SetSongId, songId))).ToArray()); phFavoriteChoice.Visible = true; } }
private Guid? BindProfile(Guid userId, string userName) { TourService service = new TourService(Ioc.GetInstance<ITourRepository>()); ProfileService profileService = new ProfileService(Ioc.GetInstance<IProfileRepository>()); var profile = profileService.GetProfileByUserId(userId); if (profile == null) { phNoProfileError.Visible = true; return null; } //Show Profile //SongService songService = new SongService(Ioc.GetInstance<ISongRepository>()); //ShowService showService = new ShowService(Ioc.GetInstance<IShowRepository>()); //if (profile.FavoriteStudioSong != null) //{ // var favoriteStudioSong = songService.GetSong(profile.FavoriteStudioSong.Value); // lblFavoriteStudioSong.Text = string.Format("{0} - {1}", favoriteStudioSong.SongName, favoriteStudioSong.Album); //} //if (profile.FavoriteLiveShow != null) //{ // var favoriteLiveShow = showService.GetShow(profile.FavoriteLiveShow.Value); // lblFavoriteLiveShow.Text = string.Format("{0} - {1}, {2}", favoriteLiveShow.ShowDate.Value.ToString("MM/dd/yyyy"), favoriteLiveShow.VenueName, favoriteLiveShow.State); //} //if (profile.FavoriteTour != null) //{ // var favoriteTour = service.GetTour(profile.FavoriteTour.Value); // lblFavoriteTour.Text = string.Format("{0} {1}-{2}", favoriteTour.TourName, favoriteTour.StartDate.Value.ToString("MM/dd/yyyy"), favoriteTour.EndDate.Value.ToString("MM/dd/yyyy")); //} if (profile.FavoriteAlbum != null) { var albumService = new AlbumService(Ioc.GetInstance<IAlbumRepository>()); var album = albumService.GetAlbum(profile.FavoriteAlbum.Value); lblFavoriteAlbum.Text = album.AlbumName; } lblName.Text = profile.Name; lblEmail.Text = profile.Email; lblFavorite3Year.Text = profile.Favorite3Year != null ? profile.Favorite3Year.Value.ToString() : string.Empty; lblFavoriteYear.Text = profile.FavoriteYear != null ? profile.FavoriteYear.Value.ToString() : string.Empty; lblFavoriteRun.Text = !string.IsNullOrEmpty(profile.FavoriteRun) ? profile.FavoriteRun.ToString() : string.Empty; lblFavoriteSeason.Text = !string.IsNullOrEmpty(profile.FavoriteSeason) ? profile.FavoriteSeason.ToString() : string.Empty; lblUserName.Text = userName; return userId; }