Beispiel #1
0
        public void List()
        {
            IList <Motorbike> motorbikeList = motorbikeServicesObj.GetAll();

            foreach (Motorbike selectedMotorbike in motorbikeList)
            {
                PrintInfo(selectedMotorbike, true);
            }
        }
        public void FillMotorbikeList()
        {
            IList <Motorbike> allMotorbikes = motorbikeServicesObj.GetAll();

            motorbikeList.Items.Clear();

            foreach (var currentMotorbike in allMotorbikes)
            {
                ListViewItem motorbikeItem = new ListViewItem(currentMotorbike.vehicleName);
                motorbikeItem.SubItems.Add(currentMotorbike.numberPlate);
                motorbikeItem.SubItems.Add(string.Format("{0} kg",
                                                         decimal.Round(currentMotorbike.weight.kilograms, 2)));
                motorbikeItem.SubItems.Add(string.Format("{0}/{1} l",
                                                         decimal.Round(currentMotorbike.currentFuel.litres, 2),
                                                         decimal.Round(currentMotorbike.maximumFuel.litres, 2)));
                motorbikeItem.SubItems.Add(string.Format("{0} mpg",
                                                         decimal.Round(currentMotorbike.milage.milesPerGallon, 2)));
                motorbikeItem.SubItems.Add(string.Format("{0}/{1}",
                                                         currentMotorbike.passengers.Count,
                                                         currentMotorbike.maximumPassengers));
                motorbikeItem.SubItems.Add((currentMotorbike.sideCar) ? "True" : "False");
                motorbikeList.Items.Add(motorbikeItem);
            }
        }