/// <summary> /// Handles the SaveClick event of the dlgAddCalendarItemPage3 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void dlgAddCalendarItemPage3_SaveClick(object sender, EventArgs e) { // Save selection to hidden field using (var rockContext = new RockContext()) { int?eventItemOccurrenceId = ddlCalendarItemOccurrence.SelectedValueAsInt(); if (eventItemOccurrenceId.HasValue) { var eventItemOccurrence = new EventItemOccurrenceService(rockContext) .Queryable("EventItem,Campus").AsNoTracking() .Where(c => c.Id == eventItemOccurrenceId.Value) .FirstOrDefault(); if (eventItemOccurrence != null) { hfLinkageEventItemOccurrenceId.Value = eventItemOccurrence.Id.ToString(); lLinkageEventItemOccurrence.Text = eventItemOccurrence.ToString(); lbLinkageEventItemOccurrenceAdd.Visible = false; lbLinkageEventItemOccurrenceRemove.Visible = true; } } } HideDialog(); }
/// <summary> /// Handles the SaveClick event of the dlgAddCalendarItemPage3 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void dlgAddCalendarItemPage3_SaveClick( object sender, EventArgs e ) { // Save selection to hidden field using ( var rockContext = new RockContext() ) { int? eventItemOccurrenceId = ddlCalendarItemOccurrence.SelectedValueAsInt(); if ( eventItemOccurrenceId.HasValue ) { var eventItemOccurrence = new EventItemOccurrenceService( rockContext ) .Queryable( "EventItem,Campus" ).AsNoTracking() .Where( c => c.Id == eventItemOccurrenceId.Value ) .FirstOrDefault(); if ( eventItemOccurrence != null ) { hfLinkageEventItemOccurrenceId.Value = eventItemOccurrence.Id.ToString(); lLinkageEventItemOccurrence.Text = eventItemOccurrence.ToString(); lbLinkageEventItemOccurrenceAdd.Visible = false; lbLinkageEventItemOccurrenceRemove.Visible = true; } } } HideDialog(); }