public Session(Cinemahall CinemahallInstance, Movie MovieInstance)
 {
     ++count;
     id     = count;
     places = new Place[CinemahallInstance.Size];
     for (int i = 0; i < CinemahallInstance.Size; ++i)
     {
         places[i] = new Place();
     }
     hallName    = CinemahallInstance.Name;
     movieName   = MovieInstance.Name;
     duration    = MovieInstance.Duration;
     category    = MovieInstance.Category;
     countPlaces = CinemahallInstance.Size;
     start       = "\0";
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                int count = (File.ReadAllLines("ListOfMovies.txt").Length) / 3;

                StreamReader file = new StreamReader("ListOfMovies.txt");

                Movie[] Movies = new Movie[count];
                for (int i = 0; i < count; ++i)
                {
                    Movies[i] = new Movie();
                }
                Movie.fillMovies(ref file, ref Movies);
                // for (int i = 0; i < count; ++i) { Movies[i].output(); }
                file.Close();
                Cinemahall[] halls = new Cinemahall[2];

                halls[0] = new Cinemahall("GreenHall");
                halls[1] = new Cinemahall("YellowHall", 40);

                Schedule oneShedule = Schedule.getInstance(Movies, halls);

                oneShedule.output();


                int numberSession, numberPlace;
                Console.WriteLine("Please Input number of session!");
                numberSession = Convert.ToInt32(Console.ReadLine());
                oneShedule.ArraySession[numberSession - 1].output();

                for (int i = 0; i < oneShedule.ArraySession[numberSession - 1].CountPlaces; ++i)
                {
                    if (i % 10 == 0)
                    {
                        Console.WriteLine();
                    }
                    if (oneShedule.ArraySession[numberSession - 1].Places[i].check())
                    {
                        Console.Write($" {i}_ ");
                    }
                    else
                    {
                        Console.Write($" {i}X ");
                    }
                }

                Console.WriteLine("Please Input number of place");
                numberPlace = Convert.ToInt32(Console.ReadLine());
                oneShedule.ArraySession[numberSession - 1].places[numberPlace].take();
                for (int i = 0; i < oneShedule.ArraySession[numberSession - 1].CountPlaces; ++i)
                {
                    if (i % 10 == 0)
                    {
                        Console.WriteLine();
                    }
                    if (oneShedule.ArraySession[numberSession - 1].Places[i].check())
                    {
                        Console.Write($" {i}_ ");
                    }
                    else
                    {
                        Console.Write($" {i}X ");
                    }
                }

                Console.ReadKey();
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
                Console.Read();
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            try
            {
                int count = (File.ReadAllLines("ListOfMovies.txt").Length) / 3;

                StreamReader file = new StreamReader("ListOfMovies.txt");

                Movie[] Movies = new Movie[count];
                for (int i = 0; i < count; ++i)
                {
                    Movies[i] = new Movie();
                }
                Movie.fillMovies(ref file, ref Movies);
                // for (int i = 0; i < count; ++i) { Movies[i].output(); }
                file.Close();
                Cinemahall[] halls = new Cinemahall[2];

                halls[0] = new Cinemahall("GreenHall");
                halls[1] = new Cinemahall("YellowHall", 40);

                Schedule oneSchedule = Schedule.getInstance(Movies, halls);

                //oneSchedule.output();

                Console.WriteLine("You are in switch menu now. Please choose next options");
                Console.WriteLine("To get list of sessions input 0");
                //  Console.WriteLine("Write session id and push Enter to have access to with session");

                int control;
                oneSchedule.output();
                do
                {
                    control = inputInt();
                    switch (control)
                    {
                    case 0: { oneSchedule.output(); break; }

                    case -1: { Console.WriteLine("To finish program push  any key!"); break; }

                    default:
                    {
                        if (control >= 1 && control <= oneSchedule.ArraySession.Length)
                        {
                            SessionMenu(control, ref oneSchedule);
                            oneSchedule.output();
                            control = 0;
                        }
                        else
                        {
                            Console.WriteLine("You are in switch menu now. Please choose next options");
                            Console.WriteLine("To get list of sessions input 0");
                        }
                        break;
                    }
                    }
                } while (control != -1);
                Console.ReadKey();
            }
            catch (IOException e)
            {
                Console.WriteLine(e.Message);
                Console.Read();
            }
        }
Exemplo n.º 4
0
 public Cinemahall(Cinemahall obj)
 {
     this.name = obj.Name;
     this.Size = obj.Size;
 }