Exemplo n.º 1
0
        public TableauBord()
        {
            InitializeComponent();

            listeIdRComboBoxOr.Clear();
            listeIdRComboBoxTop.Clear();

            CdROrLabel.Visibility      = Visibility.Hidden;
            CdRSemaineLabel.Visibility = Visibility.Hidden;
            Top5Label.Visibility       = Visibility.Hidden;

            OrRectangle.Visibility     = Visibility.Hidden;
            TopCdRRectangle.Visibility = Visibility.Hidden;
            Top5Rectangle.Visibility   = Visibility.Hidden;

            TableVide.Visibility         = Visibility.Visible;
            CdROrTable.Visibility        = Visibility.Hidden;
            top5RecettesTable.Visibility = Visibility.Hidden;
            topCdRSemainTable.Visibility = Visibility.Hidden;

            // Table CdR d'Or

            DataTable dataCdROr = new DataTable("CdR d'Or");

            dataCdROr.Columns.Add("Id Createur de Recette");
            dataCdROr.Columns.Add("Nom Createur de Recette");
            dataCdROr.Columns.Add("Prenom Createur de Recette");
            dataCdROr.Columns.Add("Email Createur de Recette");

            dataCdROr.Columns.Add("Id Recette");
            dataCdROr.Columns.Add("Nombre Commandes", typeof(int));
            dataCdROr.Columns.Add("Nom Recette");
            dataCdROr.Columns.Add("Type");
            dataCdROr.Columns.Add("Prix (Cook)", typeof(int));


            string connectionString = "SERVER=localhost;PORT=3306;DATABASE=projet;UID=" + MainWindow.Username + ";PASSWORD="******"SELECT CdR.idCdR,SUM(R.nbCommandes) AS somme FROM projet.recette AS R, projet.cdr AS CdR WHERE R.idCdR = CdR.idCdR GROUP BY idCdR ORDER BY somme Desc limit 1;";

            MySqlDataReader readerRemplirCdROr;

            readerRemplirCdROr = commandCdROr.ExecuteReader();

            string idCdROr = "";

            while (readerRemplirCdROr.Read())
            {
                idCdROr = readerRemplirCdROr.GetString(0);
            }

            connection.Close();

            connection.Open();

            MySqlCommand commandRemplir = connection.CreateCommand();

            commandRemplir.CommandText = "SELECT CdR.idCdR,C.nomC,C.prenomC,C.email,R.idR,R.nbCommandes,R.nomR,R.type,R.prixR FROM projet.recette AS R, projet.client AS C, projet.cdr AS CdR WHERE R.idCdR = CdR.idCdR AND CdR.idC = C.idC AND CdR.idCdR='" + idCdROr + "' ORDER BY R.nbCommandes Desc;";

            MySqlDataReader readerRemplir;

            readerRemplir = commandRemplir.ExecuteReader();

            int compteur = 0;

            while (readerRemplir.Read())
            {
                string idCdR        = readerRemplir.GetString(0);
                string nomC         = readerRemplir.GetString(1);
                string prenomC      = readerRemplir.GetString(2);
                string emailC       = readerRemplir.GetString(3);
                string idR          = readerRemplir.GetString(4);
                int    nbCommandesR = readerRemplir.GetInt32(5);
                string nomR         = readerRemplir.GetString(6);
                string typeR        = readerRemplir.GetString(7);
                int    prixR        = readerRemplir.GetInt32(8);

                listeIdRComboBoxOr.Add(idR);

                if (compteur == 0)
                {
                    dataCdROr.Rows.Add(idCdR, nomC, prenomC, emailC, idR, nbCommandesR, nomR, typeR, prixR);
                }
                else
                {
                    dataCdROr.Rows.Add(" ", " ", " ", " ", idR, nbCommandesR, nomR, typeR, prixR);
                }
                compteur++;
            }

            connection.Close();

            dataCdROr.DefaultView.Sort = "Nombre Commandes desc";
            CdROrTable.ItemsSource     = dataCdROr.DefaultView;

            // Table Top 5 recette de la semaine dernière

            DataTable dataTop5 = new DataTable("Top 5 recettes de la semaine");

            dataTop5.Columns.Add("Id Recette");
            dataTop5.Columns.Add("Nombre Commandes", typeof(int));
            dataTop5.Columns.Add("Nom Recette");
            dataTop5.Columns.Add("Type");
            dataTop5.Columns.Add("Prix (Cook)", typeof(int));

            dataTop5.Columns.Add("Id Createur de Recette");
            dataTop5.Columns.Add("Nom Createur de Recette");
            dataTop5.Columns.Add("Prenom Createur de Recette");
            dataTop5.Columns.Add("Email Createur de Recette");

            MainWindow.LoadDatabaseSemainePrec();

            List <Recette> listeRecettesClassees = MainWindow.listeRecettesSemainePrec;

            listeRecettesClassees.Sort((a, b) => a.NbCommandes.CompareTo(b.NbCommandes));

            for (int k = 0; k < 5; k++)
            {
                Recette current = listeRecettesClassees[listeRecettesClassees.Count - 1 - k];
                int     compt   = 0;
                foreach (CdR c in MainWindow.listeCdRSemainePrec)
                {
                    if (c.IdCdR == current.IdCdR)
                    {
                        break;
                    }
                    compt++;
                }
                CdR currentCdR = MainWindow.listeCdRSemainePrec[compt];

                dataTop5.Rows.Add(current.IdR, current.NbCommandes, current.NomR, current.Type, current.PrixR, current.IdCdR, currentCdR.NomC, currentCdR.PrenomC, currentCdR.Email);
                listeIdRComboBoxTop.Add(current.IdR);
            }


            dataTop5.DefaultView.Sort     = "Nombre Commandes desc";
            top5RecettesTable.ItemsSource = dataTop5.DefaultView;

            // table cdr de la semaine derniere

            DataTable dataTopCdRSem = new DataTable("Top CdR de la semaine");

            dataTopCdRSem.Columns.Add("Id Createur de Recette");
            dataTopCdRSem.Columns.Add("Nom Createur de Recette");
            dataTopCdRSem.Columns.Add("Prenom Createur de Recette");
            dataTopCdRSem.Columns.Add("Email Createur de Recette");
            dataTopCdRSem.Columns.Add("Age Createur de Recette", typeof(int));
            dataTopCdRSem.Columns.Add("Nombre Total Commandes", typeof(int));

            List <CdR>    listeCdROrdonnee = MainWindow.listeCdRSemainePrec;
            List <string> listeIdCdR       = new List <string>();
            List <int>    listeNbCommandes = new List <int>();

            foreach (CdR c in listeCdROrdonnee)
            {
                listeIdCdR.Add(c.IdCdR);
                listeNbCommandes.Add(0);
            }


            foreach (Recette currentRecette in MainWindow.listeRecettesSemainePrec)
            {
                int index = listeIdCdR.IndexOf(currentRecette.IdCdR);
                listeNbCommandes[index] += currentRecette.NbCommandes;
            }

            int indexCdRMax = listeNbCommandes.IndexOf(listeNbCommandes.Max());

            CdR topCdRSemaine = listeCdROrdonnee[indexCdRMax];

            dataTopCdRSem.Rows.Add(topCdRSemaine.IdCdR, topCdRSemaine.NomC, topCdRSemaine.PrenomC, topCdRSemaine.Email, topCdRSemaine.Age, listeNbCommandes[indexCdRMax]);

            dataTopCdRSem.DefaultView.Sort = "Nombre Total Commandes desc";
            topCdRSemainTable.ItemsSource  = dataTopCdRSem.DefaultView;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Lit la database de la semaine dernièr à partir du fichier .csv
        /// </summary>
        public static void LoadDatabaseSemainePrec()
        {
            MettreAJourAges();

            #region Client

            StreamReader fichLect = new StreamReader("ClientsSemPrec.csv");

            listeClientsSemainePrec.Clear();

            string ligne = "";

            string[] data;
            char[]   sep = new char[1] {
                ','
            };

            while (fichLect.Peek() > 0)
            {
                ligne = fichLect.ReadLine();
                data  = ligne.Split(sep);
                string idC           = data[0];
                char   sexe          = Convert.ToChar(data[1]);
                string nomC          = data[2];
                string prenomC       = data[3];
                string dateNaissance = data[4];
                int    age           = Convert.ToInt32(data[5]);
                string adresse       = data[6] + "," + data[7] + "," + data[8];
                string email         = data[9];
                string password      = data[10];
                string telC          = data[11];

                Client newClient = new Client(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC);
                listeClientsSemainePrec.Add(newClient);
            }

            fichLect.Close();

            #endregion

            #region CdR

            StreamReader fichLect2 = new StreamReader("CdRsSemPrec.csv");

            listeCdRSemainePrec.Clear();

            string ligne2 = "";

            string[] data2;
            char[]   sep2 = new char[1] {
                ','
            };

            while (fichLect2.Peek() > 0)
            {
                ligne2 = fichLect2.ReadLine();
                data2  = ligne2.Split(sep2);
                string idC           = data2[0];
                char   sexe          = Convert.ToChar(data2[1]);
                string nomC          = data2[2];
                string prenomC       = data2[3];
                string dateNaissance = data2[4];
                int    age           = Convert.ToInt32(data2[5]);
                string adresse       = data2[6] + "," + data2[7] + "," + data2[8];
                string email         = data2[9];
                string password      = data2[10];
                string telC          = data2[11];
                int    cook          = Convert.ToInt32(data2[12]);
                string idCdR         = data2[13];

                CdR newCdR = new CdR(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC, idCdR, cook);
                listeCdRSemainePrec.Add(newCdR);
            }

            fichLect2.Close();

            #endregion

            #region Recette

            StreamReader fichLect3 = new StreamReader("RecettesSemPrec.csv");

            listeRecettesSemainePrec.Clear();

            string ligne3 = "";

            string[] data3;
            char[]   sep3 = new char[1] {
                ','
            };

            while (fichLect3.Peek() > 0)
            {
                ligne3 = fichLect3.ReadLine();
                data3  = ligne3.Split(sep3);

                string idR              = data3[0];
                string nomR             = data3[1];
                string type             = data3[2];
                string listeIngredients = data3[3];
                string quantites        = data3[4];
                string descriptionR     = data3[5];
                int    prixR            = Convert.ToInt32(data3[6]);
                int    remuneration     = Convert.ToInt32(data3[7]);
                string idGrat           = data3[8];
                int    nbCook           = Convert.ToInt32(data3[9]);
                int    nbCommandes      = Convert.ToInt32(data3[11]);
                string idCdR2           = data3[10];

                Recette newRecette = new Recette(idR, nomR, type, listeIngredients, quantites, descriptionR, prixR, remuneration, nbCommandes, idGrat, nbCook, idCdR2);
                listeRecettesSemainePrec.Add(newRecette);
            }

            fichLect3.Close();



            #endregion

            #region Produit

            StreamReader fichLect4 = new StreamReader("ProduitsSemPrec.csv");

            listeProduitsSemainePrec.Clear();

            string ligne4 = "";

            string[] data4;
            char[]   sep4 = new char[1] {
                ','
            };

            while (fichLect4.Peek() > 0)
            {
                ligne4 = fichLect4.ReadLine();
                data4  = ligne4.Split(sep4);

                string nomP       = data4[0];
                string categorieP = data4[1];
                string unite      = data4[2];
                int    stockActu  = Convert.ToInt32(data4[3]);
                int    stockMin   = Convert.ToInt32(data4[4]);
                int    stockMax   = Convert.ToInt32(data4[5]);
                string idF        = data4[6];

                Produit newProduit = new Produit(nomP, categorieP, unite, stockActu, stockMin, stockMax, idF);
                listeProduitsSemainePrec.Add(newProduit);
            }

            fichLect4.Close();

            #endregion

            #region Fournisseur

            StreamReader fichLect5 = new StreamReader("FournisseursSemPrec.csv");

            listeFournisseursSemainePrec.Clear();

            string ligne5 = "";

            string[] data5;
            char[]   sep5 = new char[1] {
                ','
            };

            while (fichLect5.Peek() > 0)
            {
                ligne5 = fichLect5.ReadLine();
                data5  = ligne5.Split(sep5);

                string idF2 = data5[0];
                string nomF = data5[1];
                string telF = data5[2];

                Fournisseur newFournisseur = new Fournisseur(idF2, nomF, telF);
                listeFournisseursSemainePrec.Add(newFournisseur);
            }

            fichLect5.Close();

            #endregion

            #region Cooking

            StreamReader fichLect6 = new StreamReader("CookingsSemPrec.csv");

            listeCookingSemainePrec.Clear();

            string ligne6 = "";

            string[] data6;
            char[]   sep6 = new char[1] {
                ','
            };

            while (fichLect6.Peek() > 0)
            {
                ligne6 = fichLect6.ReadLine();
                data6  = ligne6.Split(sep6);


                string idCooking = data6[0];

                Cooking newCooking = new Cooking(idCooking);
                listeCookingSemainePrec.Add(newCooking);
            }

            fichLect6.Close();

            #endregion

            #region Liste Nombre Semaines Passées Sans Commandes (Par Produit)

            StreamReader fichLect7 = new StreamReader("NbSemainesSansCommade.csv");

            listeNbSemainesSansCommande.Clear();

            string ligne7 = "";

            string[] data7;
            char[]   sep7 = new char[1] {
                ','
            };

            while (fichLect7.Peek() > 0)
            {
                ligne7 = fichLect7.ReadLine();
                data7  = ligne7.Split(sep7);


                int nbSemaines = Convert.ToInt32(data7[0]);

                listeNbSemainesSansCommande.Add(nbSemaines);
            }

            fichLect7.Close();

            #endregion
        }
Exemplo n.º 3
0
        private void Valider_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (NonBox.IsChecked == true)
                {
                    string connectionString = "SERVER=localhost;PORT=3306;DATABASE=projet;UID=" + MainWindow.Username + ";PASSWORD="******"C" + IDClientBox.Text;
                    char   sexe = 'F';

                    if (MBox.IsChecked == true)
                    {
                        sexe = 'M';
                    }

                    string nomC          = NomBox.Text.ToUpper();
                    string prenomC       = PrenomBox.Text;
                    string dateNaissance = AnneeBox.Text + "-" + MoisBox.Text + "-" + JourBox.Text;
                    int    age           = Convert.ToInt32(CalculAgeLabel.Content);
                    string adresse       = AdresseBox.Text;
                    string email         = EmailBox.Text;
                    string password      = PswdBoxVerif.Password;
                    string telC          = TelephoneBox.Text;

                    MySqlCommand command = connection.CreateCommand();
                    command.CommandText = " INSERT INTO projet.client(`idC`,`nomC`,`prenomC`,`DateNaissance`,`age`,`adresse`,`sexe`,`email`,`password`,`telC`) VALUES('" + idC + "','" + nomC + "','" + prenomC + "','" + dateNaissance + "'," + age + ",'" + adresse + "','" + sexe + "','" + email + "','" + password + "','" + telC + "');";
                    MySqlDataReader reader;
                    reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                    }

                    connection.Close();


                    if (CdRBox.IsChecked == true)
                    {
                        int    cook  = 0;
                        string idCdR = "CdR" + IDCdRBox.Text;

                        CdR newCdR = new CdR(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC, idCdR, cook);
                        MainWindow.listeCdR.Add(newCdR);

                        connection.Open();
                        MySqlCommand commandCdR = connection.CreateCommand();
                        commandCdR.CommandText = "INSERT INTO projet.cdr(`idCdR`,`cook`,`idC`) VALUES('" + idCdR + "','" + cook + "','" + idC + "');";

                        MySqlDataReader readerCdR;
                        readerCdR = commandCdR.ExecuteReader();

                        while (readerCdR.Read())
                        {
                        }

                        connection.Close();
                    }
                    else if (ClientBox.IsChecked == true)
                    {
                        Client newClient = new Client(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC);
                        MainWindow.listeClients.Add(newClient);
                    }

                    MessageBox.Show("Inscription reussie !", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
                    ConnexionCompte window = new ConnexionCompte();
                    window.Show();

                    this.Close();
                }
                else if (OuiBox.IsChecked == true)
                {
                    string connectionString = "SERVER=localhost;PORT=3306;DATABASE=projet;UID=" + MainWindow.Username + ";PASSWORD="******"SELECT idC FROM projet.Client WHERE email='" + EmailBox.Text + "';";
                    MySqlDataReader reader1;
                    reader1 = command1.ExecuteReader();

                    string idC = "";

                    while (reader1.Read())
                    {
                        idC = reader1.GetString(0);
                    }

                    connection.Close();

                    int    cook  = 0;
                    string idCdR = "CdR" + IDCdRBox.Text;

                    connection.Open();
                    MySqlCommand commandCdR = connection.CreateCommand();
                    commandCdR.CommandText = "INSERT INTO projet.cdr(`idCdR`,`cook`,`idC`) VALUES('" + idCdR + "','" + cook + "','" + idC + "');";

                    MySqlDataReader readerCdR;
                    readerCdR = commandCdR.ExecuteReader();

                    while (readerCdR.Read())
                    {
                    }

                    connection.Close();

                    connection.Open();
                    MySqlCommand commandRecherche = connection.CreateCommand();
                    commandRecherche.CommandText = "SELECT sexe,UPPER(nomC),prenomC,DateNaissance,age,adresse,telC FROM projet.client WHERE idC='" + idC + "';";

                    MySqlDataReader readerRecherche;
                    readerRecherche = commandRecherche.ExecuteReader();

                    char     sexe           = ' ';
                    string   nomC           = "";
                    string   prenomC        = "";
                    string   dateNaissance  = "";
                    DateTime dateNaissance2 = new DateTime();
                    int      age            = 0;
                    string   adresse        = "";
                    string   email          = EmailBox.Text;
                    string   password       = PswdBoxVerif.Password;
                    string   telC           = "";

                    while (readerRecherche.Read())
                    {
                        sexe           = readerRecherche.GetChar(0);
                        nomC           = readerRecherche.GetString(1);
                        prenomC        = readerRecherche.GetString(2);
                        dateNaissance2 = readerRecherche.GetDateTime(3);


                        dateNaissance = dateNaissance2.Year + "-" + dateNaissance2.Month + "-" + dateNaissance2.Day;

                        age     = readerRecherche.GetInt32(4);
                        adresse = readerRecherche.GetString(5);
                        telC    = readerRecherche.GetString(6);
                    }

                    connection.Close();


                    CdR newCdR = new CdR(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC, idCdR, cook);
                    MainWindow.listeCdR.Add(newCdR);

                    MessageBox.Show("Inscription reussie !", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);

                    ConnexionCompte window = new ConnexionCompte();
                    window.Show();

                    this.Close();
                }
                MainWindow.LoadDatabase();
            }
            catch
            {
                MessageBox.Show("Inscription non reussie !", "Erreur!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Lit la database et instance chaque tuple en utilisant les classes C#
        /// </summary>
        public static void LoadDatabase()
        {
            MettreAJourAges();

            #region Client

            MainWindow.listeClients.Clear();

            string connectionString = "SERVER=localhost;PORT=3306;DATABASE=projet;UID=" + MainWindow.Username + ";PASSWORD="******"SELECT idC,sexe,UPPER(nomC),prenomC,DateNaissance,age,adresse,email,password,telC FROM projet.client;";

            MySqlDataReader readerRecherche;
            readerRecherche = commandRecherche.ExecuteReader();

            string   idC            = "";
            char     sexe           = ' ';
            string   nomC           = "";
            string   prenomC        = "";
            DateTime dateNaissance2 = new DateTime();
            string   dateNaissance  = "";
            int      age            = 0;
            string   adresse        = "";
            string   email          = "";
            string   password       = "";
            string   telC           = "";

            while (readerRecherche.Read())
            {
                idC            = readerRecherche.GetString(0);
                sexe           = readerRecherche.GetChar(1);
                nomC           = readerRecherche.GetString(2);
                prenomC        = readerRecherche.GetString(3);
                dateNaissance2 = readerRecherche.GetDateTime(4);

                dateNaissance = dateNaissance2.Year + "-" + dateNaissance2.Month + "-" + dateNaissance2.Day;

                age      = readerRecherche.GetInt32(5);
                adresse  = readerRecherche.GetString(6);
                email    = readerRecherche.GetString(7);
                password = readerRecherche.GetString(8);
                telC     = readerRecherche.GetString(9);
                Client newClient = new Client(idC, sexe, nomC, prenomC, dateNaissance, age, adresse, email, password, telC);
                MainWindow.listeClients.Add(newClient);
            }

            connection.Close();

            #endregion

            #region CdR

            MainWindow.listeCdR.Clear();

            connection.Open();

            MySqlCommand commandRechercheCdR = connection.CreateCommand();
            commandRechercheCdR.CommandText = "SELECT projet.client.idC,sexe,UPPER(nomC),prenomC,DateNaissance,age,adresse,email,password,telC,cook,idCdR FROM projet.client,projet.cdR WHERE projet.client.idC = projet.cdR.idC;";

            MySqlDataReader readerRechercheCdR;
            readerRechercheCdR = commandRechercheCdR.ExecuteReader();

            string   idC2            = "";
            char     sexe2           = ' ';
            string   nomC2           = "";
            string   prenomC2        = "";
            DateTime dateNaissance2b = new DateTime();
            string   dateNaissance1  = "";
            int      age2            = 0;
            string   adresse2        = "";
            string   email2          = "";
            string   password2       = "";
            string   telC2           = "";
            int      cook            = 0;
            string   idCdR           = "";


            while (readerRechercheCdR.Read())
            {
                idC2            = readerRechercheCdR.GetString(0);
                sexe2           = readerRechercheCdR.GetChar(1);
                nomC2           = readerRechercheCdR.GetString(2);
                prenomC2        = readerRechercheCdR.GetString(3);
                dateNaissance2b = readerRechercheCdR.GetDateTime(4);

                dateNaissance1 = dateNaissance2b.Year + "-" + dateNaissance2b.Month + "-" + dateNaissance2b.Day;

                age2      = readerRechercheCdR.GetInt32(5);
                adresse2  = readerRechercheCdR.GetString(6);
                email2    = readerRechercheCdR.GetString(7);
                password2 = readerRechercheCdR.GetString(8);
                telC2     = readerRechercheCdR.GetString(9);
                cook      = readerRechercheCdR.GetInt32(10);
                idCdR     = readerRechercheCdR.GetString(11);

                CdR newCdR = new CdR(idC, sexe, nomC, prenomC, dateNaissance1, age, adresse, email, password, telC, idCdR, cook);
                MainWindow.listeCdR.Add(newCdR);
            }

            connection.Close();

            #endregion

            #region Recette

            MainWindow.listeRecettes.Clear();

            connection.Open();

            MySqlCommand commandRechercheR = connection.CreateCommand();
            commandRechercheR.CommandText = "SELECT idR,nomR,type,listeIngredients,quantites,descriptionR,prixR,remunerationCuisinier,idGratification,nbCook,idCdR,nbCommandes FROM projet.recette;";

            MySqlDataReader readerRechercheR;
            readerRechercheR = commandRechercheR.ExecuteReader();

            string idR              = "";
            string nomR             = "";
            string type             = "";
            string listeIngredients = "";
            string quantites        = "";
            string descriptionR     = "";
            int    prixR            = 0;
            int    remuneration     = 0;
            string idGrat           = "";
            int    nbCook           = 0;
            int    nbCommandes      = 0;
            string idCdR2           = "";

            while (readerRechercheR.Read())
            {
                idR              = readerRechercheR.GetString(0);
                nomR             = readerRechercheR.GetString(1);
                type             = readerRechercheR.GetString(2);
                listeIngredients = readerRechercheR.GetString(3);
                quantites        = readerRechercheR.GetString(4);
                descriptionR     = readerRechercheR.GetString(5);
                prixR            = readerRechercheR.GetInt32(6);
                remuneration     = readerRechercheR.GetInt32(7);
                idGrat           = readerRechercheR.GetString(8);
                nbCook           = readerRechercheR.GetInt32(9);
                idCdR2           = readerRechercheR.GetString(10);
                nbCommandes      = readerRechercheR.GetInt32(11);

                Recette newRecette = new Recette(idR, nomR, type, listeIngredients, quantites, descriptionR, prixR, remuneration, nbCommandes, idGrat, nbCook, idCdR2);
                MainWindow.listeRecettes.Add(newRecette);
            }

            connection.Close();


            #endregion

            #region Produit

            MainWindow.listeProduits.Clear();

            connection.Open();

            MySqlCommand commandRechercheP = connection.CreateCommand();
            commandRechercheP.CommandText = "SELECT nomP,categorieP,unite,stockActuel,stockMin,stockMax,idF FROM projet.produit ORDER BY nomP;";

            MySqlDataReader readerRechercheP;
            readerRechercheP = commandRechercheP.ExecuteReader();

            string nomP       = "";
            string categorieP = "";
            string unite      = "";
            int    stockActu  = 0;
            int    stockMin   = 0;
            int    stockMax   = 0;
            string idF        = "";

            while (readerRechercheP.Read())
            {
                nomP       = readerRechercheP.GetString(0);
                categorieP = readerRechercheP.GetString(1);
                unite      = readerRechercheP.GetString(2);
                stockActu  = readerRechercheP.GetInt32(3);
                stockMin   = readerRechercheP.GetInt32(4);
                stockMax   = readerRechercheP.GetInt32(5);
                idF        = readerRechercheP.GetString(6);

                Produit newProduit = new Produit(nomP, categorieP, unite, stockActu, stockMin, stockMax, idF);
                MainWindow.listeProduits.Add(newProduit);
            }

            connection.Close();


            #endregion

            #region Fournisseur

            MainWindow.listeFournisseurs.Clear();

            connection.Open();

            MySqlCommand commandRechercheF = connection.CreateCommand();
            commandRechercheF.CommandText = "SELECT idF,nomF,telF FROM projet.fournisseur;";

            MySqlDataReader readerRechercheF;
            readerRechercheF = commandRechercheF.ExecuteReader();

            string idF2 = "";
            string nomF = "";
            string telF = "";

            while (readerRechercheF.Read())
            {
                idF2 = readerRechercheF.GetString(0);
                nomF = readerRechercheF.GetString(1);
                telF = readerRechercheF.GetString(2);

                Fournisseur newFournisseur = new Fournisseur(idF2, nomF, telF);
                MainWindow.listeFournisseurs.Add(newFournisseur);
            }

            connection.Close();


            #endregion

            #region Cooking

            MainWindow.listeCooking.Clear();

            connection.Open();

            MySqlCommand commandRechercheC = connection.CreateCommand();
            commandRechercheC.CommandText = "SELECT idCooking FROM projet.Cooking;";

            MySqlDataReader readerRechercheC;
            readerRechercheC = commandRechercheC.ExecuteReader();

            string idCooking = "";

            while (readerRechercheC.Read())
            {
                idCooking = readerRechercheC.GetString(0);

                Cooking newCooking = new Cooking(idCooking);
                MainWindow.listeCooking.Add(newCooking);
            }

            connection.Close();


            #endregion
        }