// view service history button private void button5_Click(object sender, EventArgs e) { List <Record> history = f.ViewServiceHistory(id); ViewServiceHistory viewHistory = new ViewServiceHistory(history); viewHistory.Show(); }
private void button2_Click(object sender, EventArgs e) { try { int vehicleId = int.Parse(VehicleIDText.Text); object o = _data.GetVehicleByID(vehicleId); if (o != null) { if ((o.GetType()).Equals(typeof(Car))) { ViewServiceHistory viewServiceHistory = new ViewServiceHistory(((Car)o).History.PrintServiceHistory()); viewServiceHistory.Show(); return; } else if ((o.GetType()).Equals(typeof(Truck))) { ViewServiceHistory viewServiceHistory = new ViewServiceHistory(((Car)o).History.PrintServiceHistory()); viewServiceHistory.Show(); return; } } } catch { MessageBox.Show("Vehicle doesn't exist "); } }