/// <summary> /// Charge les diplomes /// </summary> public void diplomeViewLoad() { if (diplomesView != null) { foreach (DiplomeView dv in diplomesView) { tabControl1.Controls.Remove(dv); } } this.diplomesView = new System.Collections.Generic.List <view.DiplomeView>(); int i = 1; foreach (Diplome d in DiplomeDAO.findAll()) { DiplomeView dv = new DiplomeView(d); dv.Name = "diplomeView" + i; dv.Text = d.libelle; dv.Tag = d; dv.UseVisualStyleBackColor = true; diplomesView.Add(dv); } foreach (ClientGestionUniversite.view.DiplomeView dv in diplomesView) { this.tabControl1.Controls.Add(dv); } if (this.mdv != null) { this.mdvIndex = tabControl1.TabPages.IndexOf(this.mdv); } }
public void TestFind() { // test du find simple Diplome resultat = creerDiplome("TEST_1"); Diplome resultatFind = DiplomeDAO.find(resultat.id); Assert.AreEqual("TEST_1", resultatFind.libelle); }
/** * Methodes pour aider aux tests * **/ public static Diplome creerDiplome(String libelle) { Diplome dip = new Diplome(); dip.libelle = libelle; Diplome d = DiplomeDAO.create(dip); return(d); }
/// <summary> /// Supprimer un diplome /// </summary> private void supDiplome(object sender, EventArgs e) { Diplome d = getCurrentDiplome(); if (d != null) { DiplomeDAO.delete(d); diplomeViewLoad(); } }
/// <summary> /// Charge les données de la grille Diplome /// </summary> private void diplomeGridViewLoad() { List <Diplome> allDip = DiplomeDAO.findAll(); BindingListView <Diplome> bindingSourceUe = new BindingListView <Diplome>(allDip); diplomeGridView.DataSource = bindingSourceUe; anneeGridViewLoad(); periodeGridViewLoad(); client.diplomeViewLoad(); }
public void TestFindByLibelleDiplome() { // test du fin by libelle List <Diplome> resultatFind = DiplomeDAO.findByLibelle("TEST_1"); foreach (Diplome dip in resultatFind) { Assert.AreEqual("TEST_1", dip.libelle); } }
public void TestFindByDiplome() { // test du fin by avec n'importe // ne fonctionne pas car l'attribut est en format string : avec les " " et ça ne marche pas en sql pour le nom de la colonne List <Diplome> resultatFind = DiplomeDAO.findBy("libelle", "TEST%"); foreach (Diplome dip in resultatFind) { Assert.AreEqual("TEST_1", dip.libelle); } }
public void TestDeleteDiplome() { // test du delete List <Diplome> resultatFind = DiplomeDAO.findByLibelle("test%"); foreach (Diplome dip in resultatFind) { supprimerDiplome(dip); } List <Diplome> resultatFind2 = DiplomeDAO.findByLibelle("TEST_1"); Assert.AreEqual(resultatFind2.Count, 0); }
/// <summary> /// Supression d'un Diplome /// </summary> private void supprimerDiplome(object sender, EventArgs e) { Diplome d = getCurrentDiplome(); if (d != null) { DiplomeDAO.delete(d); diplomeGridViewLoad(); } else { DiplomeView.afficherPopup("Aucun diplome selectionnée"); } }
public void TestUpdateDiplome() { // test du delete List <Diplome> resultatFind = DiplomeDAO.findByLibelle("TEST_1"); foreach (Diplome dip in resultatFind) { dip.libelle = "TEST_2"; DiplomeDAO.update(dip); } List <Diplome> resultatFind2 = DiplomeDAO.findByLibelle("TEST_2"); Assert.IsTrue(resultatFind2.Count > 0); }
/// <summary> /// Charge les données de la grille Diplome /// </summary> private void diplomeGridViewLoad() { List <Diplome> allDip = DiplomeDAO.findAll(); List <Diplome> Dip = new List <Diplome>(); foreach (Diplome tempD in allDip) { Dip.Add(tempD); } BindingListView <Diplome> bindingSourceUe = new BindingListView <Diplome>(Dip); diplomeGridView.DataSource = bindingSourceUe; anneeGridViewLoad(); periodeGridViewLoad(); }
/// <summary> /// Evenement valider / modifier /// </summary> private void valider(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.nomBox.Text)) { DiplomeView.afficherPopup("Le nom du diplome est vide"); } else { Diplome d = new Diplome(this.nomBox.Text); if (input) { DiplomeDAO.create(d); } else { d.id = modifId; DiplomeDAO.update(d); } this.Close(); } }
public static void supprimerDiplome(Diplome diplome) { DiplomeDAO.delete(diplome); }