Beispiel #1
0
        public List <Airline_Company> Reader(string query, string function)
        {
            List <Airline_Company> allAirlineCompanies = new List <Airline_Company>();

            try
            {
                using (NpgsqlConnection connection = new NpgsqlConnection(Fligth_CenterAppConfig.ConnectionString))
                {
                    connection.Open();
                    using (NpgsqlCommand command = new NpgsqlCommand(_sp_name, connection))
                    {
                        command.CommandText =
                            using (NpgsqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Airline_Company a_c = new Airline_Company()
                                {
                                    Id   = (long)reader["id"],
                                    Name = (string)reader["name"],
                                };
                                allAirlineCompanies.Add(a_c);
                            }
                            return(allAirlineCompanies);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Fligth_CenterAppConfig._log.Error($"Connection failed.Exception: {ex}");
                Console.WriteLine($"Connection failed.Exception: {ex}");
                Console.ReadKey();
                Environment.Exit(-1);
                return(null);
            }
        }
Beispiel #2
0
 public void Update(Airline_Company t)
 {
     throw new NotImplementedException();
 }
Beispiel #3
0
 public void Add(Airline_Company t)
 {
     _sp_name = "sp_insert_company";
     NonReader(_sp_name);
 }