Exemple #1
0
        public bool removeMatch(MatchWS match)
        {
            List <Match> liste = businessManager.getMatches();
            Match        paria = liste.First(x => x.Id == match.Id);

            liste.Remove(paria);
            return(0 == businessManager.updateMatches(liste));
        }
Exemple #2
0
        private Match toMatch(MatchWS ws)
        {
            List <Stade> stades = businessManager.getStades();
            List <Jedi>  jedis  = businessManager.getJedis();
            Match        m      = new Match(ws.Id,
                                            (ws.Jedi1 != null ? jedis.First(x => x.Id == ws.Jedi1.Id) : null),
                                            (ws.Jedi2 != null ? jedis.First(x => x.Id == ws.Jedi2.Id) : null),
                                            (EPhaseTournoi)ws.Phase,
                                            stades.First(x => x.Id == ws.Stade.Id),
                                            (ws.JediVainqueur != null ? jedis.First(x => x.Id == ws.JediVainqueur.Id) : null));

            return(m);
        }
Exemple #3
0
        public bool addMatch(MatchWS match)
        {
            List <Match> listeM   = businessManager.getMatches();
            List <Jedi>  listeJ   = businessManager.getJedis();
            List <Stade> listeS   = businessManager.getStades();
            Match        newMatch = new Match(0, (match.Jedi1 != null ? listeJ.Where(x => x.Nom == match.Jedi1.Nom).First() : null),
                                              (match.Jedi2 != null ? listeJ.Where(x => x.Nom == match.Jedi2.Nom).First() : null),
                                              (EPhaseTournoi)match.Phase,
                                              listeS.Where(x => x.Planete == match.Stade.Planete).First(),
                                              (match.JediVainqueur != null ? listeJ.Where(x => x.Nom == match.JediVainqueur.Nom).First() : null));

            listeM.Add(newMatch);
            return(0 == businessManager.updateMatches(listeM));
        }
Exemple #4
0
        public bool updateMatch(MatchWS match)
        {
            List <Match> listeM   = businessManager.getMatches();
            Match        newMatch = listeM.First(x => x.Id == match.Id);
            Match        newData  = toMatch(match);

            newMatch.Jedi1         = newData.Jedi1;
            newMatch.Jedi2         = newData.Jedi2;
            newMatch.JediVainqueur = newData.JediVainqueur;
            newMatch.Stade         = newData.Stade;
            newMatch.PhaseTournoi  = newData.PhaseTournoi;

            return(0 == businessManager.updateMatches(listeM));
        }
Exemple #5
0
 public System.Threading.Tasks.Task <bool> removeMatchAsync(WCFJedi.MatchWS match)
 {
     return(base.Channel.removeMatchAsync(match));
 }
Exemple #6
0
 public bool removeMatch(WCFJedi.MatchWS match)
 {
     return(base.Channel.removeMatch(match));
 }
Exemple #7
0
 public bool updateMatch(WCFJedi.MatchWS match)
 {
     return(base.Channel.updateMatch(match));
 }
Exemple #8
0
 public bool addMatch(WCFJedi.MatchWS match)
 {
     return(base.Channel.addMatch(match));
 }
        public void TestServiceARMatches()
        {
            ServiceReference.ServiceClient client = new ServiceReference.ServiceClient();

            List<MatchWS> matches = client.getMatches();
            List<JediWS> jedis = client.getJedis();
            List<StadeWS> stades = client.getStades();
            int size = matches.Count;
            Assert.IsNotNull(matches);
            /* AJOUT */
            MatchWS zone = new MatchWS(0, jedis.ElementAt(0), jedis.ElementAt(3), null, stades.ElementAt(0), EntitiesLayer.EPhaseTournoi.HuitiemeFinale1);
            client.addMatch(zone);
            Assert.AreEqual(size + 1, client.getMatches().Count);
            /* SUPPRESSION */
            zone = client.getMatches().Find(x => x.Jedi1 != null && x.Jedi2 != null && x.Jedi1.Id.Equals(jedis.ElementAt(0).Id) && x.Jedi2.Id.Equals(jedis.ElementAt(3).Id) && x.Stade.Id.Equals(stades.ElementAt(0).Id));
            client.removeMatch(zone);
            Assert.AreEqual(size, client.getMatches().Count);

            client.Close();
        }