/// <summary> /// Evenement annuler /// </summary> private void valider(object sender, EventArgs e) { CategoriePersonnel categASupprimer = (CategoriePersonnel)this.categorieASupprimerCB.SelectedItem; CategoriePersonnel categRemplacement = (CategoriePersonnel)this.categoriesCB.SelectedItem; if (categASupprimer != null && categRemplacement != null) { List <Personnel> listePersonnel = PersonnelDAO.findAll(); foreach (Personnel p in listePersonnel) { if (p.categoriePersonnel.id == categASupprimer.id) { p.categoriePersonnel = categRemplacement; PersonnelDAO.update(p); } } CategoriePersonnelDAO.delete(categASupprimer); this.Close(); } else { // Initializes the variables to pass to the MessageBox.Show method. string message = "Erreur lors de la saisie des données, il faut choisir une catégorie de personnel \n"; DiplomeView.afficherPopup(message); } }
public void TestFind() { // test du find simple CategoriePersonnel resultat = creerCategoriePersonnel("TEST_categ"); CategoriePersonnel resultatFind = CategoriePersonnelDAO.find(resultat.id); Assert.AreEqual("TEST_categ", resultatFind.libelle); Assert.AreNotEqual(0, resultatFind.id); }
private void initType() { List <CategoriePersonnel> allCP = CategoriePersonnelDAO.findAll(); foreach (CategoriePersonnel cp in allCP) { categorieCB.Items.Add(cp); } }
/** * Methodes pour aider aux tests * **/ public static CategoriePersonnel creerCategoriePersonnel(String libelle) { CategoriePersonnel res = new CategoriePersonnel(); res.libelle = libelle; res.volumeHoraire = 999; CategoriePersonnel c = CategoriePersonnelDAO.create(res); return(c); }
public void TestFindByLibelleCategoriePersonnel() { // test du fin by libelle List <CategoriePersonnel> resultatFind = CategoriePersonnelDAO.findByLibelle("TEST_categ"); foreach (CategoriePersonnel res in resultatFind) { Assert.AreEqual("TEST_categ", res.libelle); Assert.IsTrue(res.id > 0); } }
public InputRemplacerCategoriePersonnelForm() { InitializeComponent(); List <CategoriePersonnel> categorieList = CategoriePersonnelDAO.findAll(); foreach (CategoriePersonnel categ in categorieList) { this.categorieASupprimerCB.Items.Add(categ); this.categoriesCB.Items.Add(categ); } }
public void TestFindAll() { // test du fin by libelle List <CategoriePersonnel> resultatFind = CategoriePersonnelDAO.findAll(); foreach (CategoriePersonnel res in resultatFind) { Assert.IsNotNull(res.id); Assert.IsNotNull(res.volumeHoraire); Assert.IsNotNull(res.libelle); } }
public void TestDeleteCategoriePersonnel() { // test du delete List <CategoriePersonnel> resultatFind = CategoriePersonnelDAO.findByLibelle("TEST_%"); foreach (CategoriePersonnel res in resultatFind) { supprimeCategoriePersonnel(res); } List <CategoriePersonnel> resultatFind2 = CategoriePersonnelDAO.findByLibelle("TEST_%"); Assert.AreEqual(resultatFind2.Count, 0); }
private void loadCategories() { List <CategoriePersonnel> categories = CategoriePersonnelDAO.findAll(); foreach (CategoriePersonnel cp in categories) { this.categorieComboBox.Items.Add(cp); if (cp.id == modifCat) { this.categorieComboBox.SelectedItem = cp; } } }
public void TestUpdateCategoriePersonnel() { // test du delete List <CategoriePersonnel> resultatFind = CategoriePersonnelDAO.findByLibelle("TEST_categ"); foreach (CategoriePersonnel res in resultatFind) { res.libelle = "TEST_categ_2"; CategoriePersonnelDAO.update(res); } List <CategoriePersonnel> resultatFind2 = CategoriePersonnelDAO.findByLibelle("TEST_categ_2"); Assert.IsTrue(resultatFind2.Count > 0); }
/// <summary> /// Evenement valider / modifier /// </summary> private void validerAction(object sender, EventArgs e) { categorie = (CategoriePersonnel)categorieCB.SelectedItem; if (categorie != null) { categorie.volumeHoraire = Int32.Parse(volumeTextBox.Text); CategoriePersonnelDAO.update(categorie); } if (ratioModif != null) { ratioModif.ratio = Convert.ToDouble(ratioTextBox.Text); RatioDAO.update(ratioModif); } this.Close(); }
//Ajout private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { DiplomeView.afficherPopup("Le nom est vide"); } else { TypeCours type = new TypeCours(textBox1.Text); TypeCoursDAO.create(type); upadateList(); List <CategoriePersonnel> catList = CategoriePersonnelDAO.findAll(); foreach (CategoriePersonnel cat in catList) { Ratio r = new Ratio(type, cat); r.ratio = 1; RatioDAO.create(r); } } }
/// <summary> /// Evenement valider / modifier /// </summary> private void validerAction(object sender, EventArgs e) { CategoriePersonnel categorie = new CategoriePersonnel(); int volumeHoraire = 0; Boolean categorieIncorrect = String.IsNullOrWhiteSpace(categorietextBox.Text); Boolean volumeHoraireIncorrect = !Int32.TryParse(volumeTextBox.Text, out volumeHoraire); if (categorieIncorrect || volumeHoraireIncorrect) { // Initializes the variables to pass to the MessageBox.Show method. string message = "Erreur lors de la saisie des données \n"; message += volumeHoraireIncorrect ? " le volume horaire est incorrect" : ""; message += categorieIncorrect ? " le nom de la categorie est incorrect" : ""; DiplomeView.afficherPopup(message); } else { categorie.libelle = categorietextBox.Text; categorie.volumeHoraire = volumeHoraire; categorie = CategoriePersonnelDAO.create(categorie); if (categorie != null) { foreach (TypeCours typeCours in TypeCoursDAO.findAll()) { Ratio temp = new Ratio(); temp.ratio = 1; temp.typeCours = typeCours; temp.categoriePersonnel = categorie; RatioDAO.create(temp); } this.Close(); } } }
public static void supprimeCategoriePersonnel(CategoriePersonnel categoriePersonnel) { CategoriePersonnelDAO.delete(categoriePersonnel); }