public async Task <IHttpActionResult> Putcategorie(string id, categorie categorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != categorie.NOM) { return(BadRequest()); } db.Entry(categorie).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!categorieExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Putcategorie(int id, categorie categorie) { if (id != categorie.categorieId) { return(BadRequest()); } _context.Entry(categorie).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!categorieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <categorie> > Postcategorie(categorie categorie) { _context.categorie.Add(categorie); await _context.SaveChangesAsync(); return(CreatedAtAction("Getcategorie", new { id = categorie.categorieId }, categorie)); }
public static List <categorie> GetCatProduits() { var listcatproduits = new List <categorie>(); var cmd3 = new SqlCommand(); cmd3.CommandText = @"select CategoryId, Name, Description from Category order by 1"; using (var cnx3 = new SqlConnection(Settings1.Default.Northwind2Connect)) { cmd3.Connection = cnx3; cnx3.Open(); using (SqlDataReader sdr3 = cmd3.ExecuteReader()) { while (sdr3.Read()) { categorie MaCat = new categorie(); MaCat.Categoryid = (Guid)sdr3["CategoryId"]; MaCat.Name = (string)sdr3["Name"]; MaCat.Description = (string)sdr3["Description"]; listcatproduits.Add(MaCat); } } } return(listcatproduits); }
public PageQuestionnaire(categorie lacategorie, DataQuiz donneesRecup) { mesdonnees = donneesRecup; InitializeComponent(); chargerlesquestions(lacategorie, mesdonnees); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); MasterTitle = Page.Title = EntityId == 0 ? GetMessage("PageTitle.Creation") : string.Concat(GetMessage("PageTitle.Modification"), " #", EntityId.ToString()); if (EntityId == 0) this.entity = new categorie(); else if ((this.entity = categorie.GetById(EntityId)) == null) { this.editorError = categorieEditorError.IsNotFound; this.errorMessageText = GetMessageRaw("Message.categorieIsNotFound"); return; } if (!IsPostBack) { if (!this.entity.IsNew) { name.Text = this.entity.name; sourceid.Text = this.entity.sourceid.ToString(); description.Text = this.entity.description; } } }
public async Task <IHttpActionResult> Postcategorie(categorie categorie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.categorie.Add(categorie); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (categorieExists(categorie.NOM)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = categorie.NOM }, categorie)); }
private GameObject initGameobject(categorie cat, int id) { GameObject toReturn = new GameObject(); switch (cat) { case categorie.essential: toReturn = Instantiate(essentialPrefabs[id]); break; case categorie.shot: toReturn = Instantiate(shotPrefabs[id]); break; case categorie.enemy: toReturn = Instantiate(enemyPrefabs[id]); break; case categorie.islands: toReturn = Instantiate(ilandsPrefabs[id]); break; case categorie.structures: toReturn = Instantiate(structuresPrefabs[id]); break; case categorie.explosion: toReturn = Instantiate(explosionPrefabs[id]); break; case categorie.items: toReturn = Instantiate(itemPrefabs[id]); break; case categorie.planes: toReturn = Instantiate(planePrefabs[id]); break; default: toReturn = null; break; } toReturn.SetActive(false); return(toReturn); }
/// <summary> /// This method gives you an object out of the pool. You still need to reset it's values! /// </summary> /// <param name="cat"></param> /// <param name="id">Cast the wanted enum into an Integer.</param> /// <returns>The active Object, needs an reset of it's values!</returns> public GameObject getObject(categorie cat, int id) { GameObject toReturn; if (cat == categorie.essential) { toReturn = pool[(int)cat][id].Pop(); pool[(int)cat][id].Push(toReturn); } else { if (pool[(int)cat][id].Count == 0) { pool[(int)cat][id].Push(initGameobject(cat, id)); } toReturn = pool[(int)cat][id].Pop(); activeObjects.Add(toReturn); toReturn.AddComponent <ObjectPoolAgent>(); toReturn.GetComponent <ObjectPoolAgent>().tag_cat = cat; toReturn.GetComponent <ObjectPoolAgent>().tag_id = id; toReturn.SetActive(true); } toReturn.SetActive(true); // TODO return(toReturn); }
public ActionResult DeleteConfirmed(int id) { categorie categorie = db.categories.Find(id); db.categories.Remove(categorie); db.SaveChanges(); return(RedirectToAction("Index")); }
public FenetreSupprimerCategorie(FenetreRetrait f, categorie c) { InitializeComponent(); _fen = f; _cat = c; lTitre.Text = "Êtes vous sûr de vouloir supprimer la catégorie suivante : "; lNomElement.Text = _cat.nom; }
private void enregistrer() { //Enregistrer dans les tables les modifications et / ou ajouts foreach (DataGridViewRow row in dataGridView1.Rows) { String nomColonne, nomLigne; // Enregistre le nombre d'heures dans la classe Categorie : nomLigne = row.Cells[0].Value.ToString(); categorie categorie = Requetes.retrouveCategorieViaTexte(nomLigne); categorie.nbrHeureDues = Convert.ToInt32(row.Cells[1].Value); // Enregistre les ratios entre catégories et type de cours dans la classe equivalent_td for (int i = 2; i < dataGridView1.Columns.Count; i++) { nomColonne = dataGridView1.Columns[i].HeaderText; nomLigne = row.Cells[0].Value.ToString(); type_cours typC = Requetes.retrouveTypeDeCoursViaTexte(nomColonne); categorie cat = Requetes.retrouveCategorieViaTexte(nomLigne); equivalent_td equivalent = new equivalent_td(); if (row.Cells[i].Value.ToString().Contains('.')) // Format décimal avec un point comme virgule (a.aaaa) { equivalent.ratio = Math.Round(Convert.ToDouble(row.Cells[i].Value.ToString().Replace('.', ',')), 6); } else if (row.Cells[i].Value.ToString().Contains('/')) // Format décimal sous forme de fraction (a/b) { String[] data = row.Cells[i].Value.ToString().Split('/'); equivalent.ratio = Math.Round((Convert.ToDouble(data[0]) / Convert.ToDouble(data[1])), 6); } else // Format décimal classique avec une virgule (a,aaaa) { equivalent.ratio = Math.Round(Convert.ToDouble(row.Cells[i].Value), 6); } equivalent.id_categ = cat.id; equivalent.id_type_cours = typC.id; equivalent.categorie = cat; equivalent.type_cours = typC; // Ajoute ou met à jour Requetes.ajouterEquivalentTD(equivalent); } } // Sauvegarde les modifications Requetes.enregistreLaBDD(); Actualiser(); }
public ActionResult Edit([Bind(Include = "categorieId,categorieNaam,aantalPersonen,aantalKoffers")] categorie categorie) { if (ModelState.IsValid) { db.Entry(categorie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categorie)); }
public async Task <IHttpActionResult> Getcategorie(string id) { categorie categorie = await db.categorie.FindAsync(id); if (categorie == null) { return(NotFound()); } return(Ok(categorie)); }
public void TestMethod1() { // Arrange var categorie = new categorie(); // Act // Assert Assert.Fail(); }
public ActionResult Create([Bind(Include = "categorieId,categorieNaam,aantalPersonen,aantalKoffers")] categorie categorie) { if (ModelState.IsValid) { db.categories.Add(categorie); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categorie)); }
public StatusCodeResult Post([FromBody] categorie newCategorie) { try { _context.categorie.Add(newCategorie); _context.SaveChanges(); return(Ok()); } catch { return(BadRequest()); } }
public StatusCodeResult Put([FromBody] categorie changedCategorie) { try { _context.categorie.Update(changedCategorie); _context.SaveChanges(); return(Ok()); } catch { return(BadRequest()); } }
public StatusCodeResult Delete(int id) { try { categorie verwijder = _context.categorie.Find(id); _context.categorie.Remove(verwijder); _context.SaveChanges(); return(Ok()); } catch { return(BadRequest()); } }
// GET: categories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } categorie categorie = db.categories.Find(id); if (categorie == null) { return(HttpNotFound()); } return(View(categorie)); }
public async Task <IHttpActionResult> Deletecategorie(string id) { categorie categorie = await db.categorie.FindAsync(id); if (categorie == null) { return(NotFound()); } db.categorie.Remove(categorie); await db.SaveChangesAsync(); return(Ok(categorie)); }
public void retrait(String element, String nom, int index) { if (element == "colonne") // Colonne : Type de Cours { // Tableau dataGridView1.Columns.RemoveAt(index + 2); // + 2 car les deux premières colonnes du tableau ne doivent pas être comptée // BDD //Requete pour retrouver le type_cours possedant le nom choisi type_cours typeDeCoursARetirer = Requetes.retrouveTypeDeCoursViaTexte(nom); if (Requetes.peutSupprimer(typeDeCoursARetirer)) { Requetes.retirerTypeDeCours(typeDeCoursARetirer); } else { MessageBox.Show("Il existe encore des cours de ce type, suppression impossible"); } } else // Ligne : Categorie { // Tableau dataGridView1.Rows.RemoveAt(index); // BDD //Requete pour retrouver la categorie possedant le nom choisi categorie catARetirer = Requetes.retrouveCategorieViaTexte(nom); if (Requetes.peutSupprimer(catARetirer)) { Requetes.retirerCategorie(catARetirer); } else { MessageBox.Show("Il existe encore des proffesseurs de cette categorie, suppression impossible"); } } // Sauvegarde les modifications Requetes.enregistreLaBDD(); enregistrer(); }
public UC_ElementPersonnel(UC_OngletPersonnels cadre, personnel p) : base(cadre) { _personnel = p; InitializeComponent(); gBAffElement.Text = ""; tBNom.Text = _personnel.nom; tBPrenom.Text = _personnel.prenom; tBTelephone.Text = _personnel.telephone; tBAdresseEmail.Text = _personnel.email; tBAdressePost.Text = _personnel.adresse; categorie categ = Requetes.obtientCategorieduPersonnel(_personnel); if (categ != null) { tBCategorie.Text = categ.nom; } tBNbHeuresAttrib.Text = Requetes.nbrHeureAttribuees(_personnel).ToString(); tBNbHeuresNonAttrib.Text = Requetes.nbrHeureManquantes(_personnel).ToString(); }
private void initialiserValeurs() { // Remplie les ratios entre catégorie et type de cours : foreach (DataGridViewRow row in dataGridView1.Rows) { for (int i = 2; i < dataGridView1.Columns.Count; i++) { String nomColonne = dataGridView1.Columns[i].HeaderText; String nomLigne = row.Cells[0].Value.ToString(); type_cours typC = Requetes.retrouveTypeDeCoursViaTexte(nomColonne); categorie cat = Requetes.retrouveCategorieViaTexte(nomLigne); equivalent_td equivalent = Requetes.obtientEquivalentTD(typC, cat); row.Cells[i].Value = equivalent.ratio; } } }
public void ajout(String element, String nom) { if (element == "colonne") // Colonne : Type de Cours { // Tableau dataGridView1.Columns.Add("Column" + dataGridView1.Columns.Count, nom); // Toutes les valeurs à 0 par défaut foreach (DataGridViewRow dgvr in dataGridView1.Rows) { dgvr.Cells[dataGridView1.Columns.Count - 1].Value = 0.0; } // BDD type_cours typCoursAAjouter = new type_cours(); typCoursAAjouter.nom = nom; Requetes.ajouterTypeDeCours(typCoursAAjouter); } else // Ligne : Categorie { // Tableau dataGridView1.Rows.Add(nom); // Toutes les valeurs à 0 par défaut for (int i = 1; i < dataGridView1.Columns.Count; i++) { dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[i].Value = 0.0; } // BDD categorie catAAjouter = new categorie(); catAAjouter.nom = nom; Requetes.ajouterCategorie(catAAjouter); } // Sauvegarde les modifications Requetes.enregistreLaBDD(); enregistrer(); }
private void btnAjouter_Click_1(object sender, EventArgs e) { if (String.IsNullOrEmpty(textLibelle.Text)) { MessageBox.Show("le libellé est obligatoires", "Message Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { categorie categorie = new categorie() { libelle = textLibelle.Text.Trim(), }; if (metier.CreerCategorie(categorie)) { MessageBox.Show("Catégorie créer avec succès", "Message Information", MessageBoxButtons.OK, MessageBoxIcon.Information); textLibelle.Clear(); LoadDataGridView(); } } }
public void chargerlesquestions(categorie lacategorie, DataQuiz donneesRecup) { List <question> ListquestionC = donneesRecup.getQuestionParCategorie(lacategorie.idQuestionnaire); labelQuestion.Text = ListquestionC[compteur].libelleQuestion; List <Reponse> ListReponseQ = donneesRecup.getReponseParQuestion(ListquestionC[compteur].idQuestion); Reponse1.Text = ListReponseQ[0].valeur; //Reponse2.Text = ListReponseQ[1].valeur; //Reponse3.Text = ListReponseQ[2].valeur; //Reponse4.Text = ListReponseQ[3].valeur; //int Max = donneesRecup.getQuestionParCategorie(lacategorie.idQuestionnaire).Count; //while (compteur != Max) //{ // if (Reponse1 != null) // { // compteur++; // labelQuestion.Text = ListquestionC[compteur].libelleQuestion; // } //} }
private void bValider_Click(object sender, EventArgs e) { if ((Utilitaires.conditionsRespectees(tBNom.Text, true, false, false, false, 2, 50)) && (Utilitaires.conditionsRespectees(tBPrenom.Text, true, false, false, false, 2, 50)) && (Utilitaires.conditionsRespecteesEmail(tBAdresseEmail.Text)) && (Utilitaires.conditionsRespecteesAdressePostale(tBAdressePost.Text)) && (Utilitaires.conditionsRespecteesTelephone(tBTelephone.Text)) && (Utilitaires.conditionsRespectees(cBCategorie.Text, cBCategorie))) { lErreur.Visible = false; //Modification d'un personnel _personnel.nom = this.tBNom.Text; _personnel.prenom = this.tBPrenom.Text; _personnel.email = this.tBAdresseEmail.Text; _personnel.adresse = this.tBAdressePost.Text; _personnel.telephone = this.tBTelephone.Text; categorie catActuelle = Requetes.obtientCategorieduPersonnel(_personnel); catActuelle.personnel.Remove(_personnel); categorie catNouvelle = Requetes.retrouveCategorieViaTexte(cBCategorie.Text); _personnel.categorie = catNouvelle; catNouvelle.personnel.Add(_personnel); // Ajouter à la BDD _cadre.modificationConfirmee(); MessageBox.Show("Le personnel " + _personnel.nom + " " + _personnel.prenom + " a été modifié avec succès."); this.Dispose(); } else { lErreur.Visible = true; } }
private void bCreer_Click(object sender, EventArgs e) { if ( (Utilitaires.conditionsRespectees(tBNom.Text, true, false, false, false, 2, 50)) && (Utilitaires.conditionsRespectees(tBPrenom.Text, true, false, false, false, 2, 50)) && (Utilitaires.conditionsRespecteesEmail(tBAdresseEmail.Text)) && (Utilitaires.conditionsRespecteesAdressePostale(tBAdressePost.Text)) && (Utilitaires.conditionsRespecteesTelephone(tBTelephone.Text)) && (Utilitaires.conditionsRespectees(cBCategorie.Text, cBCategorie))) { lErreur.Visible = false; // Créer un personnel personnel per = new personnel(); per.nom = this.tBNom.Text; per.prenom = this.tBPrenom.Text; per.email = this.tBAdresseEmail.Text; per.adresse = this.tBAdressePost.Text; per.telephone = this.tBTelephone.Text; categorie cat = Requetes.retrouveCategorieViaTexte(cBCategorie.Text); cat.personnel.Add(per); per.categorie = cat; // Ajouter à la BDD Requetes.ajouterPersonnel(per); Requetes.enregistreLaBDD(); MessageBox.Show("Le personnel " + per.nom + " " + per.prenom + " a été ajouté avec succès."); _cadre.Actualiser(); } else { lErreur.Visible = true; } }
private void bValider_Click(object sender, EventArgs e) { if (Utilitaires.conditionsRespectees(cBListe.Text, cBListe)) { switch (_element) { case "ligne": { categorie categorieChoisie = new categorie(); //Requete pour retrouver la categorie possedant le nom choisi categorieChoisie = Database.instance.categorie.Where(s => s.nom == cBListe.Text).FirstOrDefault <categorie>(); new FenetreSupprimerCategorie(this, categorieChoisie).Show(); break; } case "colonne": { type_cours typeDeCoursChoisie = new type_cours(); //Requete pour retrouver le type_cours possedant le nom choisi typeDeCoursChoisie = Database.instance.type_cours.Where(s => s.nom == cBListe.Text).FirstOrDefault <type_cours>(); new FenetreSupprimerTypeDeCours(this, typeDeCoursChoisie).Show(); break; } default: break; } } else { lErreur.Visible = true; } }
protected void btnFiles_Click(object sender, EventArgs e) { oggettoHacking = categorie.files; ucHacking.Visible = true; ucHacking.AccettaSpina = false; ucHacking.LivelloHacking = livelloHacking * 2; ucHacking.ParteDaHackerare = hackables.files; ucHacking.Carica(); }
protected void btnInUscita_Click(object sender, EventArgs e) { oggettoHacking = categorie.inuscita; ucHacking.Visible = true; ucHacking.AccettaSpina = true; ucHacking.LivelloHacking = livelloHacking * 2; ucHacking.ParteDaHackerare = hackables.altro; ucHacking.Carica(); }
protected void btnNotizie_Click(object sender, EventArgs e) { oggettoHacking = categorie.notizie; ucHacking.Visible = true; ucHacking.AccettaSpina = false; ucHacking.LivelloHacking = livelloHacking; ucHacking.ParteDaHackerare = hackables.altro; ucHacking.Carica(); }
public bool CreerCategorie(categorie categorie) { ctx.categorie.Add(categorie); return(ctx.SaveChanges() != 0); }