public int InsereNouvellePartie(ObservableCollection <Joueur> lesJoueurs) { DateTime DateCreation = DateTime.Now; string ins = "insert into Partie values (0, NULL, 1, '" + DateCreation + "',NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"; int i = 0; foreach (Joueur unJoueur in lesJoueurs) { ins += "'" + unJoueur.Nom + "'"; i++; if (i == lesJoueurs.Count) { break; } else { ins += ","; } } for (; i < 6; i++) { ins += ", NULL"; } ins += ")"; return(maBD.Commande(ins)); }
/*-------------------------------------------------------------- * / * /---------------------------------------------------------------*/ public void InsereEtape() { DateTime DateIns = DateTime.Now; PA.InitJoueurs(); for (int i = 0; i < PA.Joueurs.Count; i++) { if (PA.Joueurs[i].Decision != "PETIT_BLIND" && PA.Joueurs[i].Decision != "GROS_BLIND" && PA.Joueurs[i].Decision != "ABANDONNER" && PA.Joueurs[i].Decision != "Muet" && PA.Joueurs[i].Decision != "MORT" && PA.Joueurs[i].Decision != "MOURANT" && PA.Joueurs[i].Decision != "ALL_IN_SUIVRE" && PA.Joueurs[i].Decision != "ALL_IN_RELANCER") { PA.Joueurs[i].Decision = "Attente"; } } PA.Num_Tour = 1; string[] TabDD = new string[6]; int[] TabEng = new int[6]; int[] TabK = new int[6]; for (int i = 0; i < PA.Joueurs.Count; i++) { if (PA.Joueurs[i].Decision == null) { TabDD[i] = "MORT"; } else { TabDD[i] = PA.Joueurs[i].Decision; } TabEng[i] = PA.Joueurs[i].Engagement; TabK[i] = PA.Joueurs[i].Capital; } Croupier croupier = new Croupier(TabDD, TabEng, TabK, PA.JoueurLogue, PA.Etape, PA.Bouton); string context = "CHANGEMENT_ETAPE"; if (PA.Etape == "PRE_FLOP") { context = "NOUVELLE_MAIN"; } PA.ProchainJoueur = croupier.DetermineProchainJoueur(context); string ins = "insert into etapes values( " + PA.Numero + ", " + PA.Numero_Main + ", '" + PA.Etape + "', " + PA.ProchainJoueur + ", '" + DateTime.Now + "', " + PA.Num_Tour + ")"; maBD.Commande(ins); TG.SRV.Incarne <ToursParole_ADO_SRV>().InsereTourParole(); }
public void InsereTourParole() { DateTime D = DateTime.Now; string ins = "insert into toursParole values( " + PA.Numero + ", " + PA.Numero_Main + ", '" + PA.Etape + "', " + PA.Num_Tour + " ,'" + PA.Joueurs[0].Decision + "'," + PA.Joueurs[0].Engagement + ", '" + D + "','" + PA.Joueurs[1].Decision + "'," + PA.Joueurs[1].Engagement + ", '" + D + "','" + PA.Joueurs[2].Decision + "'," + PA.Joueurs[2].Engagement + ", '" + D + "','" + PA.Joueurs[3].Decision + "'," + PA.Joueurs[3].Engagement + ", '" + D + "','" + PA.Joueurs[4].Decision + "'," + PA.Joueurs[4].Engagement + ", '" + D + "','" + PA.Joueurs[5].Decision + "'," + PA.Joueurs[5].Engagement + ", '" + D + "')"; maBD.Commande(ins); if (PA.Num_Tour > 1) { Etapes_ADO_SRV Etapes_AS = new Etapes_ADO_SRV(); Etapes_AS.MAJ_tour(); } }
public void insereJoueurPartie(List <string> LstInvites) { int position = 0; foreach (string Nom in LstInvites) { string ins = "insert into joueurPartie values(" + PA.Numero + ", '" + Nom + "', " + position + ", '')"; position++; maBD.Commande(ins); } }
private void Truncate(object sender, RoutedEventArgs e) { BD_primitive maBD = new BD_primitive(); string cmd = "truncate toursParole"; maBD.Commande(cmd); cmd = "truncate etapes"; maBD.Commande(cmd); cmd = "truncate main"; maBD.Commande(cmd); cmd = "truncate partie"; maBD.Commande(cmd); cmd = "truncate historique"; maBD.Commande(cmd); cmd = "truncate joueurPartie"; maBD.Commande(cmd); cmd = "truncate semaphore"; maBD.Commande(cmd); cmd = "truncate tournois"; maBD.Commande(cmd); MessageBox.Show("BD vidée"); }
public void AjouteHistorique(string desc) { string ins = "insert into historique values(" + PA.Numero + ", null, '" + desc + "', '" + DateTime.Now + "')"; maBD.Commande(ins); }
private void PrepareBD1(object sender, RoutedEventArgs e) { BD_primitive maBD = new BD_primitive(); string cmd = "truncate toursParole"; maBD.Commande(cmd); cmd = "truncate etapes"; maBD.Commande(cmd); cmd = "truncate main"; maBD.Commande(cmd); cmd = "truncate partie"; maBD.Commande(cmd); cmd = "truncate historique"; maBD.Commande(cmd); cmd = "truncate joueurPartie"; maBD.Commande(cmd); cmd = "truncate semaphore"; maBD.Commande(cmd); cmd = "truncate tournois"; maBD.Commande(cmd); cmd = "INSERT INTO etapes (num_partie, num_main, NomEtape, prochainJoueur, date_evenement, num_tour) VALUES" + " (1, 1, 'PRE_FLOP', -1, '2017-06-19 12:58:43', 1)," + "(1, 1, 'FLOP', -1, '2017-06-19 12:59:03', 1)," + "(1, 1, 'TURN', -1, '2017-06-19 12:59:20', 1)," + "(1, 1, 'RIVER', 0, '2017-06-19 12:59:30', 1)"; maBD.Commande(cmd); cmd = "INSERT INTO `historique` (`NumeroPartie`, `numero_evenement`, `description`, `date`) VALUES" + "(1, 1, 'Début de la partie 1', '2017-06-19 16:58:09')," + "(1, 2, 'certs distribue la main 1', '2017-06-19 16:58:09')," + "(1, 3, 'Gros blind: 2', '2017-06-19 16:58:09')," + "(1, 4, 'cheen suit', '2017-06-19 16:58:13')," + "(1, 5, 'certs suit', '2017-06-19 16:58:42')," + "(1, 6, 'On passe à: FLOP', '2017-06-19 16:58:43')," + "(1, 7, 'cheen suit', '2017-06-19 16:58:51')," + "(1, 8, 'certs suit', '2017-06-19 16:59:02')," + "(1, 9, 'On passe à: TURN', '2017-06-19 16:59:03')," + "(1, 10, 'cheen suit', ' 2017-06-19 16:59:10')," + "(1, 11, 'certs suit', '2017-06-19 16:59:20')," + "(1, 12, 'On passe à: RIVER', '2017-06-19 16:59:20')," + "(1, 13, 'cheen suit', '2017-06-19 16:59:30')"; maBD.Commande(cmd); cmd = "INSERT INTO `joueurpartie` (`numero_partie`, `pokerman`, `position`, `Etat`) VALUES" + "(1, 'certs', 0, ' ')," + "(1, 'cheen', 1, ' ')"; maBD.Commande(cmd); cmd = "INSERT INTO `main` (`num_partie`, `num_main`, `bouton`, `etape`, `debut`, `niveauPourSuivre`, `fin`, `j0_c0_v`, `j0_c0_s`, `j0_c1_v`, `j0_c1_s`, `j1_c0_v`, `j1_c0_s`, `j1_c1_v`, `j1_c1_s`, `j2_c0_v`, `j2_c0_s`, `j2_c1_v`, `j2_c1_s`, `j3_c0_v`, `j3_c0_s`, `j3_c1_v`, `j3_c1_s`, `j4_c0_v`, `j4_c0_s`, `j4_c1_v`, `j4_c1_s`, `j5_c0_v`, `j5_c0_s`, `j5_c1_v`, `j5_c1_s`, `f_c0_v`, `f_c0_s`, `f_c1_v`, `f_c1_s`, `f_c2_v`, `f_c2_s`, `t_v`, `t_s`, `r_v`, `r_s`, `valeur_j0`, `valeur_j1`, `valeur_j2`, `valeur_j3`, `valeur_j4`, `valeur_j5`, `capitalJ0`, `capitalFinJ0`, `capitalJ1`, `capitalFinJ1`, `capitalJ2`, `capitalFinJ2`, `capitalJ3`, `capitalFinJ3`, `capitalJ4`, `capitalFinJ4`, `capitalJ5`, `capitalFinJ5`, `gagnant`) VALUES" + "(1, 1, 0, 'RIVER', '2017-06-19 16:58:09', 2, NULL, 2, 2, 12, 0, 3, 0, 11, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, 2, 5, 2, 2, 1, 1, 0, 1, 1, 300020112, 151110705, -1, -1, -1, -1, 100, 98, 100, 98, 0, 0, 0, 0, 0, 0, 0, 0, NULL)"; maBD.Commande(cmd); cmd = "INSERT INTO `partie` (`numero_tournoi`, `numero`, `numero_main`, `debut`, `fin`, `gagnant`, `perdant_5`, `perdant_4`, `perdant_3`, `perdant_2`, `perdant_1`, `perdant_5_date`, `perdant_4_date`, `perdant_3_date`, `perdant_2_date`, `perdant_1_date`, `nom_j0`, `nom_j1`, `nom_j2`, `nom_j3`, `nom_j4`, `nom_j5`) VALUES" + "(0, 1, 1, '2017-06-19 16:58:09', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'certs', 'cheen', NULL, NULL, NULL, NULL)"; maBD.Commande(cmd); cmd = "INSERT INTO `toursparole` (`num_partie`, `num_main`, `nomEtape`, `num_tour`, `dec_j0`, `eng_j0`, `date_j0`, `dec_j1`, `eng_j1`, `date_j1`, `dec_j2`, `eng_j2`, `date_j2`, `dec_j3`, `eng_j3`, `date_j3`, `dec_j4`, `eng_j4`, `date_j4`, `dec_j5`, `eng_j5`, `date_j5`) VALUES" + "(1, 1, 'FLOP', 1, 'SUIVRE', 2, '2017-06-19 16:59:02', 'SUIVRE', 2, '2017-06-19 16:58:51', 'MORT', 0, '2017-06-19 16:58:43', 'MORT', 0, '2017-06-19 16:58:43', 'MORT', 0, '2017-06-19 16:58:43', 'MORT', 0, '2017-06-19 16:58:43')," + "(1, 1, 'PRE_FLOP', 1, 'SUIVRE', 2, '2017-06-19 16:58:42', 'SUIVRE', 2, '2017-06-19 16:58:13', 'MORT', 0, '2017-06-19 16:58:09', 'MORT', 0, '2017-06-19 16:58:09', 'MORT', 0, '2017-06-19 16:58:09', 'MORT', 0, '2017-06-19 16:58:09')," + "(1, 1, 'RIVER', 1, 'Attente', 2, '2017-06-19 16:59:20', 'SUIVRE', 2, '2017-06-19 16:59:30', 'MORT', 0, '2017-06-19 16:59:20', 'MORT', 0, '2017-06-19 16:59:20', 'MORT', 0, '2017-06-19 16:59:20', 'MORT', 0, '2017-06-19 16:59:20')," + "(1, 1, 'TURN', 1, 'SUIVRE', 2, '2017-06-19 16:59:20', 'SUIVRE', 2, '2017-06-19 16:59:10', 'MORT', 0, '2017-06-19 16:59:03', 'MORT', 0, '2017-06-19 16:59:03', 'MORT', 0, '2017-06-19 16:59:03', 'MORT', 0, '2017-06-19 16:59:03')"; maBD.Commande(cmd); MessageBox.Show("BD à un coup de finir une main"); }
private void PrepareBD(object sender, RoutedEventArgs e) { BD_primitive maBD = new BD_primitive(); string cmd = "truncate toursParole"; maBD.Commande(cmd); cmd = "truncate etapes"; maBD.Commande(cmd); cmd = "truncate main"; maBD.Commande(cmd); cmd = "truncate partie"; maBD.Commande(cmd); cmd = "truncate historique"; maBD.Commande(cmd); cmd = "truncate joueurPartie"; maBD.Commande(cmd); cmd = "truncate semaphore"; maBD.Commande(cmd); cmd = "truncate tournois"; maBD.Commande(cmd); cmd = "INSERT INTO etapes (num_partie, num_main, NomEtape, prochainJoueur, date_evenement, num_tour) VALUES" + "(1, 1, 'PRE_FLOP', 2, '2017-06-29 12:29:15', 1)"; maBD.Commande(cmd); cmd = "INSERT INTO `historique` (`NumeroPartie`, `numero_evenement`, `description`, `date`) VALUES" + "(1, 1, 'Début de la partie 1', '2017-06-29 16:28:44')," + "(1, 2, 'certs distribue la main 1', '2017-06-29 16:28:45')," + "(1, 3, 'Gros blind: 2', '2017-06-29 16:28:45')," + "(1, 4, 'certs relance ALL IN (98)', '2017-06-29 16:28:56')," + "(1, 5, 'cheen suit ALL IN', '2017-06-29 16:29:15')"; maBD.Commande(cmd); cmd = "INSERT INTO `joueurpartie` (`numero_partie`, `pokerman`, `position`, `Etat`) VALUES" + "(1, 'certs', 0, ''),"+ "(1, 'cheen', 1, '')," + "(1, 'gos', 2, '')"; maBD.Commande(cmd); cmd = "INSERT INTO `main` (`num_partie`, `num_main`, `bouton`, `etape`, `debut`, `niveauPourSuivre`, `fin`, `j0_c0_v`, `j0_c0_s`, `j0_c1_v`, `j0_c1_s`, `j1_c0_v`, `j1_c0_s`, `j1_c1_v`, `j1_c1_s`, `j2_c0_v`, `j2_c0_s`, `j2_c1_v`, `j2_c1_s`, `j3_c0_v`, `j3_c0_s`, `j3_c1_v`, `j3_c1_s`, `j4_c0_v`, `j4_c0_s`, `j4_c1_v`, `j4_c1_s`, `j5_c0_v`, `j5_c0_s`, `j5_c1_v`, `j5_c1_s`, `f_c0_v`, `f_c0_s`, `f_c1_v`, `f_c1_s`, `f_c2_v`, `f_c2_s`, `t_v`, `t_s`, `r_v`, `r_s`, `valeur_j0`, `valeur_j1`, `valeur_j2`, `valeur_j3`, `valeur_j4`, `valeur_j5`, `capitalJ0`, `capitalFinJ0`, `capitalJ1`, `capitalFinJ1`, `capitalJ2`, `capitalFinJ2`, `capitalJ3`, `capitalFinJ3`, `capitalJ4`, `capitalFinJ4`, `capitalJ5`, `capitalFinJ5`, `gagnant`) VALUES" + "(1, 1, 0, 'PRE_FLOP', '2017-06-29 16:28:45', 100, NULL, 4, 3, 11, 0, 11, 3, 7, 0, 5, 3, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 0, 5, 1, 12, 1, 1, 2, 10, 2, 121110095, 121110097, 155121009, -1, -1, -1, 100, 0, 100, 0, 100, 98, 0, 0, 0, 0, 0, 0, NULL)"; maBD.Commande(cmd); cmd = "INSERT INTO `partie` (`numero_tournoi`, `numero`, `numero_main`, `debut`, `fin`, `gagnant`, `perdant_5`, `perdant_4`, `perdant_3`, `perdant_2`, `perdant_1`, `perdant_5_date`, `perdant_4_date`, `perdant_3_date`, `perdant_2_date`, `perdant_1_date`, `nom_j0`, `nom_j1`, `nom_j2`, `nom_j3`, `nom_j4`, `nom_j5`) VALUES" + "(0, 1, 1, '2017-06-29 16:28:44', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'certs', 'cheen', 'gos', NULL, NULL, NULL)"; maBD.Commande(cmd); cmd = "INSERT INTO `toursparole` (`num_partie`, `num_main`, `nomEtape`, `num_tour`, `dec_j0`, `eng_j0`, `date_j0`, `dec_j1`, `eng_j1`, `date_j1`, `dec_j2`, `eng_j2`, `date_j2`, `dec_j3`, `eng_j3`, `date_j3`, `dec_j4`, `eng_j4`, `date_j4`, `dec_j5`, `eng_j5`, `date_j5`) VALUES" + "(1, 1, 'PRE_FLOP', 1, 'ALL_IN_RELANCER', 100, '2017-06-29 16:28:56', 'ALL_IN_SUIVRE', 100, '2017-06-29 16:29:15', 'GROS_BLIND', 2, '2017-06-29 16:28:45', 'MORT', 0, '2017-06-29 16:28:45', 'MORT', 0, '2017-06-29 16:28:45', 'MORT', 0, '2017-06-29 16:28:45')"; maBD.Commande(cmd); MessageBox.Show("3 joueurs, 2 all-in ..."); }
public void InsereMain() { int j0c0v = -1; int j0c0s = -1; int j0c1v = -1; int j0c1s = -1; int j1c0v = -1; int j1c0s = -1; int j1c1v = -1; int j1c1s = -1; int j2c0v = -1; int j2c0s = -1; int j2c1v = -1; int j2c1s = -1; int j3c0v = -1; int j3c0s = -1; int j3c1v = -1; int j3c1s = -1; int j4c0v = -1; int j4c0s = -1; int j4c1v = -1; int j4c1s = -1; int j5c0v = -1; int j5c0s = -1; int j5c1v = -1; int j5c1s = -1; int cap0 = 0; int capFin0 = 0; int cap1 = 0; int capFin1 = 0; int cap2 = 0; int capFin2 = 0; int cap3 = 0; int capFin3 = 0; int cap4 = 0; int capFin4 = 0; int cap5 = 0; int capFin5 = 0; if (PA.Joueurs[0].Nom.Length > 0 && PA.Joueurs[0].Decision != "MORT") { j0c0v = PA.MainDesJoueurs[0].mainOrigine[0].Valeur; j0c0s = PA.MainDesJoueurs[0].mainOrigine[0].Sorte; j0c1v = PA.MainDesJoueurs[0].mainOrigine[1].Valeur; j0c1s = PA.MainDesJoueurs[0].mainOrigine[1].Sorte; capFin0 = PA.Joueurs[0].Capital; cap0 = PA.Joueurs[0].Capital + PA.Joueurs[0].Engagement; } if (PA.Joueurs[1].Nom.Length > 0 && PA.Joueurs[1].Decision != "MORT") { j1c0v = PA.MainDesJoueurs[1].mainOrigine[0].Valeur; j1c0s = PA.MainDesJoueurs[1].mainOrigine[0].Sorte; j1c1v = PA.MainDesJoueurs[1].mainOrigine[1].Valeur; j1c1s = PA.MainDesJoueurs[1].mainOrigine[1].Sorte; capFin1 = PA.Joueurs[1].Capital; cap1 = PA.Joueurs[1].Capital + PA.Joueurs[1].Engagement; } if (PA.Joueurs[2].Nom.Length > 0 && PA.Joueurs[2].Decision != "MORT") { j2c0v = PA.MainDesJoueurs[2].mainOrigine[0].Valeur; j2c0s = PA.MainDesJoueurs[2].mainOrigine[0].Sorte; j2c1v = PA.MainDesJoueurs[2].mainOrigine[1].Valeur; j2c1s = PA.MainDesJoueurs[2].mainOrigine[1].Sorte; capFin2 = PA.Joueurs[2].Capital; cap2 = PA.Joueurs[2].Capital + PA.Joueurs[2].Engagement; } if (PA.Joueurs[3].Nom.Length > 0 && PA.Joueurs[3].Decision != "MORT") { j3c0v = PA.MainDesJoueurs[3].mainOrigine[0].Valeur; j3c0s = PA.MainDesJoueurs[3].mainOrigine[0].Sorte; j3c1v = PA.MainDesJoueurs[3].mainOrigine[1].Valeur; j3c1s = PA.MainDesJoueurs[3].mainOrigine[1].Sorte; capFin3 = PA.Joueurs[3].Capital; cap3 = PA.Joueurs[3].Capital + PA.Joueurs[3].Engagement; } if (PA.Joueurs[4].Nom.Length > 0 && PA.Joueurs[4].Decision != "MORT") { j4c0v = PA.MainDesJoueurs[4].mainOrigine[0].Valeur; j4c0s = PA.MainDesJoueurs[4].mainOrigine[0].Sorte; j4c1v = PA.MainDesJoueurs[4].mainOrigine[1].Valeur; j4c1s = PA.MainDesJoueurs[4].mainOrigine[1].Sorte; capFin4 = PA.Joueurs[4].Capital; cap4 = PA.Joueurs[4].Capital + PA.Joueurs[4].Engagement; } if (PA.Joueurs[5].Nom.Length > 0 && PA.Joueurs[5].Decision != "MORT") { j5c0v = PA.MainDesJoueurs[5].mainOrigine[0].Valeur; j5c0s = PA.MainDesJoueurs[5].mainOrigine[0].Sorte; j5c1v = PA.MainDesJoueurs[5].mainOrigine[1].Valeur; j5c1s = PA.MainDesJoueurs[5].mainOrigine[1].Sorte; capFin5 = PA.Joueurs[5].Capital; cap5 = PA.Joueurs[5].Capital + PA.Joueurs[5].Engagement; } int f0_v = PA.Flop[0].Valeur; int f0_s = PA.Flop[0].Sorte; int f1_v = PA.Flop[1].Valeur; int f1_s = PA.Flop[1].Sorte; int f2_v = PA.Flop[2].Valeur; int f2_s = PA.Flop[2].Sorte; int t_v = PA.Turn.Valeur; int t_s = PA.Turn.Sorte; int r_v = PA.River.Valeur; int r_s = PA.River.Sorte; int val_J0 = PA.Joueurs[0].ValeurMain; int val_J1 = PA.Joueurs[1].ValeurMain; int val_J2 = PA.Joueurs[2].ValeurMain; int val_J3 = PA.Joueurs[3].ValeurMain; int val_J4 = PA.Joueurs[4].ValeurMain; int val_J5 = PA.Joueurs[5].ValeurMain; int NPS = PA.NiveauPourSuivre * 1; string ins = "insert into main values( " + PA.Numero + ", " + PA.Numero_Main + ", " + PA.Bouton + ", '" + PA.Etape + "', '" + DateTime.Now + "'," + NPS + ", NULL, " + j0c0v + ", " + j0c0s + ", " + j0c1v + ", " + j0c1s + ", " + j1c0v + "," + j1c0s + ", " + j1c1v + ", " + j1c1s + ", " + j2c0v + "," + j2c0s + ", " + j2c1v + ", " + j2c1s + ", " + j3c0v + "," + j3c0s + ", " + j3c1v + ", " + j3c1s + ", " + j4c0v + "," + j4c0s + ", " + j4c1v + ", " + j4c1s + ", " + j5c0v + "," + j5c0s + ", " + j5c1v + ", " + j5c1s + ", " + f0_v + ", " + f0_s + ", " + f1_v + "," + f1_s + "," + f2_v + "," + f2_s + "," + t_v + "," + t_s + "," + r_v + "," + r_s + "," + val_J0 + "," + val_J1 + "," + val_J2 + "," + val_J3 + "," + val_J4 + "," + val_J5 + "," + cap0 + "," + capFin0 + "," + cap1 + "," + capFin1 + "," + cap2 + "," + capFin2 + "," + cap3 + "," + capFin3 + "," + cap4 + "," + capFin4 + "," + cap5 + "," + capFin5 + ", NULL)"; maBD.Commande(ins); }