Example #1
0
        static void Main(string[] args)
        {
            dbal    mydbal = new dbal();
            DaoPays Suisse = new DaoPays(mydbal);

            Suisse.insertfile("D:/SylvainLuiset/SLAM5/Club des fromages/Club des fromages/bin/Debug/netcoreapp3.1/pays.csv", ";");


            //mydbal.Delete("Pays WHERE id = '1'");
            //mydbal.Delete("Fromage WHERE id ='1'");
            //mydbal.Delete("Pays WHERE id='2'");
            //mydbal.ExecQuery("INSERT INTO Pays (id, nom) VALUES (1, 'FRANCE')");
            //mydbal.ExecQuery("INSERT INTO Fromage (id, pays_origine_id, nom, creation, image) VALUES (1, 1, 'Compté', '1843-02-10', 'pasimage')");
            //mydbal.Insert("Pays (id, nom) VALUES (2, 'Angleterre')");
            //mydbal.Update("Fromage SET pays_origine_id = '2' WHERE id ='1'");
            //mydbal.Select("* FROM Pays");
            //mydbal.Count("(*) FROM Pays");
            //mydbal.Delete("Pays WHERE id = '2'");

            ////InsertPays par DAO
            //Pays ar = new Pays(5, "Suisse");
            //Pays ad = new Pays(5, "Jordanie");
            //DaoPays Suisse = new DaoPays(mydbal);
            //Suisse.InsertPays(ar);

            ////UpdatePays par DAO
            //Suisse.UpdatePays(ad);

            ////DeletePays par DAO
            //Suisse.DeletePays(ar);

            ////Utilisation CSV
        }
Example #2
0
        static void Main(string[] arg)
        {
            dbal ledbal = new dbal();
            //FP.Execquery("INSERT INTO Pays (id, nom) values (1, 'France')");
            //pays unpays = new pays(2, "France");
            DAOPays pays = new DAOPays(ledbal);

            //pays.insert(unpays);
            //pays.delete(unpays);
            //pays.update(unpays);


            fromage    fromage   = new fromage(1, 1, "'raclette'", "'09/09/2020'", "image");
            DAOFromage unfromage = new DAOFromage(ledbal);

            //lefromage.insert(fromage);
            //lefromage.delete(fromage);
            //fromage.update(lefromage);



            pays.InsertByFile("C://Users//SIO2//Desktop//ClubFromage_cs//bin//Debug//netcoreapp3.1//pays.csv");


            DataSet lesPays = ledbal.RQuery("SELECT * FROM Pays");

            foreach (DataRow r in lesPays.Tables[0].Rows)
            {
                Console.WriteLine(r["id"]);
            }



            foreach (DataRow maligne in ledbal.SelectAll("pays").Rows)
            {
                Console.WriteLine(maligne["nom"]);
            }


            /*foreach (DataRow row in ledbal.SelectByFile("Pays", "nom like 'P%'").Rows)
             * {
             *  Console.WriteLine(row["nom"]);
             * }*/

            DataRow id = ledbal.SelectById("Pays", 3);

            Console.WriteLine(id["id"] + "  " + id["nom"].ToString());

            pays.SelectAll();

            pays.SelectByName("France");

            pays.SelectById(12);

            unfromage.SelectAll();

            unfromage.SelectByName("Camembert");

            unfromage.SelectById(12);
        }
Example #3
0
        static void Main(string[] args)
        {
            //Connexion dbal
            dbal projetfromage = new dbal();


            //string insert = "pays VALUES ('2','Algérie')";
            //string update = "pays SET id ='3' where id='1'";
            //string delete = "pays";

            //projetfromage.Insert(insert);
            //Fromage.Update(update);
            //projetfromage.Delete(delete);

            //DAOpays undaoPAys = new DAOpays(projetfromage);
            //undaoPAys.InsertFromCSV("D:\\Thalia\\projetfromage\\projetfromage\\pays.csv");

            //DAOFromage undaofromage = new DAOFromage(projetfromage, undaoPAys);
            //undaofromage.InsertFromCSV("D:\\Thalia\\projetfromage\\projetfromage\\fromage.csv");

            //DataSet lespays = projetfromage.RQuery("SELECT * FROM Pays");

            //foreach (DataRow leslignes in lespays.Tables[0].Rows)
            //{

            //    Console.WriteLine(leslignes["id"]);
            //}

            //foreach (DataRow r in projetfromage.SelectAll("Pays").Rows)
            //{
            //    Console.WriteLine(r["nom"]);
            //}

            //foreach (DataRow r in projetfromage.SelectByField("pays", "nom like 'I%'").Rows)
            //{
            //    Console.WriteLine(r["nom"]);
            //}

            //DataRow x = projetfromage.SelectById("pays", 38);
            //Console.Write(x["nom"]);
            //Console.ReadLine();

            //foreach (DataRow r in projetfromage.SelectAll("pays").Rows)
            //{
            //    Console.WriteLine(r["id"] + " | " + r["nom"]);
            //}


            //foreach (DataRow r in projetfromage.SelectByField("pays", "nom like '" + "I%" + "'").Rows)
            //{
            //    Console.WriteLine(r["id"] + " | " + r["nom"]);
            //}

            //DataRow x = projetfromage.SelectById("pays", 38);
            //Console.Write(x["nom"]);
            //Console.ReadLine();
        }
Example #4
0
        static void Main(string[] args)
        {
            dbal   = new dbal("LSRGames");
            salles = new DAOsalles(dbal);
            avis   = new DAOavis();
            theme  = new DAOtheme(dbal);

            //Fait -> salles.InsertFromCSV("D:\\Thalia\\PPE\\AppDirecteur\\AppDirecteur\\ModelLayers\\Fichiers_Csv\\salles.csv");
            avis.InsertFromCSV("D:\\Thalia\\PPE\\AppDirecteur\\AppDirecteur\\ModelLayers\\Fichiers_Csv\\avis.csv");
            //Fait -> theme.InsertFromCSV("D:\\Thalia\\PPE\\AppDirecteur\\AppDirecteur\\ModelLayers\\Fichiers_Csv\\theme.csv");

            System.Console.WriteLine("Fin");
        }
Example #5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //C'est ici, dans la méthode Application_Startup, qu'on instancie nos objets Dbal et Dao
            thedbal      = new dbal("foot_americainDB");
            thedaopays   = new DAOpays(thedbal);
            thedaoposte  = new DAOposte(thedbal);
            thedaoequipe = new DAOequipe(thedbal, thedaojoueur);
            thedaojoueur = new DAOjoueur(thedbal, thedaopays, thedaoposte, thedaoequipe);

            // Create the startup window
            //là, on lance la fenêtre souhaitée en instanciant la classe de notre fenêtre
            MainWindow wnd = new MainWindow(thedaopays, thedaoequipe, thedaojoueur, thedaoposte);

            //et on utilise la méthode Show() de notre objet fenêtre pour afficher la fenêtre
            //exemple: MainWindow lafenetre = new MainWindow(); (et on y passe en paramètre Dbal et Dao au besoin)
            wnd.Show();
        }
Example #6
0
        static void Main(string[] args)
        {
            dbal NewDBal = new dbal();
            //Pays pays1 = new Pays(1, "france");
            DaoPays DaoPays1 = new DaoPays(NewDBal);
            //DaoPays1.delete(pays1);

            //DaoPays1.insert(pays1);
            //DaoPays1.update(pays1);
            //Fromage Fromage1 = new Fromage(1, 1, "Camenbert", 12, "cc");
            DaoFromage DaoFromage1 = new DaoFromage(NewDBal);

            //DaoFromage1.delete(Fromage1);

            //DaoFromage1.update(Fromage1);
            Console.WriteLine("test");
            //DaoPays1.update(pays1);
            //DaoPays1.update(pays1);

            //DaoPays1.insertfil();

            //Console.WriteLine("fin program");

            DataSet lespays = NewDBal.RQuery("select * from pays");

            /*
             * foreach (DataRow r in lespays.Tables[0].Rows)
             * {
             * Console.WriteLine(r["nom"]);
             *
             * }
             *
             * //selectALL
             * foreach (DataRow r in NewDBal.SelectAll("Pays").Rows)
             * {
             *  Console.WriteLine(r["id"] + "    " + r["nom"]);
             * }
             *
             * Console.WriteLine("SelectByFIeld :");
             *
             * //SelectByFIeld
             * foreach (DataRow r in NewDBal.SelectByField("pays", " nom like 'P%'").Rows)
             * {
             *  Console.WriteLine(r["id"] + "    " + r["nom"]);
             * }
             *
             * Console.WriteLine("SelectByld :");
             * DataRow id1 = NewDBal.SelectByld("pays", 1);
             * Console.WriteLine(id1["id"] + "    " + id1["nom"]);
             *
             */


            /*DaoPays1.selectAll();*/


            /*DaoPays1.SelectByName("France");
             *
             * DaoPays1.SelectById(50);*/
            //DaoFromage1.insertfil();
            DaoFromage1.selecAll();
        }
Example #7
0
 static void Main(string[] args)
 {
     mydbal = new dbal("foot_americainDb");
     //mydaojoueur.Delete();
 }
Example #8
0
        static void Main(string[] args)
        {
            dbal MaBDD = new dbal();//nouvel instance DBAL

            Console.WriteLine("Bonjour !");
            daoPays    daoP = new daoPays(MaBDD); // nouvel instance dao avec un DBAL
            daoFromage daoF = new daoFromage(MaBDD, daoP);

            daoF.MainCSV();

            //------------------------------------------------------------
            //selectbyID dao fromage
            //Console.WriteLine(daoF.SelectByID(1).Nom);
            //-----------------------------------------------------------
            //SelectByName dao fromage
            //Console.WriteLine(daoF.SelectByName("fromage de chèvre").Id);
            //-----------------------------------------------------------
            //list Fromage selectALl
            //daoF.SelectAll();
            //foreach (Fromage item in daoF.SelectAll())
            //{
            //    Console.WriteLine(item.Nom);
            //}
            //----------------------------------------------------
            //selectByID
            //Console.WriteLine(daoP.selectByID(110).Nom);
            //---------------------------------------------------------------------------
            //selectbyname
            //Console.WriteLine(daoP.selectByName("vietnam").Nom);
            //-----------------------------------------------------------------------
            //list Pays selectALL
            //foreach (Pays unpays in daoP.SelectAll())
            //{
            // Console.WriteLine(unpays.Nom);
            //}

            //Datarow SelectbyID
            // DataRow DataR = MaBDD.SelectByID("pays", 165);
            //  Console.WriteLine(DataR["nom"]);

            //--------------------------------------------------------------------------
            //DataTable Selectbyfield
            //foreach (DataRow dataR in MaBDD.SelectByField("pays", "id = 10").Rows)
            //{
            //    Console.WriteLine(dataR["nom"] + " " + dataR["id"]);
            //}
            //--------------------------------------------------------------------------
            //DataTable selectAll
            //foreach  (DataRow dataR in MaBDD.SelectALL("pays").Rows)
            //{
            //    Console.WriteLine(dataR["nom"]+" "+ dataR["id"]);
            //}
            //--------------------------------------------------------------------------
            //DataSet RQUERY
            //DataSet dataS = MaBDD.RQuery("Select * from pays ;"); //instancie un objet dataset (bdd) grace a ma MaBDD.query
            //foreach (DataRow Undata in dataS.Tables[0].Rows)
            //{
            //    //pour un objet datarow qui sera dans Undata dans la tables dataS a chaque ligne

            //        Console.WriteLine(Undata["id"]+ " "+ Undata["nom"]);



            //}



            //daoP.MainCSV();


            // Pays p3 = new Pays(3,"Chine");
            // Fromage fromage1 = new Fromage(1, p3, "tome", "2010-03-19", "ttt");

            //daoF.Insert(fromage1);

            //daoP.Insert(p3);
            //daoP.Update(p3);
            //daoP.Delete(p3);

            Console.WriteLine("------- FIN -------");
        }