예제 #1
0
 public frmRedigeraKonto(SchablonDTO schablon)
 {
     InitializeComponent();
     businessManager = new BusinessLayer.BusinessManager();
     this.schablon   = schablon;
     Load();
 }
예제 #2
0
 public frmRedigeraKund(KundDTO kund)
 {
     InitializeComponent();
     businessManager = new BusinessLayer.BusinessManager();
     this.kund       = kund;
     Load();
 }
예제 #3
0
        // GET: Classes/Details/5
        public ActionResult Details(int id)
        {
            BusinessLayer.BusinessManager _bm = BusinessLayer.BusinessManager.GetInstance();
            Classe classe = _bm.GetClasseById(id);

            if (classe == null)
            {
                return(HttpNotFound());
            }

            List <Eleve>   eleves   = _bm.GetEleveByClasseId(id);
            List <EleveVM> eleveVMS = new List <EleveVM>();

            if (eleves != null)
            {
                foreach (var eleve in eleves)
                {
                    eleveVMS.Add(new EleveVM
                    {
                        Nom    = eleve.Nom,
                        Prenom = eleve.Prenom
                    });
                }
            }

            ClasseVM classeVM = new ClasseVM
            {
                NomEtablissement = classe.NomEtablissement,
                Eleves           = eleveVMS,
                Niveau           = classe.Niveau,
                ClasseId         = classe.ClasseId
            };

            return(View(classeVM));
        }
예제 #4
0
        public ListeEleveViewModel()
        {
            _bm     = BusinessLayer.BusinessManager.GetInstance();
            _eleves = new ObservableCollection <DetailEleveViewModel>();


            foreach (Eleve eleve in _bm.GetEleves())
            {
                DetailEleveViewModel detailEleveViewModel = new DetailEleveViewModel
                {
                    Nom             = eleve.Nom,
                    Prenom          = eleve.Prenom,
                    DateDeNaissance = eleve.DateNaissance,
                    Notes           = eleve.Notes,
                    Absences        = eleve.Absences
                };

                //List<Note> notes = _bm.GetNotesByEleve(eleve.EleveId);
                //detailEleveViewModel.Moyenne = (int)notes.Select(n => n.LaNote).Average();

                detailEleveViewModel.Moyenne = _bm.GetAverageByEleve(eleve.EleveId);
                _eleves.Add(detailEleveViewModel);
            }

            if (_eleves != null && _eleves.Count > 0)
            {
                _detail = _eleves.ElementAt(0);
            }
        }
예제 #5
0
        public ListeEleveViewModel()
        {
            _bm = BusinessLayer.BusinessManager.GetInstance();
            // Initialisation de la liste d'élèves
            eleves = new List <DetailEleveViewModel>();

            foreach (Eleve e in _bm.GetEleves())
            {
                DetailEleveViewModel detailEleve = new DetailEleveViewModel
                {
                    Nom    = e.Nom,
                    Prenom = e.Prenom
                };

                List <Note> notes = _bm.GetNotesByEleve(e.EleveId);
                detailEleve.Moyenne = notes.Select(n => n.NoteEleve).Average();
                eleves.Add(detailEleve);

                /*eleves.Add(new DetailEleveViewModel
                 * {
                 *  Nom = e.Nom,
                 *  Prenom = e.Prenom
                 * });*/

                //eleves.Add(new DetailEleveViewModel { Nom = "Hey", Prenom = "YouThere" });
                //eleves.Add(new DetailEleveViewModel { Nom = "Rouana", Prenom = "Marie" });

                if (eleves != null && eleves.Count > 0)
                {
                    detailEleve = eleves.ElementAt(0);
                }
            }
        }
        public void CaracteristiqueTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List<CaracteristiqueWCF> result = service.getAllCaracteristique();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<Caracteristique> original = bm.getCaracteristique();
            List<CaracteristiqueWCF> expected = new List<CaracteristiqueWCF>();
            foreach (Caracteristique cara in original)
            {
                expected.Add(new CaracteristiqueWCF(cara));
            }
            foreach (CaracteristiqueWCF cara in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Nom == cara.Nom && x.Valeur == cara.Valeur && x.Type == cara.Type && x.Definition == cara.Definition),"La caracteristique " + cara.Nom + " n'est pas presente");
            }

            //add
            CaracteristiqueWCF c = new CaracteristiqueWCF(new Caracteristique(EDefCaracteristique.Chance, "testCaract", ETypeCaracteristique.Jedi, 10));
            service.addCracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom), "La caract " + c.Nom + " n'est pas presente");

            //update
            c = result.Find(x => x.Nom == "testCaract");
            c.Valeur = 20;
            service.updateCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom && x.Valeur == 20), "La caract " + c.Nom + " n'a pas ete modifee");

            //delete
            service.deleteCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(!result.Exists(x => x.Nom == c.Nom), "Le caract " + c.Nom + "existe toujours");
        }
예제 #7
0
 public frmRedigeraProdukt(ProduktDTO produkt)
 {
     InitializeComponent();
     businessManager = new BusinessLayer.BusinessManager();
     this.produkten  = produkt;
     Load();
 }
예제 #8
0
        public void TestgetTournoi()
        {
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            var res = bm.getTournoi();

            Assert.AreEqual(1, res.Count);
        }
예제 #9
0
        public void TestgetPokemonForceVie()
        {
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            var liste = bm.getPokemonForceVie();

            Assert.AreEqual(3, liste.Count);
            Assert.AreNotEqual(9, liste.Count);
        }
예제 #10
0
        public void TestgetPokemonByID()
        {
            BusinessLayer.BusinessManager dm = new BusinessLayer.BusinessManager();

            var res = dm.getPokemonByID(3);

            // Assert.AreEqual(Florizare, res);
            Assert.AreEqual(dm.getPokemonByName("Leviator"), res);
        }
예제 #11
0
        public GestionEventsView()
        {
            bm = new BusinessLayer.BusinessManager();

            InitializeComponent();
            this.EventControl.stackPanel.SelectionChanged += new SelectionChangedEventHandler(stackPanel_SelectionChanged);
            GestionEventModel = new GestionEventsViewModel(EventControl,bm.getPlanningElements().OrderBy(m => m.DateDebut).ToList());
            EventControl.Update(_gestionEvent.TempList.OrderBy(m => m.DateDebut).ToList());
        }
예제 #12
0
        public void TestgetPokemonByName()
        {
            BusinessLayer.BusinessManager bm       = new BusinessLayer.BusinessManager();
            EntitiesLayer.Pokemon         Dracofeu = new EntitiesLayer.Pokemon("Dracofeu", ETypeElement.Feu, 130, 60, 30, 45, 35);
            EntitiesLayer.Pokemon         pikachu  = new EntitiesLayer.Pokemon("Pikachu", ETypeElement.Electrique, 100, 25, 38, 18, 40);
            var res = bm.getPokemonByName("Dracofeu");

            //Assert.AreEqual(Dracofeu, res);
            Assert.AreNotEqual(pikachu, res);
        }
예제 #13
0
        public void testcheckconnexionuser()
        {
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            bool result = bm.CheckConnexionUser("toto", "pouet");

            Assert.AreEqual(true, result);

            result = bm.CheckConnexionUser("", "");

            Assert.AreEqual(true, result);
        }
예제 #14
0
        public void TestgetPokemonByElem()
        {
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            var liste = bm.getPokemonByElem(EntitiesLayer.ETypeElement.Feu);

            Assert.AreEqual(2, liste.Count);

            liste = bm.getPokemonByElem(EntitiesLayer.ETypeElement.Eau);
            Assert.AreNotEqual(0, liste.Count);
        }
예제 #15
0
        public frmRegistreraNyKund()
        {
            InitializeComponent();
            businessManager = new BusinessLayer.BusinessManager();

            var kategori = businessManager.GetAllKundKategori();

            cmbKundkategori.DataSource    = kategori;
            cmbKundkategori.ValueMember   = "Namn";
            cmbKundkategori.DisplayMember = "Namn";
        }
예제 #16
0
        public List <CharacterAPI> GetAllCharacter()
        {
            List <CharacterAPI> liste = new List <CharacterAPI>();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            foreach (Character character in bm.GetAllCharacters())
            {
                liste.Add(new CharacterAPI(character));
            }
            return(liste);
        }
예제 #17
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // récupération des artistes
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            IList<EntitiesLayer.Artiste> artistes = bm.GetArtistes();

            // Initialisation du viewModel

            ViewModel.ArtistesViewModel avm = new WpfArtistesViewer.ViewModel.ArtistesViewModel(artistes);
            avm.CloseNotified += CloseNotified;
            ucArtistes.DataContext = avm;
        }
예제 #18
0
        public ArtisteViewer(EntitiesLayer.Artiste source) 
        {
            InitializeComponent();

            if (source == null)
            {
                // récupération d'un artiste
                BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
                _source = bm.GetArtistes()[0];
            }
            else _source = source;
        }
예제 #19
0
        public List <HouseAPI> GetAllHouses()
        {
            List <HouseAPI> list = new List <HouseAPI>();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            foreach (House hou in bm.GetAllHouses())
            {
                list.Add(new HouseAPI(hou));
            }

            return(list);
        }
예제 #20
0
        public List <FightAPI> GetAllFights()
        {
            List <FightAPI> list = new List <FightAPI>();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            foreach (Fight fi in bm.GetAllFights())
            {
                list.Add(new FightAPI(fi));
            }

            return(list);
        }
예제 #21
0
        public List <WarAPI> GetAllWars()
        {
            List <WarAPI> list = new List <WarAPI>();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            foreach (War wa in bm.GetAllWars())
            {
                list.Add(new WarAPI(wa));
            }

            return(list);
        }
예제 #22
0
        public List <TerritoryAPI> GetAllTerritories()
        {
            List <TerritoryAPI> list = new List <TerritoryAPI>();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();

            foreach (Territory ter in bm.GetAllTerritories())
            {
                list.Add(new TerritoryAPI(ter));
            }

            return(list);
        }
예제 #23
0
        public ActionResult GetEleves()
        {
            BusinessLayer.BusinessManager _bm = BusinessLayer.BusinessManager.GetInstance();
            List <Eleve> eleves = _bm.GetEleves();

            List <EleveVM> eleveVMS = new List <EleveVM>();

            foreach (var eleve in eleves)
            {
                eleveVMS.Add(new EleveVM {
                    Nom = eleve.Nom
                });
            }

            return(View(eleveVMS));
        }
예제 #24
0
        // GET: Classes
        public ActionResult Index()
        {
            BusinessLayer.BusinessManager _bm = BusinessLayer.BusinessManager.GetInstance();
            List <Classe> classes             = _bm.GetClasses();

            List <ClasseVM> classeVMS = new List <ClasseVM>();

            foreach (var classe in classes)
            {
                classeVMS.Add(new ClasseVM {
                    NomEtablissement = classe.NomEtablissement,
                    Niveau           = classe.Niveau,
                    ClasseId         = classe.ClasseId
                });
            }

            return(View(classeVMS));
        }
예제 #25
0
        public AddMatch(EntitiesLayer.Tournoi tournoi)
        {
            InitializeComponent();
            BManager   = new BusinessLayer.BusinessManager();
            TheTournoi = tournoi;
            List <Pokemon> listPoke = new List <Pokemon>();
            List <Pokemon> listtmp  = BManager.getPokemon();

            for (int i = 0; i < listtmp.Count; i++)
            {
                listPoke.Add(listtmp.ElementAt(i));
            }
            for (int i = 0; i < TheTournoi.nbrMatch; i++)
            {
                listPoke.Remove(TheTournoi.Matchs[i].Pokemon1);
                listPoke.Remove(TheTournoi.Matchs[i].Pokemon2);
            }
            pokemon1.DataContext = listPoke;
            pokemon2.DataContext = listPoke;
        }
예제 #26
0
        public void MatchTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager          bm      = new BusinessLayer.BusinessManager();
            List <MatchWCF> result   = service.getAllMatch();
            List <Match>    original = bm.getMatches();
            List <MatchWCF> expected = new List <MatchWCF>();

            foreach (Match match in original)
            {
                expected.Add(new MatchWCF(match));
            }
            foreach (MatchWCF match in expected)
            {
                Assert.IsTrue(result.Exists(x => (x.Jedi1.Nom == match.Jedi1.Nom && x.Jedi2.Nom == match.Jedi2.Nom)),
                              "Le match " + match.Jedi1.Nom + " contre " + match.Jedi2.Nom + " n'est pas present");
            }

            //add
            List <Jedi>  jedis  = bm.getJedis();
            List <Stade> stades = bm.getStades();
            MatchWCF     m      = new MatchWCF(new Match(0, jedis[0], jedis[1], EPhaseTournoi.DemiFinale, stades[0]));

            service.addMatch(m);
            result = service.getAllMatch();
            m      = result.Find(x => x.Jedi1.Id == jedis[0].Id && x.Jedi2.Id == jedis[1].Id && x.PhaseTournoi == EPhaseTournoi.DemiFinale && x.Stade.Id == stades[0].Id);
            Assert.IsTrue(result.Exists(x => x.Id == m.Id), "Le match " + m.ToString() + " n'est pas present");

            //update
            m.PhaseTournoi = EPhaseTournoi.Finale;
            service.updateMatch(m);
            result = service.getAllMatch();
            Assert.IsTrue(result.Exists(x => x.Id == m.Id && x.PhaseTournoi == EPhaseTournoi.Finale), "Le match " + m.ToString() + " n'a pas ete modife");

            //delete
            service.deleteMatch(m);
            result = service.getAllMatch();
            Assert.IsTrue(!result.Exists(x => x.Id == m.Id), "Le match " + m.ToString() + "existe toujours");
        }
예제 #27
0
        public void TournoiTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List <TournoiWCF> result = service.getAllTournoi();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List <Tournoi>    original       = bm.getTournoi();
            List <TournoiWCF> expected       = new List <TournoiWCF>();

            foreach (Tournoi tournois in original)
            {
                expected.Add(new TournoiWCF(tournois));
            }
            foreach (TournoiWCF tournois in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Nom == tournois.Nom), "Le tournoi " + tournois.Nom + " n'est pas present");
            }

            //add
            List <Match> matches = bm.getMatches();
            TournoiWCF   t       = new TournoiWCF(new Tournoi(matches, "Tournoistest"));

            service.addTournoi(t);
            result = service.getAllTournoi();
            Assert.IsTrue(result.Exists(x => x.Nom == t.Nom), "Le tournois " + t.Nom + " n'est pas present");

            //update
            t     = result.Find(x => x.Nom == "Tournoistest");
            t.Nom = "Tournoistest2";
            service.updateTournois(t);
            result = service.getAllTournoi();
            Assert.IsTrue(result.Exists(x => x.Nom == "Tournoistest2"), "Le tournois " + t.Nom + " n'a pas ete modife");

            //delete
            service.deleteTournois(t);
            result = service.getAllTournoi();
            Assert.IsTrue(!result.Exists(x => x.Nom == "Tournoistest2"), "Le tournois " + t.Nom + "existe toujours");
        }
예제 #28
0
        public void StadeTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List <StadeWCF> result = service.getAllStade();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List <Stade>    original         = bm.getStades();
            List <StadeWCF> expected         = new List <StadeWCF>();

            foreach (Stade stade in original)
            {
                expected.Add(new StadeWCF(stade));
            }
            foreach (StadeWCF stade in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Planete == stade.Planete), "Le stade " + stade.Planete + " n'est pas present");
            }

            //add
            List <Caracteristique> caracts = bm.getCaracteristique();
            StadeWCF s = new StadeWCF(new Stade(100, "stadeTest", caracts.FindAll(x => x.Id == 1)));

            service.addStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + " n'est pas present");

            //update
            s          = result.Find(x => x.Planete == "stadeTest");
            s.NbPlaces = 150;
            service.updateStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete && x.NbPlaces == 150), "Le stade " + s.Planete + " n'a pas ete modife");

            //delete
            service.deleteStade(s);
            result = service.getAllStade();
            Assert.IsTrue(!result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + "existe toujours");
        }
예제 #29
0
        public void CaracteristiqueTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List <CaracteristiqueWCF> result = service.getAllCaracteristique();

            BusinessLayer.BusinessManager bm       = new BusinessLayer.BusinessManager();
            List <Caracteristique>        original = bm.getCaracteristique();
            List <CaracteristiqueWCF>     expected = new List <CaracteristiqueWCF>();

            foreach (Caracteristique cara in original)
            {
                expected.Add(new CaracteristiqueWCF(cara));
            }
            foreach (CaracteristiqueWCF cara in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Nom == cara.Nom && x.Valeur == cara.Valeur && x.Type == cara.Type && x.Definition == cara.Definition), "La caracteristique " + cara.Nom + " n'est pas presente");
            }

            //add
            CaracteristiqueWCF c = new CaracteristiqueWCF(new Caracteristique(EDefCaracteristique.Chance, "testCaract", ETypeCaracteristique.Jedi, 10));

            service.addCracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom), "La caract " + c.Nom + " n'est pas presente");

            //update
            c        = result.Find(x => x.Nom == "testCaract");
            c.Valeur = 20;
            service.updateCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom && x.Valeur == 20), "La caract " + c.Nom + " n'a pas ete modifee");

            //delete
            service.deleteCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(!result.Exists(x => x.Nom == c.Nom), "Le caract " + c.Nom + "existe toujours");
        }
예제 #30
0
        public void JediWCFTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager          bm      = new BusinessLayer.BusinessManager();
            List <JediWCF> result   = service.getAllJedi();
            List <Jedi>    original = bm.getJedis(); //met a jour l'id
            List <JediWCF> expected = new List <JediWCF>();

            foreach (Jedi jedi in original)
            {
                expected.Add(new JediWCF(jedi));
            }
            foreach (JediWCF jedi in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Nom == jedi.Nom), "Le jedi " + jedi.Nom + " n'est pas present");
            }

            //add
            List <Caracteristique> list_carac = bm.getCaracteristique().FindAll(x => x.Id == 1);
            JediWCF j = new JediWCF(new Jedi("TestAjout", false, list_carac));

            service.addJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + " n'est pas present");

            //update
            j        = result.Find(x => x.Nom == "TestAjout");
            j.IsSith = true;
            service.updateJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom && x.IsSith == true), "Le jedi " + j.Nom + " n'a pas ete modife");

            //delete
            service.deleteJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(!result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + "existe toujours");
        }
        public void JediWCFTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<JediWCF> result = service.getAllJedi();
            List<Jedi> original = bm.getJedis(); //met a jour l'id
            List<JediWCF> expected = new List<JediWCF>();
            foreach (Jedi jedi in original)
            {
                expected.Add(new JediWCF(jedi));
            }
            foreach (JediWCF jedi in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Nom == jedi.Nom),"Le jedi " + jedi.Nom + " n'est pas present");
            }

            //add
            List<Caracteristique> list_carac = bm.getCaracteristique().FindAll(x => x.Id == 1);
            JediWCF j = new JediWCF(new Jedi("TestAjout", false, list_carac));
            service.addJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + " n'est pas present");

            //update
            j = result.Find(x => x.Nom == "TestAjout");
            j.IsSith = true;
            service.updateJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom && x.IsSith == true), "Le jedi " + j.Nom + " n'a pas ete modife");

            //delete
            service.deleteJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(!result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + "existe toujours");
        }
예제 #32
0
 public frmRegistreraNyProduktKategori()
 {
     businessManager = new BusinessLayer.BusinessManager();
     InitializeComponent();
 }
        public void MatchTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<MatchWCF> result = service.getAllMatch();
            List<Match> original = bm.getMatches();
            List<MatchWCF> expected = new List<MatchWCF>();
            foreach (Match match in original)
            {
                expected.Add(new MatchWCF(match));
            }
            foreach (MatchWCF match in expected)
            {
                Assert.IsTrue(result.Exists(x=> (x.Jedi1.Nom == match.Jedi1.Nom && x.Jedi2.Nom == match.Jedi2.Nom)),
                    "Le match " + match.Jedi1.Nom + " contre " + match.Jedi2.Nom + " n'est pas present");
            }

            //add
            List<Jedi> jedis = bm.getJedis();
            List<Stade> stades = bm.getStades();
            MatchWCF m = new MatchWCF(new Match(0, jedis[0], jedis[1], EPhaseTournoi.DemiFinale, stades[0]));
            service.addMatch(m);
            result = service.getAllMatch();
            m = result.Find(x => x.Jedi1.Id == jedis[0].Id && x.Jedi2.Id == jedis[1].Id && x.PhaseTournoi == EPhaseTournoi.DemiFinale && x.Stade.Id == stades[0].Id);
            Assert.IsTrue(result.Exists(x => x.Id == m.Id), "Le match " + m.ToString() + " n'est pas present");

            //update
            m.PhaseTournoi = EPhaseTournoi.Finale;
            service.updateMatch(m);
            result = service.getAllMatch();
            Assert.IsTrue(result.Exists(x => x.Id == m.Id && x.PhaseTournoi == EPhaseTournoi.Finale), "Le match " + m.ToString() + " n'a pas ete modife");

            //delete
            service.deleteMatch(m);
            result = service.getAllMatch();
            Assert.IsTrue(!result.Exists(x => x.Id == m.Id), "Le match " + m.ToString() + "existe toujours");
        }
        public void TournoiTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List<TournoiWCF> result = service.getAllTournoi();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<Tournoi> original = bm.getTournoi();
            List<TournoiWCF> expected = new List<TournoiWCF>();
            foreach (Tournoi tournois in original)
            {
                expected.Add(new TournoiWCF(tournois));
            }
            foreach (TournoiWCF tournois in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Nom == tournois.Nom),"Le tournoi " + tournois.Nom + " n'est pas present");
            }

            //add
            List<Match> matches = bm.getMatches();
            TournoiWCF t = new TournoiWCF(new Tournoi(matches, "Tournoistest" ));
            service.addTournoi(t);
            result = service.getAllTournoi();
            Assert.IsTrue(result.Exists(x => x.Nom == t.Nom), "Le tournois " + t.Nom + " n'est pas present");

            //update
            t = result.Find(x => x.Nom == "Tournoistest");
            t.Nom = "Tournoistest2";
            service.updateTournois(t);
            result = service.getAllTournoi();
            Assert.IsTrue(result.Exists(x => x.Nom == "Tournoistest2"), "Le tournois " + t.Nom + " n'a pas ete modife");

            //delete
            service.deleteTournois(t);
            result = service.getAllTournoi();
            Assert.IsTrue(!result.Exists(x => x.Nom == "Tournoistest2"), "Le tournois " + t.Nom + "existe toujours");
        }
예제 #35
0
 public frmRegistreraNyttKonto()
 {
     InitializeComponent();
     businessManager = new BusinessLayer.BusinessManager();
     schablons       = businessManager.GetAllSchablon();
 }
예제 #36
0
        public TournoiWindow(EntitiesLayer.Tournoi tournoi)
        {
            TheTournoi = tournoi;
            _manager   = new BusinessLayer.BusinessManager();
            InitializeComponent();
            letournoi.DataContext = tournoi;
            if (TheTournoi.nbrMatch > 0)
            {
                match_Q1_1.DataContext = cheminImage(TheTournoi.Matchs[0].Pokemon1.Nom);
                match_Q1_2.DataContext = cheminImage(TheTournoi.Matchs[0].Pokemon2.Nom);
                if (TheTournoi.nbrMatch > 1)
                {
                    match_Q2_1.DataContext = cheminImage(TheTournoi.Matchs[1].Pokemon1.Nom);
                    match_Q2_2.DataContext = cheminImage(TheTournoi.Matchs[1].Pokemon2.Nom);
                    if (TheTournoi.Matchs[0].IdPokemonVainqueur != -1)
                    {
                        match_D1_1.DataContext = cheminImage(TheTournoi.Matchs[0].getPokemonVainqueur().Nom);
                    }
                    if (TheTournoi.Matchs[1].IdPokemonVainqueur != -1)
                    {
                        match_D1_2.DataContext = cheminImage(TheTournoi.Matchs[1].getPokemonVainqueur().Nom);
                        if (TheTournoi.Matchs[0].IdPokemonVainqueur != -1)
                        {
                            try
                            {
                                if (TheTournoi.Matchs[first].Pokemon1.ID != TheTournoi.Matchs[0].getPokemonVainqueur().ID)
                                {
                                    first = 5; second = 4;
                                }
                            }
                            catch { first = 5; second = 4; }
                            if (TheTournoi.Matchs[first].IdPokemonVainqueur != -1)
                            {
                                match_F_1.DataContext = cheminImage(TheTournoi.Matchs[first].getPokemonVainqueur().Nom);
                            }
                        }
                    }

                    if (TheTournoi.nbrMatch > 2)
                    {
                        match_Q3_1.DataContext = cheminImage(TheTournoi.Matchs[2].Pokemon1.Nom);
                        match_Q3_2.DataContext = cheminImage(TheTournoi.Matchs[2].Pokemon2.Nom);
                        if (TheTournoi.Matchs[2].IdPokemonVainqueur != -1)
                        {
                            match_D2_1.DataContext = cheminImage(TheTournoi.Matchs[2].getPokemonVainqueur().Nom);
                        }
                        if (TheTournoi.nbrMatch > 3)
                        {
                            match_Q4_1.DataContext = cheminImage(TheTournoi.Matchs[3].Pokemon1.Nom);
                            match_Q4_2.DataContext = cheminImage(TheTournoi.Matchs[3].Pokemon2.Nom);
                            if (TheTournoi.Matchs[3].IdPokemonVainqueur != -1)
                            {
                                match_D2_2.DataContext = cheminImage(TheTournoi.Matchs[3].getPokemonVainqueur().Nom);
                                if (TheTournoi.Matchs[2].IdPokemonVainqueur != -1)
                                {
                                    try
                                    {
                                        if (TheTournoi.Matchs[second].Pokemon1.ID != TheTournoi.Matchs[2].getPokemonVainqueur().ID)
                                        {
                                            first = 5; second = 4;
                                        }
                                    }
                                    catch { first = 5; second = 4; }

                                    if (TheTournoi.Matchs[second].IdPokemonVainqueur != -1)
                                    {
                                        match_F_2.DataContext = cheminImage(TheTournoi.Matchs[second].getPokemonVainqueur().Nom);
                                        try
                                        {
                                            if (TheTournoi.Matchs[first].IdPokemonVainqueur != -1)
                                            {
                                                if (TheTournoi.Matchs[6].IdPokemonVainqueur != -1)
                                                {
                                                    gagnant.DataContext = cheminImage(TheTournoi.Matchs[6].getPokemonVainqueur().Nom);
                                                }
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #37
0
 public adduser()
 {
     InitializeComponent();
     BManager = new BusinessLayer.BusinessManager();
 }
        public void StadeTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List<StadeWCF> result = service.getAllStade();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<Stade> original = bm.getStades();
            List<StadeWCF> expected = new List<StadeWCF>();
            foreach (Stade stade in original)
            {
                expected.Add(new StadeWCF(stade));
            }
            foreach (StadeWCF stade in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Planete == stade.Planete),"Le stade " + stade.Planete + " n'est pas present");
            }

            //add
            List<Caracteristique> caracts = bm.getCaracteristique();
            StadeWCF s = new StadeWCF(new Stade(100, "stadeTest", caracts.FindAll(x => x.Id == 1)));
            service.addStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + " n'est pas present");

            //update
            s = result.Find(x => x.Planete == "stadeTest");
            s.NbPlaces = 150;
            service.updateStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete && x.NbPlaces == 150), "Le stade " + s.Planete + " n'a pas ete modife");

            //delete
            service.deleteStade(s);
            result = service.getAllStade();
            Assert.IsTrue(!result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + "existe toujours");
        }