protected void btnTramstatusAanpassen_Click(object sender, EventArgs e) { try { int tramnummer = Convert.ToInt32(ddlTramstatusAanpassenTramnummer.Text); string status = ddlTramstatusAanpassenStatus.Text; Tram tram = bc.GetTramByNummer(tramnummer); if (status == "vervuild") { bc.TramStatusAanpassen(tram, true, tram.Defect); } else if (status == "defect") { bc.TramStatusAanpassen(tram, tram.Vervuild, true); } else if (status == "beschikbaar") { bc.TramStatusAanpassen(tram, false, false); } else { // geef status aan. } Response.Redirect(Request.RawUrl); } catch (Exception ex) { string script = "alert(\" " + ex.Message + "\");"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); } }
private void btnStatusAanpassen_Click(object sender, EventArgs e) { if (cbTramnummerTramstatusAanpassen.SelectedItem != null && cbTramstatusTramstatusAanpassen.SelectedItem != null) { Tram tram = bc.GetTramByNummer(Convert.ToInt32(cbTramnummerTramstatusAanpassen.SelectedItem.ToString())); if (tram.Status == (TramStatus)cbTramstatusTramstatusAanpassen.SelectedItem) { MessageBox.Show("Deze tram heeft al de geselecteerde status."); } else { MessageBox.Show(bc.TramStatusAanpassen(tram, (TramStatus)cbTramstatusTramstatusAanpassen.SelectedItem)); } } else { MessageBox.Show(errorselect); } }