public StadeWS(Stade stade) : base(stade.Id) { this.Caracteristiques = stade.Caracteristiques; this.NbPlaces = stade.NbPlaces; this.planete = stade.Planete; }
public void TestBDD_AjoutSupprMatch() { List <Match> lm = new List <Match>(data.getAllMatch()); // Création du match int id = 42; Jedi pJedi1 = data.getAllJedi().Find(j => j.Id == 8); Jedi pJedi2 = data.getAllJedi().Find(j => j.Id == 13); EPhaseTournoi phase = EPhaseTournoi.Finale; Stade stade = data.getAllStade().Find(c => c.Id == 5); Match match = new Match(id, pJedi1, pJedi2, phase, stade); // Modifications BDD Assert.IsFalse(data.getAllMatch().Any(m => m.Id == id), "Ce match est déjà présent dans la BDD !"); // On vérifie que le match n'est pas déjà présent dans la BDD lm.Add(match); data.updateMatch(lm); Assert.IsTrue(data.getAllMatch().Any(m => m.Id == id), "Le match n'a pas été ajouté"); // On vérifie que le match a bien été rajouté Assert.AreEqual(data.getAllMatch().Find(m => m.Id == id).Jedi1.Id, pJedi1.Id); Assert.AreEqual(data.getAllMatch().Find(m => m.Id == id).Jedi2.Id, pJedi2.Id); Assert.AreEqual(data.getAllMatch().Find(m => m.Id == id).PhaseTournoi, phase); Assert.AreEqual(data.getAllMatch().Find(m => m.Id == id).Stade.Id, stade.Id); lm.Remove(lm.Find(m => m.Id == id)); data.updateMatch(lm); Assert.IsFalse(data.getAllMatch().Any(m => m.Id == id), "Le match n'a pas été supprimé"); // On vérifie que le match a bien été supprimé }
public void testMatch() { Jedi jedi1 = new Jedi(); Jedi jedi2 = new Jedi(); Stade stade = new Stade(42, "Test", 42000, "Tata Ouine", null, null); Stade stade2 = new Stade(18, "Test2", 2000, "Ouine", null, null); Match match = new Match(42, jedi1, jedi2, EPhaseTournoi.Finale, stade); Assert.AreEqual(match.ID, 42); Assert.AreEqual(match.Jedi1, jedi1); Assert.AreEqual(match.Jedi2, jedi2); Assert.AreEqual(match.PhaseTournoi, EPhaseTournoi.Finale); Assert.AreEqual(match.Stade, stade); match.Jedi1 = jedi2; match.Jedi2 = jedi1; match.PhaseTournoi = EPhaseTournoi.DemiFinale; match.Stade = stade2; Assert.AreEqual(match.Jedi1, jedi2); Assert.AreEqual(match.Jedi2, jedi1); Assert.AreEqual(match.PhaseTournoi, EPhaseTournoi.DemiFinale); Assert.AreEqual(match.Stade, stade2); }
public void testTournoi() { Jedi jedi1 = new Jedi(); Jedi jedi2 = new Jedi(); Jedi jedi3 = new Jedi(); Jedi jedi4 = new Jedi(); Stade stade = new Stade(12, "Test", 2000, "Ouine", null, null); Stade stade2 = new Stade(13, "Test2", 4000, "Tata", null, null); List <Match> listMatchs = new List <Match>(); listMatchs.Add(new Match(42, jedi1, jedi2, EPhaseTournoi.QuartFinale, stade)); listMatchs.Add(new Match(56, jedi3, jedi4, EPhaseTournoi.DemiFinale, stade2)); List <Match> listMatchs2 = new List <Match>(); listMatchs2.Add(new Match(2, jedi3, jedi1, EPhaseTournoi.Finale, stade)); Tournoi tournoi = new Tournoi(27, "Le Premier Tournoi", listMatchs); Assert.AreEqual(tournoi.ID, 27); Assert.AreEqual(tournoi.Nom, "Le Premier Tournoi"); Assert.AreEqual(tournoi.Matchs, listMatchs); tournoi.Nom = "Un Nouveau Tournoi"; tournoi.Matchs = listMatchs2; Assert.AreEqual(tournoi.Nom, "Un Nouveau Tournoi"); Assert.AreEqual(tournoi.Matchs, listMatchs2); }
public void testStade() { Stade stade = new Stade(42, "Test", 42000, "Tata Ouine", null, null); Assert.AreEqual(stade.ToString(), "Test (Tata Ouine)"); Assert.AreEqual(stade.ID, 42); Assert.AreEqual(stade.Nom, "Test"); Assert.AreEqual(stade.NbPlaces, 42000); Assert.AreEqual(stade.Planete, "Tata Ouine"); Assert.IsNull(stade.Caracteristiques); Assert.IsNull(stade.Image); List <Caracteristique> listCarac = new List <Caracteristique>(); listCarac.Add(new Caracteristique(12, "Froid Glaciale", EDefCaracteristique.Defense, ETypeCaracteristique.Stade, -2)); listCarac.Add(new Caracteristique(13, "Désert", EDefCaracteristique.Force, ETypeCaracteristique.Stade, -2)); stade.Nom = "Nom Du Stade"; stade.NbPlaces = 18000; stade.Planete = "Mars"; stade.Caracteristiques = listCarac; //stade.Image = ; Assert.AreEqual(stade.ToString(), "Nom Du Stade (Mars)"); Assert.AreEqual(stade.Nom, "Nom Du Stade"); Assert.AreEqual(stade.NbPlaces, 18000); Assert.AreEqual(stade.Planete, "Mars"); Assert.AreEqual(stade.Caracteristiques, listCarac); //Assert.IsNull(stade.Image); }
public void TestBDD_AjoutSupprStade() { List <Stade> ls = new List <Stade>(data.getAllStade()); // Création du stade int id = 42; int nbplaces = 42000; String name = "Youpi"; Caracteristique carac = data.getAllCaracteristic().Find(c => c.Id == 22); List <Caracteristique> lc = new List <Caracteristique>(); lc.Add(carac); Stade stade = new Stade(id, nbplaces, name, lc); // Modifications BDD Assert.IsFalse(data.getAllStade().Any(s => s.Id == id), "Ce stade est déjà présent dans la BDD !"); // On vérifie que le stade n'est pas déjà présent dans la BDD ls.Add(stade); data.updateStade(ls); Assert.IsTrue(data.getAllStade().Any(s => s.Id == id), "Le stade n'a pas été ajouté"); // On vérifie que le stade a bien été rajouté Assert.AreEqual(data.getAllStade().Find(s => s.Id == id).NbPlaces, nbplaces); Assert.AreEqual(data.getAllStade().Find(s => s.Id == id).Planete, name); ls.Remove(ls.Find(s => s.Id == id)); data.updateStade(ls); Assert.IsFalse(data.getAllStade().Any(s => s.Id == id), "Le stade n'a pas été supprimé"); // On vérifie que le stade a bien été supprimé }
public void modMatch(int id, int idJediVainqueur, string nomJedi1, string nomJedi2, string nomStade) { List <Jedi> listJedi = jtm.getAllJedis(); Jedi jedi1 = listJedi.Find(j => j.Nom == nomJedi1); Jedi jedi2 = listJedi.Find(j => j.Nom == nomJedi2); List <Stade> listStade = jtm.getAllStades(); Stade stade = listStade.Find(s => s.Planete == nomStade); List <Match> listMatch = jtm.getAllMatchs(); Match match = listMatch.Find(m => m.ID == id); if (jedi1 != null) { match.Jedi1 = jedi1; } if (jedi2 != null) { match.Jedi2 = jedi2; } if (stade != null) { match.Stade = stade; } jtm.modMatch(match); }
public void TestUpdateStades() { DalManager manager = new DalManager(); List <Stade> list1 = manager.getStades(); Stade updatedStade = list1[0]; updatedStade.NbPlaces = 1000; updatedStade.Planete = "PlanetTest"; manager.UpdateStade(updatedStade); //Modification du premier Stade List <Stade> list2 = manager.getStades(); //Assert.AreEqual(updatedStade, list2[0]); //Test si le premier Stade à bien été modifié Assert.AreEqual(updatedStade.ID, list2[0].ID); Assert.AreEqual(updatedStade.NbPlaces, list2[0].NbPlaces); Assert.AreEqual(updatedStade.Planete, list2[0].Planete); updatedStade.NbPlaces = list1[0].NbPlaces; updatedStade.Planete = list1[0].Planete; manager.UpdateStade(updatedStade); //Reinitialisation du premier Stade list2 = manager.getStades(); //Assert.AreEqual(list1, list2); //Test si le stade est bien réinitialisé Assert.AreEqual(list1[list1.Count - 1].ID, list2[0].ID); Assert.AreEqual(list1[list1.Count - 1].NbPlaces, list2[0].NbPlaces); Assert.AreEqual(list1[list1.Count - 1].Planete, list2[0].Planete); }
public int EditStade(Stade _stade) { int val = 0; using (SqlConnection sqlConnection = new SqlConnection(m_connectionString)) { try { string requete = "UPDATE Stade SET nbPlaces=@nbPlaces, planet=@planet, Pic=@pic WHERE idSade=@idStade"; SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection); sqlCommand.Parameters.AddWithValue("@idjedi", _stade.ID); sqlCommand.Parameters.AddWithValue("@nbPlaces", _stade.NbPlaces); sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete); sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); } catch (SqlException e) { string s = e.Message; } finally { sqlConnection.Close(); } val = 1; } return(val); }
public int InsertStade(Stade _stade) { int val = 0; using (SqlConnection sqlConnection = new SqlConnection(m_connectionString)) { //idStade = auto_increment try { string requete = "INSERT INTO Stade (nbPlaces, planet, Pic) VALUES (@nbplaces, @planet, @pic)"; SqlCommand sqlCommand = new SqlCommand(requete, sqlConnection); sqlCommand.Parameters.AddWithValue("@nbplaces", _stade.NbPlaces); sqlCommand.Parameters.AddWithValue("@planet", _stade.Planete); sqlCommand.Parameters.AddWithValue("@pic", _stade.Photo); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); } catch (SqlException e) { string s = e.Message; } finally { sqlConnection.Close(); } val = 1; } return(val); }
protected void OnRemoveStade(Stade s) { if (this.RemoveStade != null) { this.RemoveStade(this, new StadeEventArgs(s)); } }
public void getUpdateStadesTest() { int taille = 0; int debTaille = 0; List <Stade> liste = bdd.getStades(); debTaille = liste.Count; Assert.AreNotEqual <int>(liste.Count, 0); Assert.AreEqual(2, liste.Find(x => x.Planete == "Kamino").Caracteristiques.Count); if (liste.Count > 0) { Stade j = new Stade(0, 999, "Planete Test", new List <Caracteristique>() { bdd.getCaracteristiques().First() }); liste.Add(j); bdd.updateStades(liste); taille = liste.Count; liste = bdd.getStades(); Assert.AreEqual <int>(taille, liste.Count); Assert.AreNotEqual <int>(0, (liste.Where(x => x.Planete == j.Planete)).ToList().Count); liste.Remove(liste.Last()); bdd.updateStades(liste); Assert.AreEqual(debTaille, bdd.getStades().Count); } }
public void addStade(Stade stade) { string commande = ""; List <Caracteristique> carac = stade.Caracteristiques; if (carac != null) { foreach (Caracteristique c in carac) { addCarac(c); commande += "; INSERT INTO dbo.carac_stade (id_stade, id_carac) VALUES ((SELECT IDENT_CURRENT( 'stade' ))," + c.ID + ")"; } } using (SqlConnection sqlConnection = new SqlConnection(m_connexionString)) { stade.Nom = stade.Nom.Replace("'", "''"); stade.Planete = stade.Planete.Replace("'", "''"); SqlCommand sqlAddStade = new SqlCommand("INSERT INTO dbo.stade (nom, nbPlaces, planete, image) VALUES ('" + stade.Nom + "', " + stade.NbPlaces + ", '" + stade.Planete + "', '" + stade.Image + "')" + commande, sqlConnection); sqlAddStade.Connection = sqlConnection; sqlConnection.Open(); sqlAddStade.ExecuteNonQuery(); sqlConnection.Close(); } }
public void modStade(Stade stade) { string commande = ""; List <Caracteristique> caracs_prev = getStadeCaracs(stade); //.Where(c => c.ID == jedi.ID).ToList(); foreach (Caracteristique c in stade.Caracteristiques) { if (!caracs_prev.Contains(c)) { commande += "; INSERT INTO carac_stade (id_stade, id_carac) VALUES (" + stade.ID + "," + c.ID + ")"; } } foreach (Caracteristique cprev in caracs_prev) { if (!stade.Caracteristiques.Contains(cprev)) { commande += "; DELETE FROM carac_stade WHERE id_stade=" + stade.ID + " AND id_carac=" + cprev.ID; } } using (SqlConnection sqlConnection = new SqlConnection(m_connexionString)) { stade.Nom = stade.Nom.Replace("'", "''"); stade.Planete = stade.Planete.Replace("'", "''"); SqlCommand sqlModStade = new SqlCommand("UPDATE dbo.stade SET nom='" + stade.Nom + "', nbPlaces=" + stade.NbPlaces + ", planete='" + stade.Planete + "', image='" + stade.Image + "' WHERE id=" + stade.ID + "" + commande, sqlConnection); sqlModStade.Connection = sqlConnection; sqlConnection.Open(); sqlModStade.ExecuteNonQuery(); sqlConnection.Close(); } }
public bool UpdateStade(Stade stade) { bool result = false; try { using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); string sql = "UPDATE Stade SET Nom=@Nom, Type=@Type, NbPlaces=@NbPlaces, Attaque=@Attaque, Defense=@Defense WHERE ID=@Id;"; SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection); sqlCommand.Parameters.Add("@Id", SqlDbType.Int).Value = stade.ID; sqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar, 50).Value = stade.Nom; sqlCommand.Parameters.Add("@Type", SqlDbType.Int).Value = (int)stade.Type; sqlCommand.Parameters.Add("@NbPlaces", SqlDbType.Int).Value = stade.NbPlaces; sqlCommand.Parameters.Add("@Attaque", SqlDbType.Int).Value = stade.Attaque; sqlCommand.Parameters.Add("@Defense", SqlDbType.Int).Value = stade.Defense; sqlCommand.CommandType = CommandType.Text; sqlCommand.ExecuteReader(); sqlConnection.Close(); result = true; } } catch (Exception e) { Console.WriteLine(e.Message); result = false; } return(result); }
public void TestDelMatch() { DalManager m_data = DalManager.Instance; Jedi jedi1 = new Jedi(18, "Jedi 1", false, null, ""); Jedi jedi2 = new Jedi(68, "Jedi 2", true, null, ""); Stade stade = new Stade(42, "Test 4", 42000, "Tata Ouine", null, null); m_data.addJedi(jedi1); m_data.addJedi(jedi2); m_data.addStade(stade); List <Stade> list1 = m_data.getAllStades().Where(s => s.Nom == stade.Nom && s.NbPlaces == stade.NbPlaces && s.Planete == stade.Planete).ToList(); List <Jedi> list2 = m_data.getAllJedis().Where(j => (j.Nom == jedi1.Nom || j.Nom == jedi2.Nom)).ToList(); Match toto = new Match(42, list2.ElementAt(0), list2.ElementAt(1), EPhaseTournoi.Finale, list1.ElementAt(0)); m_data.addMatch(toto); List <Match> list = m_data.getAllMatchs().Where(m => m.Jedi1.ID == list2.ElementAt(0).ID&& m.Jedi2.ID == list2.ElementAt(1).ID&& m.Stade.ID == list1.ElementAt(0).ID).ToList(); m_data.delMatch(list.ElementAt(0)); m_data.delStade(list1.ElementAt(0)); m_data.delJedi(list2.ElementAt(0)); m_data.delJedi(list2.ElementAt(1)); List <Match> list4 = m_data.getAllMatchs().Where(m => m.Jedi1.ID == list2.ElementAt(0).ID&& m.Jedi2.ID == list2.ElementAt(1).ID&& m.Stade.ID == list1.ElementAt(0).ID).ToList(); Assert.IsTrue(!list4.Any(m => string.IsNullOrEmpty(m.Jedi1.Nom))); }
static void Main(string[] args) { Pokemon pika = new Pokemon("Pikachu", ETypeElement.Tonnerre); Console.WriteLine(pika); Pokemon carapuce = new Pokemon("Carapute", ETypeElement.Eau); Console.WriteLine(carapuce); Pokemon salameche = new Pokemon("Samlaleche", ETypeElement.Feu); Console.WriteLine(salameche); Stade stade1 = new Stade(500, "Stade or"); Stade stade2 = new Stade(1000, "Stade platine"); Console.WriteLine(stade1); Console.WriteLine(stade2); Match match1 = new Match(pika, carapuce, stade1, EPhaseTournoi.QuartFinale); Match match2 = new Match(salameche, carapuce, stade2, EPhaseTournoi.DemiFinale); Match match3 = new Match(new Pokemon("Bulbazar", ETypeElement.Feu), new Pokemon("Lipoutou", ETypeElement.Feu), stade1, EPhaseTournoi.Finale); match1.JouerMatch(); match2.JouerMatch(); match3.JouerMatch(); Console.WriteLine(match1); Console.WriteLine(match2); Console.WriteLine(match3); Console.ReadKey(); }
public bool InsertStade(Stade stade) { bool result = false; try { using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); string sql = "INSERT INTO Stade VALUES(@Nom, @Type, @NbPlaces, @Attaque, @Defense); SELECT @@IDENTITY"; SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection); sqlCommand.Parameters.Add("@Nom", SqlDbType.VarChar, 50).Value = stade.Nom; sqlCommand.Parameters.Add("@Type", SqlDbType.Int).Value = (int)stade.Type; sqlCommand.Parameters.Add("@NbPlaces", SqlDbType.Int).Value = stade.NbPlaces; sqlCommand.Parameters.Add("@Attaque", SqlDbType.Int).Value = stade.Attaque; sqlCommand.Parameters.Add("@Defense", SqlDbType.Int).Value = stade.Defense; sqlCommand.CommandType = CommandType.Text; stade.ID = Convert.ToInt32(sqlCommand.ExecuteScalar().ToString()); sqlConnection.Close(); result = true; } } catch (Exception e) { Console.WriteLine(e.Message); result = false; } return(result); }
/// <summary> /// Ajoute un nouveau stade à la liste de stades. /// </summary> private void New() { Stade j = new Stade(_newNextId--, "<New>", 0, "<Planete>", null, ""); this.SelectedItem = new StadeViewModel(j); Stades.Add(this.SelectedItem); }
public void AddStade(int nbPlaces, string nom, string planete, CaracteristiqueContract force, CaracteristiqueContract defense, CaracteristiqueContract chance, CaracteristiqueContract sante) { List <Caracteristique> carac = new List <Caracteristique>(); if (force != null) { Caracteristique force2 = new Caracteristique(1, force.Nom, EDefCaracteristique.Force, ETypeCaracteristique.Stade, force.Valeur); carac.Add(force2); } if (chance != null) { Caracteristique chance2 = new Caracteristique(2, chance.Nom, EDefCaracteristique.Chance, ETypeCaracteristique.Stade, chance.Valeur); carac.Add(chance2); } if (sante != null) { Caracteristique sante2 = new Caracteristique(3, sante.Nom, EDefCaracteristique.Sante, ETypeCaracteristique.Stade, sante.Valeur); carac.Add(sante2); } if (defense != null) { Caracteristique defense2 = new Caracteristique(4, defense.Nom, EDefCaracteristique.Defense, ETypeCaracteristique.Stade, defense.Valeur); carac.Add(defense2); } Stade stade = new Stade(0, nom, nbPlaces, planete, carac, ""); jtm.addStade(stade); }
static void Main(string[] args) { Pokemon Elector = new Pokemon("Elector", ETypeElement.Electrique); Console.WriteLine(Elector); Pokemon Laggron = new Pokemon("Laggron", ETypeElement.Eau); Console.WriteLine(Laggron); Pokemon Salameche = new Pokemon("Salameche", ETypeElement.Feu); Console.WriteLine(Salameche); Match match1 = new Match(ref Elector, ref Laggron); Match match2 = new Match(ref Salameche, ref Laggron, EPhaseTournoi.DemiFinale); Match match3 = new Match(new Pokemon("Bulbizarre", ETypeElement.Plante), new Pokemon("Kadabra", ETypeElement.Psy)); Console.WriteLine(match1); Console.WriteLine(match2); Console.WriteLine(match3); Stade stade1 = new Stade(500, "Stade or", new Caracteristiques(0, 2, 0, 0, 0)); Stade stade2 = new Stade(1000, "Stade platine", new Caracteristiques(0, 0, -2, 0, 0)); Console.WriteLine(stade1); Console.WriteLine(stade2); Dresseur dresseur1 = new Dresseur("Sacha"); Dresseur dresseur2 = new Dresseur("Ondine"); Console.WriteLine(dresseur1); Console.WriteLine(dresseur2); Console.ReadKey(); }
public void AddTournoi(string nom, MatchContract match1, MatchContract match2, MatchContract match3, MatchContract match4) { List <MatchContract> listMatchc = new List <MatchContract>(); listMatchc.Add(match1); listMatchc.Add(match2); listMatchc.Add(match3); listMatchc.Add(match4); List <Match> listMatch = new List <Match>(); List <Jedi> listJedi = jtm.getAllJedis(); List <Stade> listStade = jtm.getAllStades(); Jedi jedi1 = new Jedi(); Jedi jedi2 = new Jedi(); Stade stade = new Stade(); foreach (MatchContract m in listMatchc) { jedi1 = listJedi.Find(j => j.Nom == m.Jedi1.Nom); jedi2 = listJedi.Find(j => j.Nom == m.Jedi2.Nom); stade = listStade.Find(s => s.Planete == m.Stade.Planete); listMatch.Add(new Match(m.Id, jedi1, jedi2, EPhaseTournoi.QuartFinale, stade)); } Tournoi tournoi = new Tournoi(0, nom, listMatch); jtm.addTournoi(tournoi); }
public void TestCreateDeleteStades() { DalManager manager = new DalManager(); List <Stade> list1 = manager.getStades(); Stade newStade = new Stade(12, 1000, "PlaneteTest", null); manager.InsertStade(newStade); List <Stade> listTemp = list1; listTemp.Add(newStade); List <Stade> list2 = manager.getStades(); Assert.AreEqual(listTemp.Count, list2.Count); Assert.AreEqual(list1[listTemp.Count - 1].ID, list2[list2.Count - 1].ID); Assert.AreEqual(list1[listTemp.Count - 1].NbPlaces, list2[list2.Count - 1].NbPlaces); Assert.AreEqual(list1[listTemp.Count - 1].Planete, list2[list2.Count - 1].Planete); manager.DeleteStades(newStade); list2 = manager.getStades(); Assert.AreEqual(list1.Count, list2.Count); Assert.AreEqual(list1[list1.Count - 1].ID, list2[list2.Count - 1].ID); Assert.AreEqual(list1[list1.Count - 1].NbPlaces, list2[list2.Count - 1].NbPlaces); Assert.AreEqual(list1[list1.Count - 1].Planete, list2[list2.Count - 1].Planete); }
public void delStade(int id) { List <Stade> listStade = jtm.getAllStades(); Stade stade = listStade.Find(s => s.ID == id); jtm.delStade(stade); }
private void Add() { Stade s = new Stade(); // TODO : voir pour passer des paramètres ? this.SelectedItem = new StadeViewModel(s); m_stades.Add(this.SelectedItem); }
/// <summary> /// Constructeur. /// </summary> public MatchsViewModel() { JediTournamentManager manager = new JediTournamentManager(); _jedis = manager.getAllJedis(); _jedisCombo = new List <Jedi>(_jedis); _stades = manager.getAllStades(); List <Match> matchsModel = manager.getAllMatchs(); // Initialise la collection modèle _matches = new ObservableCollection <MatchViewModel>(); foreach (Match m in matchsModel) { _matches.Add(new MatchViewModel(m)); } // Auto sélectionne le premier match s'il y en a un if (_matches.Count > 0) { _selectedItem = _matches[0]; _selectedJedi1 = _matches[0].Jedi1; _selectedJedi2 = _matches[0].Jedi2; _selectedStade = _matches[0].Stade; } }
private void Add() { Stade std = new Stade(0, "New"); BusinessLayer.BusinessManager.Instance.AddStade(std); ListeItems.Add(new StadeVM(std)); ; }
public bool removeStade(StadeWS stade) { List <Stade> liste = businessManager.getStades(); Stade paria = liste.First(x => x.Id == stade.Id); liste.Remove(paria); return(0 == businessManager.updateStades(liste)); }
public void delStade(Stade stade) { foreach (Match m in listMatch.Where(m => m.Stade == stade).ToList()) { delMatch(m); } listStades.Remove(stade); }
public StadeWS(Stade s) { this.Id = s.Id; this.Planete = s.Planete; this.NbPlaces = s.NbPlaces; this.Caracteristiques = new List <CaracteristiqueWS>(); s.Caracteristiques.ForEach(x => this.Caracteristiques.Add(new CaracteristiqueWS(x))); }
/// <summary> /// Constructeur. /// </summary> /// <param name="id">Id du match.</param> /// <param name="jedi1">Premier jedi concurrent.</param> /// <param name="jedi2">Second jedi concurrent.</param> /// <param name="phase">Phase lors de laquelle se déroule le match.</param> /// <param name="stade">Stade dans lequel se déroule le match.</param> public Match(int id, Jedi jedi1, Jedi jedi2, EPhaseTournoi phase, Stade stade) : base(id) { Jedi1 = jedi1; Jedi2 = jedi2; PhaseTournoi = phase; Stade = stade; IdJediVainqueur = -1; // Initialisation de l'ID à -1 => vainqueur non déterminé }