private Tour CreerTour(List <Equipe> equipes, int numtour, int nbrEquipePremierTour) { Tour tour = new Tour(numTour); int index = 0; for (int i = 0; i < equipes.Count() / 2; i++) { if (nbrEquipePremierTour == 0) { break; } else { nbrEquipePremierTour -= 2; } PartieEquipe pe1 = new PartieEquipe(equipes[index]); PartieEquipe pe2 = new PartieEquipe(equipes[index + 1]); listBye.Remove(pe1.Equipe); listBye.Remove(pe2.Equipe); Partie partie = new Partie(pe1, pe2, ++numPartie); index += 2; tour.LstParties.Add(partie); } return(tour); }
private Tour CreerTour(List <Equipe> equipes, int numtour) { Tour tour = new Tour(numTour); int index = 0; for (int i = 0; i < equipes.Count() / 2; i++) { PartieEquipe pe1 = new PartieEquipe(equipes[index]); PartieEquipe pe2 = new PartieEquipe(equipes[index + 1]); Partie partie = new Partie(pe1, pe2, ++numPartie); index += 2; tour.LstParties.Add(partie); } return(tour); }
private void RadioButton_Click(object sender, RoutedEventArgs e) { Tournoi tournoi = ((MainWindow)Application.Current.MainWindow.DataContext).TournoiEnCours as Tournoi; if (sender is RadioButton) { RadioButton rb = sender as RadioButton; int numPartie = ExtraitNombre(rb.GroupName); string nomEquipe; if (rb.DataContext is PartieEquipe) { PartieEquipe pe = rb.DataContext as PartieEquipe; nomEquipe = pe.Equipe.Nom; LamaBD.helper.PartieHelper.EnregistreGagnant(numPartie, nomEquipe); } } tournoi.GenerationTourValide(); }
private ObservableCollection <Tour> ChargerTours() { var task = TourHelper.SelectToursAsync(); task.Wait(); var taskScore = StatsHelper.SelectScoresJeuAsync(); taskScore.Wait(); List <tours> data = task.Result; ObservableCollection <Tour> listTours = new ObservableCollection <Tour>(); foreach (tours entity in data) { Tour tour = new Tour(entity.numTour); foreach (parties entityPartie in entity.parties) { Partie p = new Partie(entityPartie.numPartie); ObservableCollection <PartieEquipe> lstPartieEquipe = new ObservableCollection <PartieEquipe>(); foreach (equipesparties ep in entityPartie.equipesparties) { //Joueurs et stats TODO dnas l'objet Equipe //TODO stats dans objet PartieEquipe Equipe equipe = new Equipe(ep.equipes.nom); PartieEquipe pe = new PartieEquipe(equipe); foreach (Statistique stat in pe.LstStats.Stats) { var entityStat = taskScore.Result.Where(x => ((x.statistiquesjeux.statistiques.nom == stat.Key) && x.idEquipePartie == ep.idEquipePartie)).FirstOrDefault(); if (entityStat != null) { stat.Value = (int)entityStat.valeur; } } if (ep.estGagnante == true) { p.Gagnant = equipe; pe.EstGagnant = true; } else if (ep.estGagnante == false) { pe.EstGagnant = false; } else { pe.EstGagnant = null; } lstPartieEquipe.Add(pe); } p.LstEquipes = lstPartieEquipe; tour.LstParties.Add(p); } listTours.Add(tour); } return(listTours); }