Beispiel #1
0
        public static Vehicle getVehicleFromJob(string jobID)
        {
            Vehicle vehicle = new Vehicle();

            using (MySqlConnection con = new MySqlConnection(connection))
            {
                string query = "SELECT vrm FROM JobVehicle WHERE jobID = '" + jobID + "'";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    using (MySqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            vehicle = VehicleProvider.getVehicleFromVRM(sdr["vrm"].ToString());
                            break;
                        }
                    }

                    con.Close();
                }
            }

            return(vehicle);
        }
Beispiel #2
0
        public static List <Vehicle> getCustomerVehicles(string customerID)
        {
            List <Vehicle> vehicles = new List <Vehicle>();

            using (MySqlConnection con = new MySqlConnection(connection))
            {
                string query = "SELECT vrm FROM CustomersVehicles WHERE customerID = '" + customerID + "'";
                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Connection = con;
                    con.Open();
                    using (MySqlDataReader sdr = cmd.ExecuteReader())
                    {
                        while (sdr.Read())
                        {
                            vehicles.Add(VehicleProvider.getVehicleFromVRM(sdr["vrm"].ToString()));
                        }
                    }

                    con.Close();
                }
            }

            return(vehicles);
        }