コード例 #1
0
        /// <summary>
        /// Procedure to remove movies from the command line
        /// </summary>
        public void DeScheduleMovie()
        {
            //Do not allow schedule modifications while sales are open
            if (!Open)
            {
                //Read in screen number
                Sched.PrintSchedule();
                Console.WriteLine("Please Enter A Screen Number:");
                var screenA = Console.ReadLine();

                //Check validity
                if (int.TryParse(screenA, out var screenNumA))
                {
                    //Check in range
                    if (screenNumA < 1 || screenNumA > 5)
                    {
                        Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                        return;
                    }

                    //Perform operation
                    Sched.RemoveMovie(screenNumA);
                }
                else
                {
                    Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                }
            }
            else
            {
                Console.WriteLine("Cannot modify schedule while sales are open");
            }
        }
コード例 #2
0
        /// <summary>
        /// Procedure to swap movies from the command line
        /// </summary>
        public void SwapMovies()
        {
            //Do not allow schedule changes while sales are open
            if (!Open)
            {
                //Read in Screen number A
                Sched.PrintSchedule();
                Console.WriteLine("Please Enter A Screen Number:");
                var screenA = Console.ReadLine();
                //Check Validity
                if (int.TryParse(screenA, out var screenNumA))
                {
                    //Check in range
                    if (screenNumA < 1 || screenNumA > 5)
                    {
                        Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                        return;
                    }

                    //Read in Screen number B
                    Console.WriteLine("Please enter screen number to swap with screen {0}", screenNumA);
                    var screenB = Console.ReadLine();
                    //Check validity
                    if (int.TryParse(screenB, out var screenNumB))
                    {
                        //Check in range
                        if (screenNumB < 1 || screenNumB > 5)
                        {
                            Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                            return;
                        }

                        //Perform Swap
                        Sched.SwapMovies(screenNumA, screenNumB);
                    }
                    else
                    {
                        Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                    }
                }
                else
                {
                    Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                }
            }
            else
            {
                Console.WriteLine("Cannot modify schedule while sales are open");
            }
        }
コード例 #3
0
        /// <summary>
        /// Procedure to add movies from the command line
        /// </summary>
        public void ScheduleMovie()
        {
            //Do not allow schedule modifications while sales are open
            if (!Open)
            {
                //Read in screen number
                Sched.PrintSchedule();
                Console.WriteLine("Please Enter A Screen Number:");
                var screenA = Console.ReadLine();
                //Check validity
                if (int.TryParse(screenA, out var screenNumA))
                {
                    //Check in range
                    if (screenNumA < 1 || screenNumA > 5)
                    {
                        Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                        return;
                    }

                    //Read in title
                    Console.WriteLine("Enter Film Title to show at screen {0}", screenNumA);
                    var title = Console.ReadLine();

                    //Modify schedule
                    Sched.AddMovie(title, screenNumA);
                }
                else
                {
                    Console.WriteLine("Invalid numeral entered. Please enter a numeral in range 1-5");
                }
            }
            else
            {
                Console.WriteLine("Cannot modify schedule while sales are open");
            }
        }
コード例 #4
0
 /// <summary>
 /// Used to print the theater's schedule from a separate class
 /// </summary>
 public void Print()
 {
     Sched.PrintSchedule();
 }