protected void ddlSectorReserverenSpoor_SelectedIndexChanged(object sender, EventArgs e) { int spoornummer = Convert.ToInt32(ddlSpoorReserverenSpoor.SelectedItem.Text); Spoor selectedSpoor = bc.GetSpoorByNummer(spoornummer); if (selectedSpoor == null) { Response.Write("Selectedspoor " + spoornummer + " is null"); return; } }
protected void btnSpoorReserveren_Click(object sender, EventArgs e) { try { bc = new BeheerController(); int spoornummer = Convert.ToInt32(ddlSpoorReserverenSpoor.SelectedItem.Text); int tramnummer = Convert.ToInt32(ddlSpoorReserverenTram.SelectedItem.Text); Spoor s = bc.GetSpoorByNummer(spoornummer); Tram t = bc.GetTramByNummer(tramnummer); bc.SpoorReserveren(s, t); Response.Redirect(Request.RawUrl); } catch (Exception ex) { string script = "alert(\" " + ex.Message + "\");"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); } }
private void btnToggleBlokkeren_Click(object sender, EventArgs e) { if (cbSpoorSectorblokkeren.SelectedItem != null && cbSectorSectorblokkeren.SelectedItem != null) { int spoornr = Convert.ToInt32(cbSpoorSectorblokkeren.SelectedItem.ToString()); int sectorid = Convert.ToInt32(cbSectorSectorblokkeren.SelectedItem.ToString()); Spoor spoor = bc.GetSpoorByNummer(spoornr); if (spoor != null) { MessageBox.Show(bc.ToggleSector(bc.GetSectorByID(spoor, sectorid))); } else { MessageBox.Show("Spoor kon niet worden getoggled"); } } else { MessageBox.Show("Niet alle vereiste informatie geselecteerd."); } }