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(); }
public void btnSubmit_Click(object sender, EventArgs e) { ResetPanels(); bool success = false; Guid?showId; Guid setId = Guid.NewGuid(); SetService service = new SetService(Ioc.GetInstance <ISetRepository>()); if (Validated()) { showId = ddlShows.SelectedValue != "-1" ? new Guid(ddlShows.SelectedValue) : EmptyGuid; short?setNum = ddlSetNumber.SelectedValue != "0" ? short.Parse(ddlSetNumber.SelectedValue) : (short)0; Set set = new Set() { SetId = setId, Encore = chkEncore.Checked, Notes = txtNotes.Text.Trim(), Official = chkOfficial.Checked, SetNumber = setNum == 0 ? null : setNum, ShowId = showId == EmptyGuid ? null : showId }; service.SaveCommit(set, out success); } if (success) { phSuccess.Visible = true; phError.Visible = false; phAddSongs.Visible = true; lnkAddSongsToSet.NavigateUrl = LinkBuilder.AddSongsToSetControlLink(setId, returnUrl); lnkAddSetToGuess.NavigateUrl = LinkBuilder.AddSetToGuessLink(setId); } else { phError.Visible = true; phSuccess.Visible = false; } }