public viewModelEquipe(DaoEquipe thedaoequipe, DaoJoueur thedaojoueur, DAOPays thedaopays, DaoPoste thedaoposte) { vmDaoPays = thedaopays; vmDaoJoueur = thedaojoueur; vmDaoPoste = thedaoposte; vmDaoEquipe = thedaoequipe; listEquipe = new ObservableCollection <Equipe>(thedaoequipe.SelectAll()); listJoueur = new ObservableCollection <Joueur>(thedaojoueur.SelectAll()); listPays = new ObservableCollection <Pays>(thedaopays.SelectAll()); listPoste = new ObservableCollection <Poste>(thedaoposte.SelectAll()); foreach (Joueur J in ListJoueur) { int i = 0; while (J.Id != listPays[i].Id) { i++; } J.LePays = listPays[i]; } foreach (Joueur J in ListJoueur) { int i = 0; while (J.Id != listPays[i].Id) { i++; } J.LePoste = listPoste[i]; } }
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); }
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("dsfootamericain"); thedaopays = new DAOPays(thedbal); thedaoequipe = new DaoEquipe(thedbal); thedaoposte = new DaoPoste(thedbal); 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(thedaoequipe, thedaojoueur, thedaopays, 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(); }
static void Main(string[] args) { mondbal = new Dbal("dsfootamericain"); myDaoPays = new DAOPays(mondbal); myDaoPoste = new DaoPoste(mondbal); myDaoJoueur = new DaoJoueur(mondbal, myDaoPays, myDaoPoste, myDaoEquipe); #region testPays //afficher liste pays List <Pays> listPays = myDaoPays.SelectAll(); foreach (Pays p in listPays) { Console.WriteLine(p.Nom); } //afficher nom pays par id //Pays myPays = myDaoPays.SelectById(1); //Console.WriteLine(myPays.Nom); //afficher nom pays par nom //Pays myPays = myDaoPays.SelectByName("France"); //Console.WriteLine(myPays.Nom); //insert pays //Pays myPays = new Pays(4, "Allemagne"); //myDaoPays.Insert(myPays); #endregion #region testJoueur List <Joueur> listeJoueur = myDaoJoueur.SelectAll(); foreach (Joueur j in listeJoueur) { Console.WriteLine(j.Nom); } #endregion }
public MainWindow(DaoEquipe ledaoequipe, DaoJoueur ledaojoueur, DAOPays ledaopays, DaoPoste ledaoposte) { InitializeComponent(); Globale.DataContext = new viewModel.viewModelEquipe(ledaoequipe, ledaojoueur, ledaopays, ledaoposte); }