private void Inscription(object sender, RoutedEventArgs e)
        {
            string       fichierMembre_compet = "joueur_compet.txt";
            string       fichierMembre_loisir = "joueur_loisir.txt";
            StreamWriter lire = null;

            string p     = prenom.Text;
            string n     = nom.Text;
            string d_j   = jour.Text;
            string d_m   = mois.Text;
            string d_a   = annee.Text;
            string t     = tel.Text;
            string em    = email.Text;
            string v     = ville.Text;
            string c     = classement.Text;
            string seexe = "";

            if ((bool)male.IsChecked)
            {
                seexe = "M";
            }

            if ((bool)femme.IsChecked)
            {
                seexe = "F";
            }
            if ((bool)compet.IsChecked)
            {
                lire = new StreamWriter(fichierMembre_compet, true);

                lire.Write("\n" + n + "," + p + "," + d_j + "/" + d_m + "/" + d_a + "," + em + "," + t + "," + seexe + "," + v + "," + c);
                lire.Close();
            }
            else if ((bool)loisir.IsChecked)
            {
                lire = new StreamWriter(fichierMembre_loisir, true);

                lire.Write("\n" + n + "," + p + "," + d_j + "/" + d_m + "/" + d_a + "," + em + "," + t + "," + seexe + "," + v);
                lire.Close();
            }

            Ca_marche a = new Ca_marche();

            a.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string       fichier_compet_equipe = "compet_equipe.txt";
            StreamWriter lire = null;

            string l            = lieu.Text;
            string n            = nom_compet.Text;
            string min          = nbre_min_joueur.Text;
            string max          = classement_max.Text;
            string participant  = liste_participant.Text;
            string jour         = nbre_jour.Text;
            string match_simple = nbre_match_simple.Text;
            string match_double = nbre_match_double.Text;
            string anne_min     = annee_min.Text;
            string anne_max     = annee_max.Text;

            lire = new StreamWriter(fichier_compet_equipe, true);
            lire.Write("\n" + l + "," + n + "," + min + "," + max + "," + participant + "," + jour + "," + match_simple + "," + match_double + "," + anne_min + "/" + anne_max + "," + jour + "/" + mois + "/" + annee);
            lire.Close();
            Ca_marche a = new Ca_marche();

            a.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string       fichier_compet_simple = "compet_individuel.txt";
            StreamWriter lire = null;

            string   l                     = lieu.Text;
            string   n                     = nom_compet.Text;
            int      min                   = int.Parse(nbre_min_joueur.Text);
            int      max                   = int.Parse(classement_max.Text);
            string   participant           = liste_participant_equipe1.Text;
            string   adversaire            = liste_participant_equipe2.Text;
            int      jour                  = int.Parse(nbre_jour.Text);
            int      match                 = int.Parse(nbre_match.Text);
            int      anne_min              = int.Parse(annee_min.Text);
            int      anne_max              = int.Parse(annee_max.Text);
            int      jou                   = int.Parse(jourr.Text);
            int      moi                   = int.Parse(moiss.Text);
            int      ann                   = int.Parse(anneee.Text);
            DateTime date                  = new DateTime(ann, moi, jou);
            List <Joueur_competition> list = new List <Joueur_competition>();

            string[] list_j  = participant.Split('/');
            string[] list_ad = adversaire.Split('/');
            List <Joueur_competition> list_j_c = Liste_joueur_compet();
            List <Joueur_competition> list_adv = new List <Joueur_competition>();

            foreach (string nom in list_j)
            {
                foreach (Joueur_competition j in list_j_c)
                {
                    if (nom == j.Nom)
                    {
                        list.Add(j);
                    }
                }
            }
            foreach (string name in list_ad)
            {
                Joueur_competition joueur = new Joueur_competition(name);
                list_adv.Add(joueur);
            }

            Equipe_competition eq = new Equipe_competition(list_adv);

            Competition_simple compet_s = new Competition_simple(match, l, list, jour, n, max, min, anne_min, anne_max, date);

            lire = new StreamWriter(fichier_compet_simple, true);
            if (compet_s.Assez_de_joueur())
            {
                compet_s.Creation_List_Match(eq);
                compet_s.Compatibilite_age();
            }

            //On verifie que les joueurs peuvent bien jouer et doncc on creer la nouvelle liste des joueurs
            string affichage = "";

            foreach (Joueur_competition j in compet_s.Liste_joueur_ok)
            {
                affichage += (j.Nom + "/");
            }

            lire.Write("\n" + l + "," + n + "," + min + "," + max + "," + affichage + "," + jour + "," + match + "," + anne_min + "/" + anne_max + "," + jou + "/" + moi + "/" + ann);
            lire.Close();
            Ca_marche a = new Ca_marche();

            a.Show();
            this.Close();
        }