private void BindLists() { TourService tourService = new TourService(Ioc.GetInstance<ITourRepository>()); //ShowService showService = new ShowService(Ioc.GetInstance<IShowRepository>()); var tours = tourService.GetAllToursDescending().ToList(); if (tours != null && tours.Count > 0) { tours.ForEach(x => { ddlFavoriteTour.Items.Add(new ListItem(x.TourName, x.TourId.ToString())); ddlFavoriteLiveShowTour.Items.Add(new ListItem(x.TourName, x.TourId.ToString())); } ); var item = new ListItem("Please select a tour", "-1"); ddlFavoriteTour.Items.Insert(0, item); ddlFavoriteLiveShowTour.Items.Insert(0, item); //ddlFavoriteLiveShow.Items.Insert(0, item); item.Selected = true; } }
public void btnSubmit_Click(object sender, EventArgs e) { TourService service = new TourService(Ioc.GetInstance<ITourRepository>()); bool success = false; DateTime? startDate, endDate; if (Validated(out startDate, out endDate)) { Tour tour = new Tour() { TourId = Guid.NewGuid(), TourName = txtTourName.Text.Trim(), StartDate = startDate, EndDate = endDate, Official = chkOfficial.Checked }; service.SaveCommit(tour, out success); } if (success) { phSuccess.Visible = true; phError.Visible = false; } else { phError.Visible = true; phSuccess.Visible = false; } }
public IList<IShow> GetShowsFromMyShowsForUser(Guid userId, Guid tourId) { var showIds = GetShowIdsFromMyShows(userId); if (showIds == null || showIds.Count() <= 0) return null; TourService service = new TourService(Ioc.GetInstance<ITourRepository>()); var tour = service.GetTour(tourId); return (from show in tour.Shows where showIds.Contains(show.ShowId) select show).OrderBy(x => x.ShowDate).ToList(); }
private void Bind() { TourService tourService = new TourService(Ioc.GetInstance<ITourRepository>()); ShowService showService = new ShowService(Ioc.GetInstance<IShowRepository>()); ddlTourType.Items.AddRange((from x in tourService.GetAllToursDescending() select new ListItem(x.TourName, x.TourId.ToString())).ToArray()); ddlShowType.Items.AddRange((from x in showService.GetAllShows() select new ListItem(x.GetShowName(), x.ShowId.ToString())).ToArray()); ListItem item = new ListItem("Please select either a tour or a song", "-1"); ddlTourType.Items.Insert(0, item); ddlShowType.Items.Insert(0, item); item.Selected = true; }
public IList <IShow> GetShowsFromMyShowsForUser(Guid userId, Guid tourId) { var showIds = GetShowIdsFromMyShows(userId); if (showIds == null || showIds.Count() <= 0) { return(null); } TourService service = new TourService(Ioc.GetInstance <ITourRepository>()); var tour = service.GetTour(tourId); return((from show in tour.Shows where showIds.Contains(show.ShowId) select show).OrderBy(x => x.ShowDate).ToList()); }
public IList <IShow> GetShowsNotInUsersMyShows(Guid userId, Guid tourId) { TourService service = new TourService(Ioc.GetInstance <ITourRepository>()); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var myShows = GetMyShowsForUser(userId); var tour = service.GetTour(tourId); if (myShows == null || myShows.Count() <= 0) //then just return all of them { return(showService.GetAllShows().Where(x => x.TourId == tourId).OrderBy(y => y.ShowDate).ToList()); } var showIds = myShows.Select(x => x.ShowId).ToList(); return(showService.GetAllShows().Where(x => x.TourId == tourId && !showIds.Contains(x.ShowId)).OrderBy(y => y.ShowDate).ToList()); }
public IList<IShow> GetShowsNotInUsersMyShows(Guid userId, Guid tourId) { TourService service = new TourService(Ioc.GetInstance<ITourRepository>()); var showService = new ShowService(Ioc.GetInstance<IShowRepository>()); var myShows = GetMyShowsForUser(userId); var tour = service.GetTour(tourId); if (myShows == null || myShows.Count() <= 0) //then just return all of them { return showService.GetAllShows().Where(x => x.TourId == tourId).OrderBy(y => y.ShowDate).ToList(); } var showIds = myShows.Select(x => x.ShowId).ToList(); return showService.GetAllShows().Where(x => x.TourId == tourId && !showIds.Contains(x.ShowId)).OrderBy(y => y.ShowDate).ToList(); }
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; }