public void btnSubmit_Click(object sender, EventArgs e) { if (EmptyNullUndefined(txtAlbumName.Text) || ddlYearReleased.SelectedValue == "-1") return; var album = new Album { AlbumId = Guid.NewGuid(), AlbumName = txtAlbumName.Text, CreatedDate = DateTime.UtcNow, YearReleased = int.Parse(ddlYearReleased.SelectedValue) }; var albumService = new AlbumService(Ioc.GetInstance<IAlbumRepository>()); bool success; albumService.SaveCommit(album, out success); if (success) { var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "You have successfully created an album."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); } else { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "There was an error, try again later."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript()); } }
//public void btnNext_Click(object sender, System.Web.UI.ImageClickEventArgs e) //{ // Response.Redirect(LinkBuilder.ProfileStep2Link()); //} //public void btnPrevious_Click(object sender, System.Web.UI.ImageClickEventArgs e) //{ // Response.Redirect(LinkBuilder.ChangeProfileLink()); //} private void BindLists() { var yearService = new YearService(); var item = new ListItem("Please select a year", "-1"); ddlFavoriteYear.Items.AddRange(yearService.GetAllPhishYears()); ddlFavorite3Year.Items.AddRange(yearService.GetPhish3Point0Years()); ddlFavoriteYear.Items.Insert(0, item); ddlFavorite3Year.Items.Insert(0, item); item.Selected = true; BindSeasons(); BindRuns(); var albumService = new AlbumService(Ioc.GetInstance<IAlbumRepository>()); var albums = albumService.GetAllAlbumsForDropDown(); if (albums != null) { ddlFavoriteAlbums.Items.AddRange(albums); } item = new ListItem("Please select an album", "-1"); ddlFavoriteAlbums.Items.Insert(0, item); item.Selected = true; //var studioSongs = songService.GetAllSongs().Where(y => y.Album.ToLower() != "live only").OrderBy(x => x.SongName).ToList(); //if (studioSongs != null) //{ // studioSongs.ForEach(x => ddlFavoriteStudioSong.Items.Add(new ListItem(x.SongName, x.SongId.ToString()))); //} //item = new ListItem("Please select a song", "-1"); //ddlFavoriteStudioSong.Items.Insert(0, item); //item.Selected = 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; }
public void BindProfile() { var profile = profileService.GetProfileByUserId(userId); if (profile != 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); // if (favoriteLiveShow != null) // { // 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; } else { //Create profile var newProfile = new Profile { CreatedDate = DateTime.Now, ProfileId = Guid.NewGuid(), UserId = userId }; bool success; profileService.SaveCommit(newProfile, out success); } }