private void bt_generate_Click(object sender, EventArgs e) { updateAll(); db = new SQLiteDatabase(); String query = "select count(*) from equipe"; int nbEquipes = Int32.Parse(db.ExecuteScalar(query)); int nbTerrains = Properties.Settings.Default.nbTerrains; query = "select count(*) from personne where equipe_id is null and arbitre = 1"; int nbArbitres = Int32.Parse(db.ExecuteScalar(query)); Boolean erreur = false; if (nbArbitres < 1) { MessageBox.Show("Il vous faut au moins un arbitre n'appartenant pas à une équipe !"); erreur = true; } else if (nbTerrains < 1) { MessageBox.Show("Il vous faut au moins un terrain disponible !"); erreur = true; } else if (nbEquipes < 3) { MessageBox.Show("Il vous faut au moins trois équipes !"); erreur = true; } else if (!cb_lundi.Checked && !cb_mardi.Checked && !cb_mercredi.Checked && !cb_jeudi.Checked && !cb_vendredi.Checked && !cb_samedi.Checked && !cb_dimanche.Checked) { MessageBox.Show("Il vous faut au moins une journée disponible !"); erreur = true; } if (!erreur) { Tournoi tour = new Tournoi(); Dictionary <int, Dictionary <int, int> > poules = tour.getPossiblesPoules(); ChoixPoules cp = new ChoixPoules(tour, poules); cp.ShowDialog(); } }
public ChoixPoules(Tournoi tourn, Dictionary <int, Dictionary <int, int> > poules) { Dictionary <string, Dictionary <int, int> > newDic = new Dictionary <string, Dictionary <int, int> >(); foreach (KeyValuePair <int, Dictionary <int, int> > pair in poules) { String str = pair.Value[pair.Key].ToString() + " poule(s) de " + pair.Key.ToString(); if (pair.Value[pair.Key + 1] > 0) { str += ", " + pair.Value[pair.Key + 1].ToString() + " poule(s) de " + (pair.Key + 1).ToString(); } newDic[str] = pair.Value; } tour = tourn; this.poules = poules; InitializeComponent(); cb_poules.DataSource = new BindingSource(newDic, null); cb_poules.DisplayMember = "Key"; cb_poules.ValueMember = "Value"; cb_poules.SelectedIndex = 0; }
public SelectionGeneration(Tournoi tour) { this.tournoi = tour; InitializeComponent(); }
public Synthese(Tournoi tour) { this.tournoi = tour; InitializeComponent(); }