Пример #1
0
        public void AddAirline(string departedDaT, string arrivedDaT, string departedCity, string arrivedCity,
                               int terminalNumber, int gateNumber, byte plane)
        {
            var number = _helpers.NumberGenerator <Airline>(Airlines);

            Airlines.Add(number, new Airline(number, departedDaT, arrivedDaT, departedCity, arrivedCity, terminalNumber, gateNumber, (PlaneEnum)plane));
        }
        private void ParseAirlines()
        {
            Airlines.Clear();

            using (var reader = new StreamReader(string.Format(PathToData, "airlines.csv")))
                using (var csv = new CsvReader(reader))
                {
                    csv.Read();
                    csv.ReadHeader();
                    while (csv.Read())
                    {
                        var airline = new Airline
                        {
                            Name           = csv.GetField("Name"),
                            IATADesignator = csv.GetField("2 Digit Code"),
                            ICAODesignator = csv.GetField("3 Digit Code"),
                            Country        = csv.GetField("Country")
                        };

                        Airlines.Add(airline);
                    }
                }
        }