private void button3_Click(object sender, EventArgs e) { int x; bool t = int.TryParse(txtTrainID.Text, out x); if (t) { var train = TrainHandling.GetTrainById(x); if (train == null) { MessageBox.Show("Invalid Train ID"); } else { bool z = TrainHandling.RemoveTrain(x); if (z) { MessageBox.Show("Train Removed Successfully"); } else { MessageBox.Show("Train hasn't been Removed Successfully"); } } } }
private void button2_Click(object sender, EventArgs e) { int x; bool t = int.TryParse(txtTrainID.Text, out x); if (t) { var train = TrainHandling.GetTrainById(x); if (train == null) { MessageBox.Show("Invalid Train ID"); } else { EditTrain tr = new EditTrain(); tr.Init(x, train.StartingStation, train.EndingStation, train.DepartureDate, train.ArrivalDate, train.NumberOfCars); tr.Show(); } } else { MessageBox.Show("Invalid Train ID"); } }