Esempio n. 1
0
 private void output(string parameter)
 {
     if (string.IsNullOrEmpty(parameter))
     {
         foreach (var item in this.selectedVehicles)
         {
             console.WriteLine(VehicleStringCreator.GetOutputString(item.Key) + $" Parkhaus: {item.Value?.Garage.City}, {item.Value?.Garage.Zip}, {item.Value?.Garage.Street}, Parkplatz: {item.Value?.ParkingPlace.Id}");
         }
     }
     else if (parameter.StartsWith(" v "))
     {
         parameter = parameter.Replace(" v ", "");
         var data = "";
         foreach (var item in this.selectedVehicles)
         {
             data += VehicleStringCreator.GetOutputString(item.Key) + "\r\n";
         }
         file.WriteLine(parameter, data);
         console.WriteInfo($"Ausgabe in Datei: {parameter}");
     }
     else
     {
         var data = "";
         foreach (var item in this.selectedVehicles)
         {
             data += VehicleStringCreator.GetOutputString(item.Key) + $" Parkhaus: {item.Value?.Garage.City}, {item.Value?.Garage.Zip}, {item.Value?.Garage.Street}, Parkplatz: {item.Value?.ParkingPlace.Id} \r\n";
         }
         file.WriteLine(parameter, data);
         console.WriteInfo($"Ausgabe in Datei: {parameter}");
     }
     if (this.selectedVehicles.Count == 0)
     {
         console.WriteInfo("Es wurden keine Fahrzeuge ausgewählt.");
     }
 }
Esempio n. 2
0
        public Vehicle Parse(IConsoleInputOutput console, string parameter)
        {
            string str;

            if (parameter == "c")
            {
                console.WriteLine("Geben Sie den PKW in folgendem Format ein:");
                console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Hubraum, Leistung, Schadstoffklasse [0-schadstoffarm, 1-normal, 2-Diesel] ");
                str = console.ReadLine();
                var propertyStrings = str.Split(',');
                if (propertyStrings.Count() == 8)
                {
                    return(Parse(propertyStrings, parameter));
                }
            }
            else if (parameter == "m")
            {
                console.WriteLine("Geben Sie das Motorrad in folgendem Format ein:");
                console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Hubraum");
                str = console.ReadLine();
                var propertyStrings = str.Split(',');
                if (propertyStrings.Count() == 6)
                {
                    return(Parse(propertyStrings, parameter));
                }
            }
            else if (parameter == "t")
            {
                console.WriteLine("Geben Sie den LKW in folgendem Format ein:");
                console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Anzahl der Achsen, Zuladung in t ");
                str = console.ReadLine();
                var propertyStrings = str.Split(',');
                if (propertyStrings.Count() == 7)
                {
                    return(Parse(propertyStrings, parameter));
                }
            }
            return(null);
        }
Esempio n. 3
0
 public Vehicle Parse(IConsoleInputOutput console, string parameter, out int parkingPlaceId)
 {
     parkingPlaceId = 0;
     string[] propertyStrings = null;
     if (parameter == "c")
     {
         console.WriteLine("Geben Sie den PKW in folgendem Format ein:");
         console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Hubraum, Leistung, Schadstoffklasse [0-schadstoffarm, 1-normal, 2-Diesel], Parkplatznummer ");
         propertyStrings = this.preParse(console, 923, out parkingPlaceId);
     }
     else if (parameter == "m")
     {
         console.WriteLine("Geben Sie das Motorrad in folgendem Format ein:");
         console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Hubraum, Parkplatznummer");
         propertyStrings = this.preParse(console, 7, out parkingPlaceId);
     }
     else if (parameter == "t")
     {
         console.WriteLine("Geben Sie den LKW in folgendem Format ein:");
         console.WriteInfo("Hersteller, Modell, Kennzeichen, Jahr der Erstzulassung, Anschaffungspreis, Anzahl der Achsen, Zuladung in t, Parkplatznummer ");
         propertyStrings = this.preParse(console, 8, out parkingPlaceId);
     }
     return(this.Parse(propertyStrings, parameter));
 }
Esempio n. 4
0
        public Garage Parse(IConsoleInputOutput console, out uint count)
        {
            console.WriteLine("Geben Sie das Parkhaus in folgendem Format ein:");
            console.WriteInfo("Ort, Plz, Straße & Nummer, Anzahl der Parkplätze");
            var str             = console.ReadLine();
            var propertyStrings = str.Split(',');

            count = (uint)propertyStrings.Count();
            if (count == 4)
            {
                uint.TryParse(propertyStrings[count - 1], out count);
                return(new Garage()
                {
                    City = propertyStrings[0],
                    Zip = propertyStrings[1],
                    Street = propertyStrings[2]
                });
            }
            return(null);
        }