public AjoutEchantillon()
        {
            InitializeComponent();
            TcT = new Test_Ctor_Teinte();
            EchRes = new Ech_Resultat();

            CBvehicule.DataSource = VehiculeDB.List();
            CBvehicule.DisplayMember = "Nom";
            CBvehicule.ValueMember = "Identifiant";
        }
        public static Test_Ctor_Teinte Get(Int32 ID_Test, Int32 ID_Teinte)
        {
            Test_Ctor_Teinte test_ctor_teinte = new Test_Ctor_Teinte();

            //Connection
            SqlConnection connection = DataBase.Connection();

            //Requete
            String requete = select + " WHERE ID_Test=@ID_Test AND ID_Teinte=@ID_Teinte;";

            //Commande
            SqlCommand commande = new SqlCommand(requete, connection);

            //Parametres
            commande.Parameters.AddWithValue("ID_Test", ID_Test);
            commande.Parameters.AddWithValue("ID_Teinte", ID_Teinte);

            //Execution
            try
            {
                connection.Open();

                SqlDataReader dataReader = commande.ExecuteReader();
                dataReader.Read();
                test_ctor_teinte.Identifiant = dataReader.GetInt32(0);
                test_ctor_teinte.Min = dataReader.GetDouble(1);
                test_ctor_teinte.Norme = dataReader.GetDouble(2);
                test_ctor_teinte.Max = dataReader.GetDouble(3);
                test_ctor_teinte.ID_Test = dataReader.GetInt32(4);
                test_ctor_teinte.ID_Constructeur = dataReader.GetInt32(5);
                test_ctor_teinte.ID_Teinte = dataReader.GetInt32(6);
                dataReader.Close();
                connection.Close();

            }
            catch (Exception)
            {
                test_ctor_teinte = null;
            }
            finally
            {
                connection.Close();
            }
            return test_ctor_teinte;
        }
        public static Boolean Update(Test_Ctor_Teinte test_ctor_teinte)
        {
            //Connection
            SqlConnection connection = DataBase.Connection();

            //Requete
            String requete = @"UPDATE Test_Ctor_Teinte
                               SET Min=@Min,Norme=@Norme,Max=@Max,ID_Test=@ID_Test,ID_Constructeur=@ID_Constructeur,ID_Teinte=@ID_Teinte
                               WHERE Identifiant=@Identifiant ;";

            //Commande
            SqlCommand commande = new SqlCommand(requete, connection);

            //Parametres
            commande.Parameters.AddWithValue("Identifiant", test_ctor_teinte.Identifiant);
            commande.Parameters.AddWithValue("Min", test_ctor_teinte.Min);
            commande.Parameters.AddWithValue("Norme", test_ctor_teinte.Norme);
            commande.Parameters.AddWithValue("Max", test_ctor_teinte.Max);
            commande.Parameters.AddWithValue("ID_Test", test_ctor_teinte.ID_Test);
            commande.Parameters.AddWithValue("ID_Constructeur", test_ctor_teinte.ID_Constructeur);
            commande.Parameters.AddWithValue("ID_Teinte", test_ctor_teinte.ID_Teinte);

            //Execution
            try
            {
                connection.Open();
                commande.ExecuteNonQuery();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                connection.Close();
            }
        }
        public static List<Test_Ctor_Teinte> List()
        {
            List<Test_Ctor_Teinte> listeTest_Ctor_Teinte = new List<Test_Ctor_Teinte>();

            //Connection
            SqlConnection connection = DataBase.Connection();

            //Requete
            String requete = select + ";";

            //Commande
            SqlCommand commande = new SqlCommand(requete, connection);

            //Parametres

            //Execution
            try
            {
                connection.Open();

                SqlDataReader dataReader = commande.ExecuteReader();
                dataReader.Read();

                while (dataReader.Read())
                {
                    Test_Ctor_Teinte test_ctor_teinte = new Test_Ctor_Teinte();
                    test_ctor_teinte.Identifiant = dataReader.GetInt32(0);
                    test_ctor_teinte.Min = dataReader.GetDouble(1);
                    test_ctor_teinte.Norme = dataReader.GetDouble(2);
                    test_ctor_teinte.Max = dataReader.GetDouble(3);
                    test_ctor_teinte.ID_Test = dataReader.GetInt32(4);
                    test_ctor_teinte.ID_Constructeur = dataReader.GetInt32(5);
                    test_ctor_teinte.ID_Teinte = dataReader.GetInt32(6);
                    listeTest_Ctor_Teinte.Add(test_ctor_teinte);
                }

                dataReader.Close();
                connection.Close();

            }
            catch (Exception)
            {
                listeTest_Ctor_Teinte = null;
            }
            finally
            {
                connection.Close();
            }
            return listeTest_Ctor_Teinte;
        }
        public static Boolean Insert(Test_Ctor_Teinte test_ctor_teinte)
        {
            //Connection
            SqlConnection connection = DataBase.Connection();

            //Requete
            String requete = @"INSERT INTO Test_Ctor_Teinte (" + champs + ") VALUES (@Min,@Norme,@Max,@ID_Test,@ID_Constructeur,@ID_Teinte);";

            //Commande
            SqlCommand commande = new SqlCommand(requete, connection);

            //Parametres
            commande.Parameters.AddWithValue("Min", test_ctor_teinte.Min);
            commande.Parameters.AddWithValue("Norme", test_ctor_teinte.Norme);
            commande.Parameters.AddWithValue("Max", test_ctor_teinte.Max);
            commande.Parameters.AddWithValue("ID_Test", test_ctor_teinte.ID_Test);
            commande.Parameters.AddWithValue("ID_Teinte", test_ctor_teinte.ID_Teinte);
            //Execution
            try
            {
                connection.Open();
                commande.ExecuteNonQuery();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                connection.Close();
            }
        }
        private void RefreshE4()
        {
            InitializeComponent();
            this.TBnomE4.Text = Ctor.Nom;

            Lteinte = TeinteDB.List(Ctor.Identifiant);
            LtCtor = Test_ConstructeurDB.List(Ctor.Identifiant);

            foreach (Teinte teinte in Lteinte)
            {
                foreach (Test_Constructeur tCtor in LtCtor)
                {

                    List<Test_Ctor_Teinte> ListTCT = Test_Ctor_TeinteDB.List(tCtor);
                    Boolean Exist = false;
                    foreach (Test_Ctor_Teinte TcTexistant in ListTCT)
                    {
                        if (teinte.Identifiant == TcTexistant.ID_Teinte)
                        {
                            Exist = true;
                        }
                    }

                    if (Exist == false)
                    {
                        Test_Ctor_Teinte tCt = new Test_Ctor_Teinte();
                        tCt.ID_Constructeur = tCtor.ID_Constructeur;
                        tCt.ID_Teinte = teinte.Identifiant;
                        tCt.ID_Test = tCtor.ID_Test;
                        tCt.Min = tCtor.Min;
                        tCt.Norme = tCtor.Norme;
                        tCt.Max = tCtor.Max;

                    Test_Ctor_TeinteDB.Insert(tCt);
                    }

                }
            }

            this.LBteinteE4.DataSource = Lteinte;
            this.LBteinteE4.DisplayMember = "ReferenceBase";
            this.LBteinteE4.ValueMember = "Identifiant";

            this.LBtestE4.DataSource = LtCtor;
            this.LBtestE4.DisplayMember = "Nom";
            this.LBtestE4.ValueMember = "Identifiant";
        }
        private void LBtestE4_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.TBtestE4.Text = ((Test_Constructeur)this.LBtestE4.SelectedItem).Nom;

            TcT = new Test_Ctor_Teinte();
            TcT.ID_Constructeur = ((Test_Constructeur)this.LBtestE4.SelectedItem).ID_Constructeur;
            TcT.ID_Teinte = ((Teinte)this.LBteinteE4.SelectedItem).Identifiant;
            TcT.ID_Test = ((Test_Constructeur)this.LBtestE4.SelectedItem).ID_Test;
            TcT.Min = ((Test_Constructeur)this.LBtestE4.SelectedItem).Min;
            TcT.Norme = ((Test_Constructeur)this.LBtestE4.SelectedItem).Norme;
            TcT.Max = ((Test_Constructeur)this.LBtestE4.SelectedItem).Max;

            Test = TestDB.Get(TcT.ID_Test);
            this.TBdescE4.Text = Test.Description;

            switch (Test.TypeTest)
            {
                case 1:
                    this.TBtypeE4.Text = "Minimum et Norme";
                    this.TBminE4.ReadOnly = false;
                    this.TBnormeE4.ReadOnly = false;
                    this.TBmaxE4.ReadOnly = true;

                    this.TBminE4.Text = TcT.Min.ToString();
                    this.TBnormeE4.Text = TcT.Norme.ToString();
                    this.TBmaxE4.Text = "";
                    break;
                case 2:
                    this.TBtypeE4.Text = "Minimum, Norme et Maximum";
                    this.TBminE4.ReadOnly = false;
                    this.TBnormeE4.ReadOnly = false;
                    this.TBmaxE4.ReadOnly = false;

                    this.TBminE4.Text = TcT.Min.ToString();
                    this.TBnormeE4.Text = TcT.Norme.ToString();
                    this.TBmaxE4.Text = TcT.Max.ToString();
                    break;
                case 3:
                    this.TBtypeE4.Text = "Norme et Maximum";
                    this.TBminE4.ReadOnly = true;
                    this.TBnormeE4.ReadOnly = false;
                    this.TBmaxE4.ReadOnly = false;

                    this.TBminE4.Text = "";
                    this.TBnormeE4.Text = TcT.Norme.ToString();
                    this.TBmaxE4.Text = TcT.Max.ToString();
                    break;
                default:
                    break;
            }
        }
        private void LBtestE2_SelectedIndexChanged(object sender, EventArgs e)
        {
            Ech_Resultat EchRes = (Ech_Resultat)LBtestE2.SelectedItem;
            Int32 ID_Test = EchRes.ID_Test;
            Int32 ID_Tein = EchRes.ID_Teinte;

            TcT = Test_Ctor_TeinteDB.Get(ID_Test, ID_Tein);

            switch (TestDB.Get(TcT.ID_Test).TypeTest)
            {
                case 1:
                    this.TBmin.Text = TcT.Min.ToString();
                    this.TBnorme.Text = TcT.Norme.ToString();
                    this.TBmax.Text = "";
                    break;

                case 2:
                    this.TBmin.Text = TcT.Min.ToString();
                    this.TBnorme.Text = TcT.Norme.ToString();
                    this.TBmax.Text = TcT.Max.ToString();
                    break;

                case 3:
                    this.TBmin.Text = "";
                    this.TBnorme.Text = TcT.Norme.ToString();
                    this.TBmax.Text = TcT.Max.ToString();
                    break;
            }
        }