예제 #1
0
 public plane(int idThisPlane, Modele.ORM.type thisType, Modele.ORM.crew thisCrew, Modele.ORM.warehouse thisWarehouse, bool thisStatus)
 {
     IdPlane   = idThisPlane;
     Type      = thisType;
     Crew      = thisCrew;
     Warehouse = thisWarehouse;
     Status    = thisStatus;
 }
예제 #2
0
        //Select statement
        public static Modele.ORM.crew getCrew(int idCrew)


        {
            Modele.ORM.crew Crew  = null;
            string          query = "SELECT * FROM type where id=@crew;";


            //Open connection
            ConnexionWorkBench connection = new ConnexionWorkBench();

            if (connection.OpenConnection() == true)

            {
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection.GetConnection());

                //shield sql injection
                cmd.Parameters.AddWithValue("@crew", idCrew);

                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader.Read())
                {
                    Crew = new Modele.ORM.crew(
                        dataReader.GetInt32(0),
                        dataReader.GetInt32(1)
                        );
                }

                //close Data Reader
                dataReader.Close();

                //close Connection
                connection.CloseConnection();

                //return list to be displayed
                return(Crew);
            }
            else
            {
                return(Crew);
            }
        }