public InputModifAnneeForm(String name, Diplome d) { input = true; this.Text = name; this.d = d; InitializeComponent(); }
public static void delete(Diplome obj) { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; try { sql = "DELETE FROM diplome WHERE id = @id"; _cmd.CommandText = sql; _cmd.Parameters.AddWithValue("@id", obj.id); _cmd.ExecuteNonQuery(); obj.id = _cmd.LastInsertedId; } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); }
public static Diplome update(Diplome obj) { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; try { sql = "UPDATE diplome set libelle = @libelle WHERE id = @id"; _cmd.CommandText = sql; _cmd.Parameters.AddWithValue("@id", obj.id); _cmd.Parameters.AddWithValue("@libelle", obj.libelle); _cmd.ExecuteNonQuery(); obj.id = _cmd.LastInsertedId; } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); return(obj); }
public static List <ElementConstitutif> findByUniteEnseignement(long id) { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; MySqlDataReader reader = null; List <ElementConstitutif> resultats = new List <ElementConstitutif>(); try { sql = "SELECT element_constitutif.id as elemConstID, element_constitutif.libelle as elemConstLibelle, " + "unite_enseignement.id as uniteEnsID, unite_enseignement.libelle as uniteEnsLibelle, " + "periode.id AS periodeID, periode.libelle AS periodeLibelle, " + "annee.id AS anneeId, annee.libelle AS anneeLibelle, " + "diplome.id AS diplomeID, diplome.libelle AS diplomeLibelle " + "FROM element_constitutif " + "JOIN unite_enseignement on element_constitutif.ue_id = unite_enseignement.id " + "JOIN periode ON unite_enseignement.periode_id = periode.id " + "JOIN annee ON periode.annee_id = annee.id " + "JOIN diplome ON annee.diplome_id = diplome.id " + "WHERE unite_enseignement.id = @id"; _cmd.CommandText = sql; _cmd.Parameters.AddWithValue("@id", id); reader = _cmd.ExecuteReader(); while (reader.Read()) { Diplome tempDiplome = DiplomeDAO.populateDiplome(reader); Annee tempAnnee = AnneeDAO.populateAnnee(reader); tempAnnee.diplome = tempDiplome; Periode tempPeriode = PeriodeDAO.populatePeriode(reader); tempPeriode.annee = tempAnnee; UniteEnseignement tempUnite = UniteEnseignementDAO.populateUniteEnseignement(reader); tempUnite.periode = tempPeriode; ElementConstitutif tempElementConstitutif = populateElementConstitutif(reader); tempElementConstitutif.uniteEnseignement = tempUnite; resultats.Add(tempElementConstitutif); } reader.Close(); } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); return(resultats); }
public static Diplome create(Diplome obj) { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; try { sql = "INSERT INTO diplome (id, libelle) VALUES (@id,@libelle) "; _cmd.CommandText = sql; _cmd.Parameters.AddWithValue("@id", obj.id); _cmd.Parameters.AddWithValue("@libelle", obj.libelle); _cmd.ExecuteNonQuery(); obj.id = _cmd.LastInsertedId; } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); return(obj); }
internal Diplome getDataFromInterface() { D = new Diplome(); D.DIPLOME = cmbDiplome.SelectedItem.ToString(); D.SPECIALITE = txtSpecialite.Text.ToString(); if (cmbMention.SelectedIndex >= 0) { D.MENTION = cmbMention.SelectedItem.ToString(); } else { D.MENTION = string.Empty; } if (cmbAnnee.SelectedIndex >= 0) { D.ANNEE = cmbAnnee.SelectedItem.ToString(); } else { D.ANNEE = string.Empty; } D.INSTITUTION = txtInstitution.Text.ToString(); D.CIN = this.Cin; return(D); }
public async Task <ActionResult <Diplome> > PutDiplome(int id, Diplome diplome) { if (id != diplome.id) { return(BadRequest()); } _context.Entry(diplome).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (await _context.Diplome.FindAsync(id) == null) { return(NotFound()); } else { throw; } } return(await _context.Diplome.FindAsync(id)); }
public async Task <IActionResult> PutDiplome([FromRoute] int id, [FromBody] Diplome diplome) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != diplome.Id_Diplome) { return(BadRequest()); } _context.Entry(diplome).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DiplomeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// Retourne l'ensemble des diplomes /// </summary> /// <returns>diplomes</returns> public static List <Diplome> findAll() { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; MySqlDataReader reader = null; List <Diplome> resultats = new List <Diplome>(); try { sql = "SELECT diplome.id AS diplomeID, diplome.libelle AS diplomeLibelle " + "FROM diplome"; _cmd.CommandText = sql; reader = _cmd.ExecuteReader(); while (reader.Read()) { Diplome temp = populateDiplome(reader); resultats.Add(temp); } reader.Close(); } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); return(resultats); }
public async Task <IActionResult> Edit(int id, [Bind("Id_Diplome,Designation_Orientation,Designation_Formation,Type_Cours")] Diplome diplome) { if (id != diplome.Id_Diplome) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(diplome); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DiplomeExists(diplome.Id_Diplome)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(diplome)); }
public void ValiderL2ValidationRefuseTest() { int nId = 0; nId = oCand.ID; Diplome oDipDefault = Diplome.getDiplomeParDefaut(); Livret2 oL2 = new Livret2(oDipDefault); // Tous les DC sont a Valider foreach (DCLivret item in oL2.lstDCLivrets) { item.IsAValider = true; } oL2.create1erJury(); oL2.oCandidat = oCand; oCand.lstLivrets2.Add(oL2); // Refus de validation oL2.get1erJury().Decision = "20-Refusé"; foreach (DCLivret item in oL2.lstDCLivrets) { item.Decision = "20-Refusé"; } oL2.ValiderLivret2(); Assert.AreEqual(1, oCand.lstDiplomes.Count); Assert.AreEqual("Refusé", oCand.lstDiplomes[0].Statut); }//ValiderL2ValidationRefuseTest
public void testDeleteOnCascade() { Diplome oDip1 = new Diplome(); Diplome oDip2; oDip1.Nom = "CAFDES"; DomaineCompetence oDC2 = new DomaineCompetence(); oDC2.Nom = "DC2"; oDC2.Numero = 2; oDip1.lstDomainesCompetences.Add(oDC2); DomaineCompetence oDC1 = new DomaineCompetence(); oDC1.Nom = "DC1"; oDC1.Numero = 1; oDip1.lstDomainesCompetences.Add(oDC1); ctx.Diplomes.Add(oDip1); SaveChanges(); oDip2 = ctx.Diplomes.Find(oDip1.ID); //Suppression du Diplome => Sup^pression des Domaines de compétences ctx.Diplomes.Remove(oDip2); SaveChanges(); }
public ActionResult update2(String cin, String msg) { ViewBag.messageconfirm = msg; Candidat candidat = db.Candidats.Find(Session["CIN"]); int iddip = candidat.id_diplome; Diplome dip = db.Diplomes.Find(iddip); ViewBag.nomdip = dip.nom_diplome; ViewBag.villedip = dip.ville_diplome; ViewBag.etab = dip.etablissement; int idnote = candidat.id_note; Notes n = db.Notes.Find(idnote); ViewBag.s1 = n.s1; ViewBag.s2 = n.s2; ViewBag.s3 = n.s3; ViewBag.s4 = n.s4; ViewBag.s5 = n.s5; ViewBag.s6 = n.s6; ViewBag.CIN = cin; return(View(candidat)); }
/// <summary> /// Récupère une Diplome à partir d'un identifiant de client /// </summary> /// <param name="Identifiant">Identifant de Diplome</param> /// <returns>Un Diplome </returns> public static Diplome Get(Int32 identifiant) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"SELECT Identifiant, Libelle, Niveau FROM Diplome WHERE Identifiant = @Identifiant"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Identifiant", identifiant); //Execution connection.Open(); SqlDataReader dataReader = commande.ExecuteReader(); dataReader.Read(); //1 - Création du Diplome Diplome diplome = new Diplome(); diplome.Identifiant = dataReader.GetInt32(0); diplome.Libelle = dataReader.GetString(1); diplome.Niveau = dataReader.GetString(2); dataReader.Close(); connection.Close(); return diplome; }
internal GestionDiplomes(string Cin, string useMode, Diplome D) { InitializeComponent(); loadYears(); this.Cin = Cin; this.useMode = useMode; this.D = D; }
public void TestFind() { // test du find simple Diplome resultat = creerDiplome("TEST_1"); Diplome resultatFind = DiplomeDAO.find(resultat.id); Assert.AreEqual("TEST_1", resultatFind.libelle); }
public void TestAjoutDiplome() { DiplomeCand oDipC = oCand.AddDiplome(oDip); Diplome oDipDefaut = Diplome.getDiplomeParDefaut(); Assert.AreEqual(oDip.ID, oDipC.oDiplome.ID); }
public InputModifUEForm(string name, UniteEnseignement ue, Diplome diplome) : this(name, diplome) { input = false; ueModifie = ue; this.nomBox.Text = ue.libelle; this.periodeComboBox.SelectedValue = ue.periode; load(); }
public InputModifUEForm(string name, Diplome diplome) { input = true; this.Text = name; this.diplome = diplome; InitializeComponent(); load(); }
internal void bindDataToInterface(Diplome D) { cmbDiplome.SelectedItem = D.DIPLOME; txtSpecialite.Text = D.SPECIALITE; cmbMention.SelectedItem = D.MENTION; cmbAnnee.SelectedItem = D.ANNEE; txtInstitution.Text = D.INSTITUTION; }
/// <summary> /// Constructeur de modification /// </summary> /// <param name="name">nom de la fenetre</param> /// <param name="d">diplome a modifier</param> public InputModifDiplomeForm(string name, Diplome d) { input = false; this.Text = name; this.modifId = d.id; InitializeComponent(); this.nomBox.Text = d.libelle; }
public Livret1VM() : base() { Livret oReturn = null; oReturn = new Livret1(); oReturn.oDiplome = Diplome.getDiplomeParDefaut(); TheItem = oReturn; }
public DiplomeView(Diplome d) { this.d = d; InitializeComponent(); ueGridViewLoad(); ecGridViewLoad(); ecDetailGridViewLoad(); }
public void TestCreationDiplome() { // test la création d'un diplome et la recherche grace à son libelle Diplome resultat = creerDiplome("TEST_1"); Assert.AreNotEqual("", resultat.libelle); Assert.AreEqual("TEST_1", resultat.libelle); Assert.IsTrue(resultat.id > 0); }
/** * 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); }
public ActionResult DeleteConfirmed(decimal id) { Diplome diplome = db.Diplome.Find(id); diplome.archived = 0; db.Entry(diplome).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }
public InputModifAnneeForm(String name, Diplome d, Annee a) { input = false; this.Text = name; this.modifId = a.id; this.d = d; InitializeComponent(); this.nomBox.Text = a.libelle; }
/// <summary> /// Évènement changement de sélection diplome /// </summary> private void diplomeGridView_SelectionChanged(object sender, EventArgs e) { Diplome d = getCurrentDiplome(); if (d != null) { anneeGridViewLoad(); } }
public static List <UniteEnseignement> findByLibelle(String libelle) { MySqlConnection _connection = ConnectionMySql.getInstance(); MySqlCommand _cmd = new MySqlCommand(); _cmd.Connection = _connection; String sql = ""; MySqlDataReader reader = null; List <UniteEnseignement> resultats = new List <UniteEnseignement>(); try { sql = "SELECT unite_enseignement.id as uniteEnsID, unite_enseignement.libelle as uniteEnsLibelle, " + "periode.id AS periodeID, periode.libelle AS periodeLibelle, " + "annee.id AS anneeId, annee.libelle AS anneeLibelle, " + "diplome.id AS diplomeID, diplome.libelle AS diplomeLibelle " + "FROM unite_enseignement " + "JOIN periode ON unite_enseignement.periode_id = periode.id " + "JOIN annee ON periode.annee_id = annee.id " + "JOIN diplome ON annee.diplome_id = diplome.id " + "WHERE unite_enseignement.libelle LIKE @libelle"; _cmd.CommandText = sql; _cmd.Parameters.AddWithValue("@libelle", libelle); reader = _cmd.ExecuteReader(); while (reader.Read()) { UniteEnseignement tempUnite = populateUniteEnseignement(reader); Diplome tempDiplome = DiplomeDAO.populateDiplome(reader); Annee tempAnnee = AnneeDAO.populateAnnee(reader); tempAnnee.diplome = tempDiplome; Periode tempPeriode = PeriodeDAO.populatePeriode(reader); tempPeriode.annee = tempAnnee; tempUnite.periode = tempPeriode; resultats.Add(tempUnite); } reader.Close(); } catch (Exception e) { Console.WriteLine("Exception : " + e); } _cmd.Dispose(); return(resultats); }
public Livret1VM(Boolean pIsCandidatLocked) : base(pIsCandidatLocked) { Livret oReturn = null; oReturn = new Livret1(); oReturn.oDiplome = Diplome.getDiplomeParDefaut(); TheItem = oReturn; }
/// <summary> /// Supprimer un diplome /// </summary> private void supDiplome(object sender, EventArgs e) { Diplome d = getCurrentDiplome(); if (d != null) { DiplomeDAO.delete(d); diplomeViewLoad(); } }
public static void Insert(Diplome Diplome) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"INSERT INTO Diplome (Libelle, Niveau) VALUES (@Libelle, @Niveau)"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Libelle", Diplome.Libelle); commande.Parameters.AddWithValue("Libelle", Diplome.Niveau); //Execution connection.Open(); commande.ExecuteNonQuery(); connection.Close(); }
public static void Update(Diplome Diplome) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"UPDATE Diplome SET Libelle = @Libelle, Niveau = @Niveau WHERE Identifiant = @Identifiant"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Libelle", Diplome.Libelle); commande.Parameters.AddWithValue("Niveau", Diplome.Niveau); commande.Parameters.AddWithValue("Identifiant", Diplome.Niveau); //Execution connection.Open(); commande.ExecuteNonQuery(); connection.Close(); }
/// <summary> /// Récupère une liste de Diplome à partir de la base de données /// </summary> /// <returns>Une liste de client</returns> public static List<Diplome> List() { //Récupération de la chaine de connexion //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = "SELECT Identifiant, Libelle, Niveau FROM Diplome"; connection.Open(); SqlCommand commande = new SqlCommand(requete, connection); //execution SqlDataReader dataReader = commande.ExecuteReader(); List<Diplome> list = new List<Diplome>(); while (dataReader.Read()) { //1 - Créer un Diplome à partir des donner de la ligne du dataReader Diplome diplome = new Diplome(); diplome.Identifiant = dataReader.GetInt32(0); diplome.Libelle = dataReader.GetString(1); diplome.Niveau = dataReader.GetString(2); //2 - Ajouter ce Diplome à la list de client list.Add(diplome); } dataReader.Close(); connection.Close(); return list; }
/// <summary> /// Met à jour l'état en bas pour l'utilisateur /// </summary> /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param> /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param> public void MiseAJourEtat(string typeEtat, Diplome lib) { //Je racalcul le nombre max d'élements this.recalculMax(); //En fonction de l'libion, j'affiche le message if (typeEtat == "Filtrage") { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "filtrage des diplomes terminé : " + this.mesDiplomes.Count() + " / " + this.max; } else if (typeEtat == "Ajout") { //J'ajoute la commande_fournisseur dans le linsting this.mesDiplomes.Add(lib); //Je racalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un diplome dénommé '" + lib.Libelle + "' effectué avec succès. Nombre d'élements : " + this.mesDiplomes.Count() + " / " + this.max; } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Modification du diplome dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesDiplomes.Count() + " / " + this.max; } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.mesDiplomes.Remove(lib); //Je racalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Suppression du diplome dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesDiplomes.Count() + " / " + this.max; } else if (typeEtat == "Look") { } else { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Chargement des diplomes terminé : " + this.mesDiplomes.Count() + " / " + this.max; } //Je retri les données dans le sens par défaut this.triDatas(); //J'arrete la progressbar ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; }
/// <summary> /// Ajoute un nouveau diplome à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Diplome Add() { //Affichage du message "ajout en cours" ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un diplome en cours ..."; //Initialisation de la fenêtre DiplomeWindowParametre diplomeWindowparametre = new DiplomeWindowParametre(); //Création de l'objet temporaire Diplome tmp = new Diplome(); //Mise de l'objet temporaire dans le datacontext diplomeWindowparametre.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = diplomeWindowparametre.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { //Si j'appuie sur le bouton Ok, je renvoi l'objet banque se trouvant dans le datacontext de la fenêtre return (Diplome)diplomeWindowparametre.DataContext; } else { try { //On détache la commande ((App)App.Current).mySitaffEntities.Detach((Diplome)diplomeWindowparametre.DataContext); } catch (Exception) { } //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un diplome annulé : " + this.mesDiplomes.Count() + " / " + this.max; return null; } }