private void LoadVehiclesToStackPanel()
        {
            SpVehicles.Children.Clear();

            List <Vehicle> vehicles = vehiclesSqlRepository.ReadAll();

            foreach (Vehicle vehicle in vehicles)
            {
                VehiclePanel vehiclePanel = new VehiclePanel(vehicle);

                SpVehicles.Children.Add(vehiclePanel);
            }
        }
Пример #2
0
        private XmlWriter WriteVehicles(XmlWriter xmlWriter)
        {
            List <Vehicle> vehicles = vehiclesSqlRepository.ReadAll();

            xmlWriter.WriteStartElement("Vehicles");

            foreach (Vehicle vehicle in vehicles)
            {
                xmlWriter.WriteStartElement("Vehicle");
                xmlWriter.WriteAttributeString("Id", vehicle.Id.ToString());

                xmlWriter.WriteStartElement("Make");
                xmlWriter.WriteString(vehicle.Make);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("Model");
                xmlWriter.WriteString(vehicle.Model);
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("YearOfManufacture");
                xmlWriter.WriteString(vehicle.YearOfManufacture.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("InitialMileage");
                xmlWriter.WriteString(vehicle.InitialMileage.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteStartElement("Available");
                xmlWriter.WriteString(vehicle.Available.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteEndElement();

            return(xmlWriter);
        }
 private void LoadVehiclesToComboBox()
 {
     CbVehicles.ItemsSource = vehiclesSqlRepository.ReadAll();
 }
 private void LoadVehiclesToComboBox()
 {
     CbVehicles.ItemsSource = vehiclesSqlRepository.ReadAll().Where(v => v.Available != false);
 }