protected void btnSpoorBlokkerenDeblokkeren_Click(object sender, EventArgs e) { try { Spoor s = bc.GetSpoorByNummer(Convert.ToInt32(ddlSpoorBlokkeren.SelectedItem.Text)); foreach (Sector sector in s.Sectoren) { bc.ToggleSector(sector); } 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."); } }