Ejemplo n.º 1
0
        public List<Veichles> readVeichles()
        {
            List<Veichles> displayVeichles = new List<Veichles>();
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                using (NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM printVeichles()", conn))
                {
                    NpgsqlDataReader reader = com.ExecuteReader();

                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);
                        string type = reader.GetString(1);
                        int year = reader.GetInt32(2);
                        string model = reader.GetString(3);
                        string make = reader.GetString(4);
                        string place = reader.GetString(5);

                        Veichles reading = new Veichles(id, type, year, make, model, place);

                        displayVeichles.Add(reading);
                    }
                }
                return displayVeichles;
            }
        }
Ejemplo n.º 2
0
        public void updateMake(Veichles update)
        {
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                NpgsqlCommand com = new NpgsqlCommand("SELECT  updateMake(" + update.makeID + ", '" + update.model + "');", conn);

                com.ExecuteNonQuery();
                transaction.Commit();
            }
        }
Ejemplo n.º 3
0
        public void deleteMake(Veichles remove)
        {
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                NpgsqlCommand com = new NpgsqlCommand("SELECT deleteMake(" + remove.id + ")", conn);

                com.ExecuteNonQuery();
                transaction.Commit();
            }
        }
Ejemplo n.º 4
0
        public void addMake(Veichles add)
        {
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                NpgsqlCommand com = new NpgsqlCommand("SELECT  addMakeModel('" + add.make + "', '" + add.model + "', " + add.makeID + ");", conn);

                com.ExecuteNonQuery();
                transaction.Commit();
            }
        }
Ejemplo n.º 5
0
        public void updateVeichle(Veichles update)
        {
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                NpgsqlCommand com = new NpgsqlCommand("SELECT  updateVeichle(" + update.id + ", '" + update.type +
                    "', " + update.yearOfMake + ", " + update.modelID + ", " + update.placeID + ");", conn);

                com.ExecuteNonQuery();
                transaction.Commit();
            }
        }
Ejemplo n.º 6
0
        public void addVeichle(Veichles add)
        {
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                NpgsqlCommand com = new NpgsqlCommand("SELECT  addVeichles('" + add.type + "', " + add.yearOfMake
                    + ", " + add.modelID + ", " + add.placeID + ");", conn);

                com.ExecuteNonQuery();
                transaction.Commit();
            }
        }
Ejemplo n.º 7
0
        public List<Veichles> readMakes()
        {
            List<Veichles> displayMakes = new List<Veichles>();
            using (NpgsqlTransaction transaction = conn.BeginTransaction())
            {
                using (NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM printMakes()", conn))
                {
                    // com.CommandText = "SELECT printPlaces()";
                    NpgsqlDataReader reader = com.ExecuteReader();

                    while (reader.Read())
                    {
                        int id = reader.GetInt32(0);
                        string make = reader.GetString(1);

                        Veichles reading = new Veichles(id, make);

                        displayMakes.Add(reading);
                    }
                }
                return displayMakes;
            }
        }