private void BindWithShowId(Guid showId) { ShowId = showId; var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(showId); if (show != null) { SetShows(show.ShowDate.Value.Year); if (!ddlShows.Items.Contains(new ListItem(show.GetShowName(), show.ShowId.ToString()))) { phAddShow.Visible = true; lnkAddMyShow.Text = string.Format("Click Here to add {0} to My Shows.", show.GetShowName()); phAddPicture.Visible = false; } else { phAddShow.Visible = false; phAddPicture.Visible = true; } ddlShows.SelectedValue = show.ShowId.ToString(); hdnShowId.Value = show.ShowId.ToString(); } }
private void BindProfile() { var profile = GetProfile(); if (profile != null) { ddlFavoriteTour.SelectedValue = profile.FavoriteTour != null?profile.FavoriteTour.ToString() : string.Empty; if (profile.FavoriteLiveShow != null) { //ddlFavoriteLiveShow.Items.Clear(); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(profile.FavoriteLiveShow.Value); //var item = new ListItem(show.GetShowName(), show.ShowId.ToString()); lblCurrentSelection.Text = show.GetShowName(); //ddlFavoriteLiveShow.Items.Insert(0, item); //item.Selected = true; } } }
private void Bind() { if (string.IsNullOrEmpty(Request.QueryString["setSongId"])) { Response.Redirect(LinkBuilder.DashboardLink()); } var setSongId = new Guid(Request.QueryString["setSongId"]); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var setService = new SetService(Ioc.GetInstance <ISetRepository>()); var setSongService = new SetSongService(Ioc.GetInstance <ISetSongRepository>()); var setSong = setSongService.GetSetSong(setSongId); var set = setService.GetSet(setSong.SetId.Value); var show = showService.GetShow(set.ShowId.Value); ShowName = show.GetShowName(); SongName = setSong.SongName; lnkReviewShow.NavigateUrl = LinkBuilder.AnalysisLink(show.ShowId); lnkNoReviews.NavigateUrl = LinkBuilder.AnalysisLink(show.ShowId); SetPageTitle("Review of " + SongName + " from " + ShowName); BindReviews(setSongId); }
private Show GetShowFromSetSong(Guid setSongId) { var setSong = (SetSong)setSongService.GetSetSong(setSongId); var set = setService.GetSet(setSong.SetId.Value); var show = showService.GetShow(set.ShowId.Value); return((Show)show); }
public void lnkAddSetToShow_Click(object sender, EventArgs e) { ResetPanels(); Guid showId = new Guid(hdnId.Value); SetService setService = new SetService(Ioc.GetInstance <ISetRepository>()); var show = (Show)showService.GetShow(showId); bool success = false; if (show != null) { short?setNumber = (short)show.Sets.Count; setNumber++; Guid setId = Guid.NewGuid(); Set set = new Set() { CreatedDate = DateTime.UtcNow, Encore = chkEncore.Checked, SetId = setId, SetNumber = setNumber, ShowId = showId, Official = true }; setService.SaveCommit(set, out success); } if (success) { phSuccess.Visible = true; phError.Visible = false; } else { phSuccess.Visible = false; phError.Visible = true; } Bind(); }
private void Bind() { DateTime showDate; Guid showId; var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); IShow show = null; var segment = Request.GetFriendlyUrlSegments().FirstOrDefault(); //Check to see if the show date or show id is passed in then get the IShow for that show if (DateTime.TryParse(segment, out showDate)) { show = showService.GetShow(showDate); } else if (Guid.TryParse(segment, out showId)) { show = showService.GetShow(showId); } //If it is not a valid show then get out of here if (show == null) { Response.Redirect(LinkBuilder.DefaultMainLink()); } hdnShowId.Value = show.Id.ToString(); lnkPhishShows.NavigateUrl = GetPhishowsLink(showDate); lnkPhishTracks.NavigateUrl = GetPhishTracksLink(showDate); //Get the user Id and Bind the notes and tags BindNotes(show); BindTags(show.Id); BindListenedShow(show); BindSetlist(show.ShowDate.Value); }
private void Bind() { ResetPanels(); if (!string.IsNullOrEmpty(Request.QueryString["showId"])) { var showId = new Guid(Request.QueryString["showId"]); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(showId); if (show != null) { ddlShows.SelectedValue = show.ShowId.ToString(); } } }
private void Bind() { if (EmptyNullUndefined(Request.QueryString["showId"])) { return; } //If a showId is sent then bind the tour and show var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(new Guid(Request.QueryString["showId"])); if (show == null) { return; } //bind year from show }
//private void ResetPanels() //{ // phError.Visible = false; // phSuccess.Visible = false; // phAlreadyAdded.Visible = false; //} public void rptShows_ItemCommand(object source, RepeaterCommandEventArgs e) { //ResetPanels(); if (e.CommandName.ToLower() == "add") { var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); Guid userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); var showId = new Guid(e.CommandArgument.ToString()); var show = showService.GetShow(showId); var myShow = myShowService.GetMyShow(showId, userId); if (myShow != null) { //phAlreadyAdded.Visible = true; return; } MyShow newMyShow = new MyShow { CreatedDate = DateTime.Now, MyShowId = Guid.NewGuid(), ShowId = showId, UserId = userId }; bool success = false; myShowService.SaveCommit(newMyShow, out success); if (hdnBindFrom.Value == "phishnet") { BindFromPhishNet(); } else { BindFromYear(show.ShowDate.Value.Year); } } }
public void btnSubmit_Click(object sender, System.Web.UI.ImageClickEventArgs e) { using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin()) { bool set = false; var profile = (Profile)GetProfile(); if (ddlFavoriteTour.SelectedValue != "-1") { set = true; profile.FavoriteTour = new Guid(ddlFavoriteTour.SelectedValue); } var favoriteLiveShow = Request.Form["ddlFavoriteLiveShow"]; if (favoriteLiveShow != null && favoriteLiveShow != "-1") { set = true; var favoriteLiveShowId = new Guid(favoriteLiveShow); profile.FavoriteLiveShow = favoriteLiveShowId; var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(favoriteLiveShowId); lblCurrentSelection.Text = show.GetShowName(); } ddlFavoriteLiveShowTour.SelectedIndex = 0; if (set) { uow.Commit(); var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "You have successfully saved your profile. Proceed to Step 3 by clicking NEXT below!"); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); } else { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "Please select your Favorite Tour or Favorite Live Show"); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetWarningScript()); } } }
private void DeleteShow(Guid showId) { var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>()); var myShow = myShowService.GetMyShow(showId, userId); myShowService.DeleteCommit(myShow); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(showId); if (show != null) { var shows = myShowService.GetShowsFromMyShowsForUser(userId); rptShows.DataSource = shows; rptShows.DataBind(); } }
public void lnkAddMyShow_Click(object sender, EventArgs e) { var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>()); Guid userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); var showId = new Guid(hdnShowId.Value); var show = showService.GetShow(showId); var myShow = myShowService.GetMyShow(showId, userId); if (myShow != null) { //phAlreadyAdded.Visible = true; return; } var newMyShow = new MyShow { CreatedDate = DateTime.Now, MyShowId = Guid.NewGuid(), ShowId = showId, UserId = userId }; bool success = false; myShowService.SaveCommit(newMyShow, out success); if (success) { BindWithShowId(showId); } else { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "There was a problem adding this show. If this happens again, then please contact the administrator."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript()); } }
public override void ProcessRequest(HttpContextBase context) { HttpRequestBase request = context.Request; var showIdStr = request.QueryString["s"]; var showDateStr = request.QueryString["d"]; HttpResponseBase response = context.Response; var final = string.Empty; if (EmptyNullUndefined(showIdStr) && EmptyNullUndefined(showDateStr)) { final = GetNoImagesFound(); response.ContentType = "application/json"; response.ContentEncoding = Encoding.UTF8; response.Write(final); response.End(); } var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); if (string.IsNullOrEmpty(showIdStr)) { DateTime date; var success = DateTime.TryParse(showDateStr, out date); if (!success) { return; } var s = showService.GetShow(date); if (s == null) { return; } showIdStr = s.ShowId.ToString(); } var showId = new Guid(showIdStr); IPhotoRepository photoRepo = new PhotoRepository(new PhishDatabase(new ConnectionString(new AppConfigManager(), connKey))); PhotoService photoService = new PhotoService(photoRepo); var photos = photoService.GetPhotosByShow(showId).Where(x => x.Thumbnail == false).ToList(); if (photos == null || photos.Count <= 0) { final = GetNoImagesFound(); } if (string.IsNullOrEmpty(final)) { var json = new ImageJSONifier("records"); foreach (var photo in photos) { var path = (PhotoType)photo.Type != PhotoType.TicketStub ? ShowImagesFolder : TicketStubImagesFolder; json.Add(new ImageItem { Image = path + photo.FileName, Description = photo.Notes, Title = photo.NickName, //Thumb = //This is a consideration. If we want to go through the trouble of using the thumb or not }); } final = json.GetFinalizedJSON(); } response.ContentType = "application/json"; response.ContentEncoding = Encoding.UTF8; response.Write(final); }
public IActionResult Get([FromRoute] int id) { var data = _showService.GetShow(id, true, true); return(Ok(data)); }
public override void ProcessRequest(HttpContextBase context) { HttpRequestBase request = context.Request; var sDate = request.QueryString["s"]; var uId = request.QueryString["u"]; var st = request.QueryString["st"]; HttpResponseBase response = context.Response; Guid userId; DateTime showDate; int status = 0; bool success = false; string final; bool displayAttended = false; int displayStatus = 0; //Get the show date, user id, and status from the request and parse them into concrete types if (!(DateTime.TryParse(sDate, out showDate) && Guid.TryParse(uId, out userId) && int.TryParse(st, out status))) { return; } var listenedShowService = Ioc.GetInstance <IListenedShowService>();; var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(showDate); //see if the user has an entry for this show yet var listenedShow = listenedShowService.GetByUserAndShowId(userId, show.Id); //Setup the JSON Builder var jsonifier = new BasicJSONifier("records", "Question", "Answer"); //If status is EditNotes don't do anything and just get out of here if (status == (int)ListenedStatus.EditNotes) { return; } try { //If the user has one then update it if (listenedShow != null) { //if ( status != (int)ListenedStatus.EditNotes ) { using (IUnitOfWork uow = UnitOfWork.Begin()) { if (status != (int)ListenedStatus.Attended) { var prevStatus = listenedShow.Status; if (status == (int)ListenedStatus.EditNotes) { status = prevStatus; } listenedShow.Status = status; listenedShow.UpdatedDate = Constants.Now(); //For display purposes on Main. displayAttended = listenedShow.Attended; //This needs to be here because if edit notes is the status we need to make sure we take the previous status displayStatus = status; writer.Write(string.Format("Updating listenedShow with Id:{0}, from the status: {1}, to the status: {2}", listenedShow.Id, prevStatus, status)); } else { //What it was before, make it the opposite listenedShow.Attended = !listenedShow.Attended; listenedShow.UpdatedDate = Constants.Now(); //For display purposes on Main. displayAttended = listenedShow.Attended; //This needs to be here b/c we don't know what old status was otherwise displayStatus = listenedShow.Status; writer.Write("Updating listenedShow with Id:" + listenedShow.Id + "with Attended = " + !listenedShow.Attended); } uow.Commit(); success = true; writer.Write("Successfully updated listenedShow id: " + listenedShow.Id); } //} } else { //If the user does not have one then create it var objectFactory = Ioc.GetInstance <IDomainObjectFactory>(); bool attended; if (status == (int)ListenedStatus.Attended) { attended = true; } else { attended = false; } var newListenedShow = objectFactory.CreateListenedShow(show.Id, userId, show.ShowDate.Value, status, string.Empty, attended); displayAttended = attended; displayStatus = status; writer.Write(string.Format("Saving a new listenedShow with Id:{0} with a status of {1}, and attended is {2}", newListenedShow.Id, status, attended)); listenedShowService.SaveCommit(newListenedShow, out success); if (success) { writer.Write("Successfully saved the new listenedShow with id: " + newListenedShow.Id); } } } catch (Exception ex) { writer.WriteFatal("There was an error saving a listenedShow. The exception is: " + ex.Message); success = false; } if (success) { jsonifier.Add("success", "true"); jsonifier.Add("attended", displayAttended.ToString()); jsonifier.Add("status", displayStatus.ToString()); } else { jsonifier.Add("success", "false"); } final = jsonifier.GetFinalizedJSON(); response.ContentType = "application/json"; response.ContentEncoding = Encoding.UTF8; response.Write(final); response.End(); }
private void Bind() { if (string.IsNullOrEmpty(Request.QueryString["showId"]) && string.IsNullOrEmpty(Request.QueryString["showDate"])) { Response.Redirect(LinkBuilder.DashboardLink()); } var showIdStr = Request.QueryString["showId"]; var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); if (string.IsNullOrEmpty(showIdStr)) { DateTime date; var success = DateTime.TryParse(Request.QueryString["showDate"], out date); if (!success) { return; } var s = showService.GetShow(date); if (s == null) { return; } showIdStr = s.ShowId.ToString(); } var showId = new Guid(showIdStr); ShowId = showId; var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>()); //var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>()); //var analysisService = new AnalysisService(Ioc.GetInstance<IAnalysisRepository>()); var ticketStubService = new TicketStubService(Ioc.GetInstance <ITicketStubRepository>()); BindReviews(showId, ref myShowService); var show = (Show)showService.GetShow(showId); SetPageTitle("Review of " + show.GetShowName()); ShowName = show.GetShowName(); //var ss = (from set in show.Sets.OrderBy(x => x.SetNumber) // from song in setSongService.GetSetSongsBySet(set.SetId).OrderBy(z => z.Order).DefaultIfEmpty() // from analysis in analysisService.GetAnalysisBySetSongAndUser(song.SetSongId, userId).DefaultIfEmpty() // select new { Set = set, Song = song, Analysis = analysis }).ToList(); ////SlideShowExtender1.ContextKey = showId.ToString(); //rptSongs.DataSource = ss; //rptSongs.DataBind(); var ticketStub = (TicketStub)ticketStubService.GetByShow(showId).FirstOrDefault(); if (ticketStub == null) { return; } phTicketStub.Visible = true; imgTicketStub.ImageUrl = LinkBuilder.GetTicketStubLink(ticketStub.Photo.FileName); }
private void Bind() { Guid showId; IMyShow myShow; var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); if (string.IsNullOrEmpty(Request.QueryString["showId"])) { Response.Redirect(LinkBuilder.DashboardLink()); } showId = new Guid(Request.QueryString["showId"]); ShowId = showId; hdnShowId.Value = showId.ToString(); var myShowService = new MyShowService(Ioc.GetInstance <IMyShowRepository>()); if (!string.IsNullOrEmpty(Request.QueryString["myShowId"])) { var myShowId = new Guid(Request.QueryString["myShowId"]); myShow = myShowService.GetMyShow(myShowId); } else { myShow = myShowService.GetMyShow(showId, userId); } if (myShow != null) { hdnMyShowId.Value = myShow.MyShowId.ToString(); ajaxShowRating.CurrentRating = myShow.Rating == null ? 0 : int.Parse(myShow.Rating.Value.ToString()); ajaxBustoutRating.CurrentRating = myShow.BustoutRating == null ? 0 : int.Parse(myShow.BustoutRating.Value.ToString()); ajaxEnergyRating.CurrentRating = myShow.EnergyRating == null ? 0 : int.Parse(myShow.EnergyRating.Value.ToString()); ajaxFlowRating.CurrentRating = myShow.FlowRating == null ? 0 : int.Parse(myShow.FlowRating.Value.ToString()); ajaxSegueRating.CurrentRating = myShow.SegueRating == null ? 0 : int.Parse(myShow.SegueRating.Value.ToString()); ajaxType1JamRating.CurrentRating = myShow.Type1JamRating == null ? 0 : int.Parse(myShow.Type1JamRating.Value.ToString()); ajaxType2JamRating.CurrentRating = myShow.Type2JamRating == null ? 0 : int.Parse(myShow.Type2JamRating.Value.ToString()); txtFree.Text = myShow.Notes; phMyShow.Visible = true; phMyShowRating.Visible = true; phNotMyShow.Visible = false; } //var setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>()); var setService = new SetService(Ioc.GetInstance <ISetRepository>()); //var analysisService = new AnalysisService(Ioc.GetInstance<IAnalysisRepository>()); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var show = showService.GetShow(showId); SetPageTitle("Analyze " + show.GetShowName()); lblShow.Text = show.GetShowName(); //var sets = setService.GetSetsForShow(showId).ToList(); //sets NEEDS to be a list here! DO NOT CHANGE DAN! //var ss = (from set in sets // from song in setSongService.GetSetSongsBySet(set.SetId).OrderBy(z => z.Order.Value).DefaultIfEmpty() // from analysis in analysisService.GetAnalysisBySetSongAndUser(song.SetSongId, userId).DefaultIfEmpty() // select new { Set = set, Song = song, Analysis = analysis }).ToList(); //rptSongs.DataSource = ss; //rptSongs.DataBind(); }
public static List <FavoriteSetSong> GenerateFavoriteVersionListByAlbum(string album) { var songService = new SongService(Ioc.GetInstance <ISongRepository>()); var setSongService = new SetSongService(Ioc.GetInstance <ISetSongRepository>()); var favoriteVersionService = new FavoriteVersionService(Ioc.GetInstance <IFavoriteVersionRepository>()); var showService = new ShowService(Ioc.GetInstance <IShowRepository>()); var setService = new SetService(Ioc.GetInstance <ISetRepository>()); FavoriteVersionSongList songList = new FavoriteVersionSongList(); foreach (var song in songService.GetSongsByAlbum(album)) { var versions = favoriteVersionService.GetAllFavoriteVersions().Where(s => s.SongId == song.SongId).GroupBy(g => g.SetSongId).ToList(); if (versions == null || versions.Count() <= 0) { songList.AddFavoriteSongPair(null, SetSong.FromSong((Song)song), null); continue; } if (versions.Count() == 1) { var version = versions[0].First(); var setSong = setSongService.GetSetSong(version.SetSongId.Value); var set = setService.GetSet(setSong.SetId.Value); var show = showService.GetShow(set.ShowId.Value); songList.AddFavoriteSongPair((FavoriteVersion)version, (SetSong)setSong, (Show)show); } else { int count = 0; Guid? setSongId = null; FavoriteVersion fave = null; SetSong setSong = null; IShow show = null; foreach (var version in versions) { if (version.Count() > count) { fave = (FavoriteVersion)version.First(); setSongId = version.First().SetSongId; } } if (setSongId != null) { setSong = (SetSong)setSongService.GetSetSong(setSongId.Value); var set = setService.GetSet(setSong.SetId.Value); show = showService.GetShow(set.ShowId.Value); } songList.AddFavoriteSongPair(fave, setSong ?? SetSong.FromSong((Song)song), (Show)show); } } return(songList.SongList); }