예제 #1
0
 public void annulerSpectacle(Spectacle s)
 {
     foreach (Representation r in s.Representations)
     {
     s.annulerRepresentation(r);
     }
 }
예제 #2
0
        /// <summary>
        /// Lister les représentations d'un spectacle
        /// </summary>
        /// <returns></returns>
        private static char MnuRepresentations(Spectacle spectacle)
        {
            char choix = '\u0000'; //unicode de null
            do
            {
                Console.Clear();
                Console.WriteLine("--- {0} ---", spectacle.ToString());
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("--- Liste des représentations ---");
                Console.WriteLine(Environment.NewLine);
                int num = 0;
                foreach (Representation rp in spectacle.Representations)
                {
                    num++;
                    Console.WriteLine("{0} - date : {1} places libres : {2} tarif : {3}", num, rp.Date, rp.PlacesDispo, rp.Tarif);
                }
                Console.WriteLine(Environment.NewLine);
                Console.WriteLine("A. ajouter - S. supprimer - P. Retour menu principal");
                choix = Console.ReadKey().KeyChar;
                switch (choix)
                {
                    case 'a':
                    case 'A':
                        enterRepresentation(spectacle);

                        break;

                    case 's':
                    case 'S':
                        Console.WriteLine("\nEntrer le numero du spectacle à supprimer ?");
                        int numero;
                        if (int.TryParse(Console.ReadLine(), out numero))
                            if (0 < numero && spectacle.Representations.Count > numero-1)
                                spectacle.annulerRepresentation(spectacle.Representations[numero-1]);

                        break;
                }
            } while (choix != 'p' && choix != 'P'); //unicode de P et p
            return choix;
        }