public void Select() { Debug.Log(gameObject + ": now selected"); selectedObject = this; isSelected = true; ChangeElementsColor(selectedMaterial); }
public async Task <IActionResult> PutGroupe([FromRoute] int id, [FromBody] Groupe groupe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != groupe.GroupeId) { return(BadRequest()); } _context.Entry(groupe).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroupeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void GetNbCellulesNonTrouvées_ValeurNonNulleEtNulle() { Cellule c = null; Groupe g = GénérerGroupe( c = GénérerCellule(valeurFixe: 3, possibilités: new List <int> { 1, 7, 8, 3 }), GénérerCellule(valeurTrouvé: 2, possibilités: new List <int> { 1, 7, 8, 3 }), GénérerCellule(possibilités: new List <int> { 1, 2, 8, 6, 7 }), GénérerCellule(possibilités: new List <int> { 1, 2, 3 }), GénérerCellule(possibilités: new List <int> { 4, 5, 6 }), GénérerCellule(possibilités: new List <int> { 1, 2, 7, 8 }) ); Assert.AreEqual(4, g.GetNbCellulesNonTrouvées()); }
public ActionResult Creer_Groupe(Groupe g) { Groupe grp = new Groupe(); var cne = HttpContext.Session.GetInt32("etudiant"); Etudiant e = context.etudiants.SingleOrDefault(p => p.cne == cne); grp.id_filiere = e.id_fil; context.groupes.Add(grp); context.SaveChanges(); this.idgrp = grp.id_grp; GroupeMembre createur = new GroupeMembre { grp_id = this.idgrp, id_et = cne, }; context.groupeMembres.Add(createur); context.SaveChanges(); ViewBag.grpmm = "fait"; var list = context.groupeMembres.Where(x => x.grp_id == this.idgrp).ToList(); var listmembre = context.etudiants.Where(x => x.Filiere.Id_filiere == e.Filiere.Id_filiere); ViewBag.e = listmembre; return(RedirectToAction("InviterGroupe", list)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Seance = await _context.Seance .Include(s => s.LUE) .Include(s => s.LaSalle) .ThenInclude(s => s.LeBatiment) .Include(s => s.LeGroupe) .Include(s => s.Type).FirstOrDefaultAsync(m => m.ID == id); if (Seance == null) { return(NotFound()); } ViewData["UEID"] = new SelectList(_context.UE, "ID", "Intitule"); ViewData["SalleID"] = new SelectList(_context.Salle, "ID", "toString"); //ViewData["GroupeID"] = new SelectList(_context.Groupe, "ID", "toString"); ViewData["TypeID"] = new SelectList(_context.TypeSeance, "ID", "Intitule"); var Groupes = _context.Groupe.ToList(); //Je récupère les groupes pour avoir leur UE avec Groupe nullGrp = new Groupe(); //Je créer un groupe Tout le Monde nullGrp.ID = -1; nullGrp.NomGroupe = "Tout le Monde"; listGroupes.Add(nullGrp); foreach (Groupe grp in Groupes) //Je remplis ma liste avec mes groupes { listGroupes.Add(grp); } return(Page()); }
public async Task <IActionResult> Edit(int id, [Bind("Id_groupe,Designation_groupe,Fk_Filiere")] Groupe groupe) { if (id != groupe.Id_groupe) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(groupe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroupeExists(groupe.Id_groupe)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Fk_Filiere"] = new SelectList(_context.Filiere, "Id_Filiere", "Id_Filiere", groupe.Fk_Filiere); return(View(groupe)); }
public override void WriteEntityToField() { Groupe groupe = (Groupe)this.Entity; nomTextBox.Text = groupe.Nom; comboBoxFiliere.SelectedItem = groupe.Filiere; }
public void OperatorPlus_Union() { Cellule[] cells = new Cellule[] { GénérerCellule(valeurFixe: 4, possibilités: new List <int> { 1, 2 }), GénérerCellule(valeurTrouvé: 3, possibilités: new List <int> { 2, 4, 6 }), GénérerCellule(possibilités: new List <int> { 1, 2, 4, 7 }), GénérerCellule(possibilités: new List <int> { 6, 7, 8, 9 }), GénérerCellule(possibilités: new List <int> { 1, 2, 8, 9 }) }; Groupe g1 = GénérerGroupe(cells[0], cells[2], cells[3], cells[4]); Groupe g2 = GénérerGroupe(cells[1], cells[2], cells[3]); Assert.AreEqual(4, g1.Count); Assert.AreEqual(3, g2.Count); Groupe g = g1 + g2; Assert.AreEqual(5, g.Count); foreach (Cellule c in cells) { Assert.IsTrue(g.Contains(c)); } }
public static void Initialize() { ITEM = RegisterEntityBlueprint(new GenericEntityBlueprint <ItemEntity>("item")); BELT = RegisterEntityBlueprint(new GenericEntityBlueprint <Belt>("belt")); BOAT = RegisterEntityBlueprint(new GenericEntityBlueprint <Boat>("boat")); CHEST = RegisterEntityBlueprint(new GenericEntityBlueprint <Chest>("chest")); CHIKEN = RegisterEntityBlueprint(new GenericEntityBlueprint <Chicken>("chiken")); CRAFTING_BENCH = RegisterEntityBlueprint(new GenericEntityBlueprint <Bench>("crafting_bench")); DOG = RegisterEntityBlueprint(new GenericEntityBlueprint <Dog>("dog")); FISH = RegisterEntityBlueprint(new GenericEntityBlueprint <Fish>("fish")); FLOWER = RegisterEntityBlueprint(new GenericEntityBlueprint <Flower>("flower")); FURNACE = RegisterEntityBlueprint(new GenericEntityBlueprint <Furnace>("furnace")); GRASS = RegisterEntityBlueprint(new GenericEntityBlueprint <Grass>("grass")); PLAYER = RegisterEntityBlueprint(new GenericEntityBlueprint <Player>("player")); STAIRES = RegisterEntityBlueprint(new GenericEntityBlueprint <Stairs>("staires")); TNT = RegisterEntityBlueprint(new GenericEntityBlueprint <TNT>("tnt")); TORCH = RegisterEntityBlueprint(new GenericEntityBlueprint <Torch>("torch")); LANTERN = RegisterEntityBlueprint(new GenericEntityBlueprint <Lamp>("lantern")); TREE = RegisterEntityBlueprint(new GenericEntityBlueprint <EntityTree>("tree")); ZOMBIE = RegisterEntityBlueprint(new GenericEntityBlueprint <Zombie>("zombie")); XPORB = RegisterEntityBlueprint(new GenericEntityBlueprint <XpOrb>("xporb")); GROUPE_CREATURE = new Groupe <EntityBlueprint>("creature", CHIKEN, FISH, PLAYER, ZOMBIE); GROUPE_TREE = new Groupe <EntityBlueprint>("tree", TREE); GROUPE_SAVE_EXCUDED = new Groupe <EntityBlueprint>("save_excluded", PLAYER); }
public override void ExecuteShowDetailsCommand(object selectedItem) { if (selectedItem is Adherent) { this.SelectedGroupe = selectedItem as Groupe; } }
public async Task CreateGroup(string name, int adminId) { Groupe g = new Groupe(); g.nom = name; g.admin = adminId; var jsonObj = JsonConvert.SerializeObject(g); var buffer = System.Text.Encoding.UTF8.GetBytes(jsonObj); HttpResponseMessage response = null; try { using (HttpClient client = new HttpClient()) using (var byteContent = new ByteArrayContent(buffer)) { byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); response = await client.PostAsync(BaseAddress + "api/groupe/creategroup", byteContent); } } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } response?.Dispose(); }
private void Button_Enregistrer(object sender, RoutedEventArgs e) { Personne p = new Personne(); p.nom = text_nom.Text.Trim(); p.prenom = text_prenom.Text.Trim(); p.email = text_email.Text.Trim(); p.mobile = text_mobile.Text.Trim(); Adresse a = new Adresse(); a.numeroappartement = text_numeroappart.Text.Trim(); a.numerorue = text_numerorue.Text.Trim(); a.nomrue = text_nomrue.Text.Trim(); a.ville = text_ville.Text.Trim(); Genre g = new Genre(); g.type = text_type.Text.Trim(); Groupe gr = new Groupe(); gr.groupe = text_groupe.Text.Trim(); GestionManagersPersonne.AddPersonne(p); GestionManagersAdresse.AddAdresse(a); GestionManagersGenre.AddGenre(g); GestionManagersGroupe.AddGroupe(gr); UpdateList(); }
public void Contient_AvecCellulesFixésEtTrouvés() { Cellule[] cells = new Cellule[] { GénérerCellule(valeurFixe: 5, possibilités: new List <int> { 1, 2, 5 }), GénérerCellule(valeurTrouvé: 3, possibilités: new List <int> { 2, 4, 3, 6 }), GénérerCellule(possibilités: new List <int> { 1, 2, 4, 7 }), GénérerCellule(possibilités: new List <int> { 6, 7, 8 }), GénérerCellule(possibilités: new List <int> { 1, 2, 8 }) }; Groupe g = GénérerGroupe(cells); // Cellule Trouvé contenant 3 Assert.IsFalse(g.Contient(3)); // Cellule Fixée contenant 5 Assert.IsFalse(g.Contient(5)); // Cas classiques Assert.IsTrue(g.Contient(1)); Assert.IsTrue(g.Contient(6)); Assert.IsFalse(g.Contient(9)); }
public IHttpActionResult PutGroupe(int id, Groupe groupe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != groupe.Id) { return(BadRequest()); } db.Entry(groupe).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GroupeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Edit(int id, [Bind("Groupe_id,Groupe_designation,Option_id_FK")] Groupe groupe) { if (id != groupe.Groupe_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(groupe); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroupeExists(groupe.Groupe_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Option_id_FK"] = new SelectList(_context.Options, "Option_id", "Option_id", groupe.Option_id_FK); return(View(groupe)); }
private void Valider([Bind(Include = "id_Groupe,id_Cours,id_Sess,id_Enseignant,NoGroupe")] Groupe groupe) { if (_db.Groupe.Any(r => r.NoGroupe == groupe.NoGroupe && r.id_Sess == groupe.id_Sess && r.id_Cours == groupe.id_Cours)) { ModelState.AddModelError(string.Empty, Messages.GroupeAyantLeMemeNumero(groupe.NoGroupe)); } }
private ActionResult CreateEdit([Bind(Include = "id_Groupe,id_Cours,id_Sess,id_Enseignant,NoGroupe")] Groupe groupe, bool ajouter = false) { groupe.id_Enseignant = groupe.id_Enseignant ?? SessionBag.Current.id_Pers; Valider(groupe); if (ModelState.IsValid) { if (!ajouter) { _db.Entry(groupe).State = EntityState.Modified; } else { _db.Groupe.Add(groupe); } _db.SaveChanges(); TempData["Questions"] = string.Format(Messages.GroupeCreeAssocierEtudiant(groupe.NoGroupe)); TempData["idg"] = groupe.id_Groupe; return(RedirectToAction("Index")); } ViewBag.id_Cours = new SelectList(_db.Cours, "id_Cours", "CodeNom", groupe.id_Cours); ViewBag.id_Enseignant = new SelectList(_db.Personne, "id_Pers", "NomPrenom", groupe.id_Enseignant); ViewBag.id_Sess = new SelectList(_db.Session, "id_Sess", "NomSession", groupe.id_Sess); ViewBag.Disabled = SDisabled(); return(View(groupe)); }
public Formation(int id, Formateur formateur, Module module, Groupe groupe, AnneeFormation anneformation) { this.id = id; this.formateur = formateur; this.module = module; this.groupe = groupe; this.anneformation = anneformation; }
public ImageGroupe(Groupe groupe) { this.groupe = groupe; init(); //imageGroupe = System.Drawing.Image.FromFile(poule.sourceImage); imageGroupe = new Bitmap(poule.sourceImage); }
public ImageGroupe(Groupe groupe) { this.Groupe = groupe; init(); imageGroupe = new Bitmap(Organisation.sourceImage); }
public ActionResult AfficherGroupe(Groupe grp) { var groupe = dbContext.Groupes.SingleOrDefault(e => e.Id == grp.Id); dbContext.SaveChanges(); ModelState.AddModelError("success_parents", "Modifications approuvées."); return(View(groupe)); }
public UpdateGroupeClientPage(Groupe groupe) { InitializeComponent(); var ViewModel = new UpdateClientGroupeViewModel(); ViewModel.Groupe = groupe; BindingContext = ViewModel; }
void Start() { GameObject groupeObj = Instantiate(groupePrefab, Vector3.zero, Quaternion.identity); Groupe groupe = groupeObj.GetComponent <Groupe>(); groupe.AllAgents = new GameObject[groupe.g_NumFloakAgents]; groupe.SetupScene(); }
public ActionResult DeleteConfirmed(int id) { Groupe groupe = db.Groupes.Find(id); db.Groupes.Remove(groupe); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void ReadFormToEntity() { Groupe groupe = (Groupe)this.Entity; groupe.Nom = nomTextBox.Text; groupe.Filiere = new FilieresService(Service.Context()). GetByID(((Filiere)comboBoxFiliere.SelectedItem).Id); }
public FormulaireGroupeVM() { this.CreateRepositories(); this.CurrentGroupe = new Groupe(); this.UCParentCode = CodesUC.ConsultationGroupes; this.PopulateCombos(); this.CurrentGroupe.Saison = this.repoSaison.GetAll().Where(s => s.EstSaisonCourante).FirstOrDefault(); }
public ActionResult Edit(int id) { GroupeRepository Gr = new GroupeRepository(ConfigurationManager.ConnectionStrings["CnstrDev"].ConnectionString); Groupe G = Gr.GetOne(id); //Entity EditGroupModel Gm = MapToDBModel.GroupToEditGroupModel(G); ViewBag.Current = "Groupe"; return(View(Gm)); }
public static List<int> GetDroits(Groupe groupeUti) { List<int> lstDroits = new List<int>(); foreach(Forms f in groupeUti.Forms) { lstDroits.Add(f.idForm); } return lstDroits; }
public static GroupModel GroupToGroupModel(Groupe g) { return(new GroupModel() { IdGroupe = g.IdGroupe, Description = g.Description, Nom = g.Nom }); }
public void AffectGroupeTOEvent(Groupe groupe, Event eventt) { Event event2 = context.events.Find(eventt.Id); event2.groupes.Add(groupe); //call SaveChanges from context to confirm inserts context.SaveChanges(); }
public static DetailsGroupModel GroupToDetails(Groupe groupe) { return(new DetailsGroupModel() { LeGroupe = MapToDBModel.GroupToEditGroupModel(groupe), LEvent = MapToDBModel.EvenementToEventModel(groupe.Evenement), Membres = groupe.MembreGroupe.Select(e => MapToDBModel.MemberToProfile(e)).ToList() }); }
public static Groupe GetGroupByName(string groupeName) { Groupe groupeResult = new Groupe(); foreach (Groupe groupe in CtrlGroupe.GetAllGroupe()) { if (groupe.nomGroupe == groupeName) { groupeResult = groupe; } } return groupeResult; }
/// <summary> /// Ajoute une nouvelle civilité à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Groupe 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 groupe en cours ..."; //Initialisation de la fenêtre GroupeWindow groupeWindow = new GroupeWindow(); //Création de l'objet temporaire Groupe tmp = new Groupe(); //Mise de l'objet temporaire dans le datacontext groupeWindow.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = groupeWindow.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 (Groupe)groupeWindow.DataContext; } else { try { //On détache la commande ((App)App.Current).mySitaffEntities.Detach((Groupe)groupeWindow.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 groupe annulé : " + this.mesGroupes.Count() + " / " + this.max; return null; } }
/// <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, Groupe 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 groupes terminé : " + this.mesGroupes.Count() + " / " + this.max; } else if (typeEtat == "Ajout") { //J'ajoute la commande_fournisseur dans le linsting this.mesGroupes.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 groupe dénommé '" + lib.Libelle + "' effectué avec succès. Nombre d'élements : " + this.mesGroupes.Count() + " / " + this.max; } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Modification d'un groupe dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesGroupes.Count() + " / " + this.max; } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.mesGroupes.Remove(lib); //Je racalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Suppression d'un groupe dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesGroupes.Count() + " / " + this.max; } else if (typeEtat == "Look") { } else { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Chargement des groupes terminé : " + this.mesGroupes.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> /// Ouvre la civilité séléctionnée à l'aide d'une nouvelle fenêtre /// </summary> public Groupe Look(Groupe groupe) { if (this._DataGridMain.SelectedItem != null || groupe != null) { if (this._DataGridMain.SelectedItems.Count == 1 || groupe != null) { //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Affichage d'un groupe en cours ..."; //Création de la fenêtre GroupeWindow groupeWindow = new GroupeWindow(); //Initialisation du Datacontext en Commande_Fournisseur et association à l'ativite sélectionnée groupeWindow.DataContext = new Groupe(); if (groupe == null) { groupeWindow.DataContext = (Groupe)this._DataGridMain.SelectedItem; } else { groupeWindow.DataContext = groupe; } //Je positionne la lecture seule sur la fenêtre groupeWindow.lectureSeule(); //J'affiche la fenêtre bool? dialogResult = groupeWindow.ShowDialog(); //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Affichage d'un groupe terminé : " + this.mesGroupes.Count() + " / " + this.max; //Renvoi null return null; } else { MessageBox.Show("Vous ne devez sélectionner qu'un seul groupe.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } } else { MessageBox.Show("Vous devez sélectionner un groupe.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } }