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 yearSelector_YearSelected(object sender, PhishPond.Concrete.EventArgs.SelectYearCommandEventArgs e) { var year = e.Year; var showService = new ShowService(Ioc.GetInstance<IShowRepository>()); var show = showService.GetShowsByYear(year); var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", show.First().GetShowName()); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); }
private IMyShow GetMyShow(string myShowIdStr) { ResetPanels(); if (string.IsNullOrEmpty(hdnMyShowId.Value)) { var scriptHelper3 = new ScriptHelper("ErrorAlert", "alertDiv", "There was an error saving your review."); Page.RegisterStartupScript(scriptHelper3.ScriptName, scriptHelper3.GetFatalScript()); return null; } var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>()); var myShowId = new Guid(myShowIdStr); return myShowService.GetMyShow(myShowId); }
public void btnSubmit_Click(object sender, EventArgs e) { FavoriteVersionService faveService = new FavoriteVersionService(Ioc.GetInstance<IFavoriteVersionRepository>()); Guid userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); if (string.IsNullOrEmpty(ddlFavoriteChoice.SelectedValue)) return; Guid setSongId = new Guid(ddlFavoriteChoice.SelectedValue.Split('^')[0]); Guid songId = new Guid(ddlFavoriteChoice.SelectedValue.Split('^')[1]); var fave = faveService.GetFavoriteVersionByUserIdAndSongId(userId, songId); bool success = false; if (fave != null) { using (IUnitOfWork uow = UnitOfWork.Begin()) { fave.SetSongId = setSongId; fave.UpdatedDate = DateTime.Now; uow.Commit(); success = true; } } else { FavoriteVersion faveVersion = new FavoriteVersion { FavoriteVersionId = Guid.NewGuid(), SetSongId = setSongId, SongId = songId, UserId = userId }; faveService.SaveCommit(faveVersion, out success); } if (success) { var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "Congratulations you have added a favorite version"); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); btnChooseAlbum_Click(null, null); } else { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "Sorry an error has occurred saving your favorite version"); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript()); } }
public void btnSubmit_Click(object sender, EventArgs e) { ResetPanels(); bool compiledSuccess = true; if (!AnyInputHasFile()) { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "Please choose a file to upload."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript()); return; } var errorMessage = string.Empty; using (IUnitOfWork uow = UnitOfWork.Begin()) { var fileList = GetFileList(); foreach (var file in fileList) { var validator = ProcessFile(file); compiledSuccess = compiledSuccess && validator.Success; if (!compiledSuccess) { errorMessage = validator.Message; break; } } if (!compiledSuccess) { var scriptHelper3 = new ScriptHelper("ErrorAlert", "alertDiv", errorMessage + "Please try again without that image."); Page.RegisterStartupScript(scriptHelper3.ScriptName, scriptHelper3.GetFatalScript()); return; } var scriptHelper2 = new ScriptHelper("SuccessAlert", "alertDiv", "You have successfully saved the image"); Page.RegisterStartupScript(scriptHelper2.ScriptName, scriptHelper2.GetSuccessScript()); uow.Commit(); } }
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()); } }
private void ShowNotSelectedMessage() { var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "To add pictures please click a year and then choose a show."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript()); }
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()); } } }
public void btnSubmitShowNotes_Click(object sender, EventArgs e) { ResetPanels(); if (string.IsNullOrEmpty(hdnMyShowId.Value)) { var scriptHelper3 = new ScriptHelper("ErrorAlert", "alertDiv", "There was an error saving your review."); Page.RegisterStartupScript(scriptHelper3.ScriptName, scriptHelper3.GetFatalScript()); return; } var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>()); var myShowId = new Guid(hdnMyShowId.Value); var myShow = myShowService.GetMyShow(myShowId); using (IUnitOfWork uow = UnitOfWork.Begin()) { if (txtFree.Text.Length > 3000) { var scriptHelper2 = new ScriptHelper("ErrorAlert", "alertDiv", "Your review was too long. Please keep it under 3000 characters."); Page.RegisterStartupScript(scriptHelper2.ScriptName, scriptHelper2.GetFatalScript()); return; } myShow.Notes = txtFree.Text; myShow.NotesUpdatedDate = DateTime.Now; uow.Commit(); var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "Congratulations you have successfully saved a review for this show."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); } ShowId = new Guid(hdnShowId.Value); }
public void btnSubmit_Click(object sender, System.Web.UI.ImageClickEventArgs e) { using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin()) { var profile = (Profile)GetProfile(); profile.Name = txtName.Text; profile.Email = txtEmail.Text; if (ddlFavoriteYear.SelectedValue != "-1") profile.FavoriteYear = int.Parse(ddlFavoriteYear.SelectedValue); if (ddlFavorite3Year.SelectedValue != "-1") profile.Favorite3Year = int.Parse(ddlFavorite3Year.SelectedValue); if (ddlFavoriteSeason.SelectedValue != "-1") profile.FavoriteSeason = ddlFavoriteSeason.SelectedValue; if (ddlFavoriteRun.SelectedValue != "-1") profile.FavoriteRun = ddlFavoriteRun.SelectedValue; if (ddlFavoriteAlbums.SelectedValue != "-1") profile.FavoriteAlbum = new Guid(ddlFavoriteAlbums.SelectedValue); //if (ddlFavoriteStudioSong.SelectedValue != "-1") // profile.FavoriteStudioSong = new Guid(ddlFavoriteStudioSong.SelectedValue); uow.Commit(); } /// ADD THE PART BELOW TO THE SUCCESS MSG WHEN STEP 2 Comes back // Proceed to Step 2 by clicking NEXT below! var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "You have successfully saved your profile."); Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript()); }