Exemplo n.º 1
0
        public override void Display()
        {
            base.Display();

            if (SessionManager.IsAdmin())
            {
                Console.BackgroundColor = ConsoleColor.Blue;
                Output.WriteLine(ConsoleColor.White, "--------== {0} ==--------\n", base.Title);
                Console.BackgroundColor = ConsoleColor.Black;
            }
            else
            {
                Console.BackgroundColor = ConsoleColor.Magenta;
                Output.WriteLine(ConsoleColor.White, "--------== {0} ==--------\n", base.Title);
                Console.ForegroundColor = ConsoleColor.White;
                Console.BackgroundColor = ConsoleColor.Black;
            }

            /*
             * Get data from the Database
             */
            try
            {
                Output.WriteLine("FILM LIST: ");
                TablePrinter.Film(SessionManager.GetServiceClient().GetFilmList());
            }
            catch {
                Console.WriteLine("Error! Retry later!");
            }

            /*
             * Navigate back
             */
            Input.ReadString("Press [Enter] to navigate back");
            Program.NavigateBack();
        }
Exemplo n.º 2
0
        public override void Display()
        {
            base.Display();

            Console.BackgroundColor = ConsoleColor.Blue;
            Output.WriteLine(ConsoleColor.White, "--------== {0} ==--------\n", base.Title);
            Console.BackgroundColor = ConsoleColor.Black;

            try
            {
                /*
                 * Show the user the Film and the Hall List
                 */

                Output.WriteLine("LIST OF EVENT ALREADY INSERTED: ");
                TablePrinter.Event(SessionManager.GetServiceClient().GetEventsList());
                Output.WriteLine("FILM LIST:");
                TablePrinter.Film(SessionManager.GetServiceClient().GetFilmList());
                Console.WriteLine("\nHALL LIST:");
                TablePrinter.Hall(SessionManager.GetServiceClient().GetHallsList());

                /*
                 * Add Event Form
                 *
                 * Every input must be valid and checked.
                 */
                Output.WriteLine("------ ADD NEW EVENT ------- ");
                string date_time = Input.ReadString("Data and Time of the Event: ");
                // Navigate back if User type "\\" on first input
                if (date_time.Contains("\\"))
                {
                    Program.NavigateBack();
                }
                DateTime dateTime  = Controls.CheckDate(date_time);
                string   film_code = Input.ReadString("Code of the Film: ");
                int      filmCode  = Controls.CheckIntForeignKey(film_code, "Film");
                string   hall_code = Input.ReadString("Hall code of the Event: ");
                int      hallCode  = Controls.CheckIntForeignKey(hall_code, "Sala");
                string   _price    = Input.ReadString("Insert the Price (ex: 8,50): ");
                decimal  price     = Controls.CheckDecimal(_price);

                /*
                 * Send data to Database
                 */
                if (SessionManager.GetServiceClient().AddEvent(SessionManager.GetUser().Username, dateTime, filmCode, hallCode, price))
                {
                    Output.WriteLine("\nEVENT INSERTION SUCCESSFUL\n");
                }
                else
                {
                    Output.WriteLine("\nEVENT INSERTION FAILED!\nCheck that there are no other events at the same time, in the same date and in the same hall!");
                }
            } catch {
                Console.WriteLine("Error! Retry later!");
            }

            /*
             * Navigate back
             */
            Input.ReadString("Press [Enter] to navigate back");
            Program.NavigateBack();
        }
Exemplo n.º 3
0
        public override void Display()
        {
            base.Display();

            Console.BackgroundColor = ConsoleColor.Blue;
            Output.WriteLine(ConsoleColor.White, "--------== {0} ==--------\n", base.Title);
            Console.BackgroundColor = ConsoleColor.Black;

            /*
             * Change output encoding to allow special
             * characters output such as €
             */
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            try
            {
                if (SessionManager.GetServiceClient().GetFilmList().Count != 0)
                {
                    /*
                     * Show the Admin the Film
                     */
                    Output.WriteLine("FILM LIST: ");
                    TablePrinter.Film(SessionManager.GetServiceClient().GetFilmList());

                    /*
                     * Delete Film Form
                     *
                     * Every Primary Key input must be valid.
                     */
                    Output.WriteLine("\n------ DELETE FILM ------- ");
                    string film_code = Input.ReadString("Insert the Code of the Film to delete: ");
                    // Navigate back if User type "\\" on first input
                    if (film_code.Contains("\\"))
                    {
                        Program.NavigateBack();
                    }
                    int filmCode = Controls.CheckIntForeignKey(film_code, "Film");

                    /*
                     * Send data to Database
                     */
                    if (SessionManager.GetServiceClient().DeleteFilm(filmCode))
                    {
                        Output.WriteLine("\nFILM CANCELLATION SUCCESS!\n");
                    }
                    else
                    {
                        Output.WriteLine("\nFILM CANCELLATION FAILED! Retry!\n");
                    }
                }
                else
                {
                    Console.WriteLine("There are no Film in the DataBase!");
                }
            }
            catch {
                Console.WriteLine("Error! Retry later!");
            }

            /*
             * Navigate back
             */
            Input.ReadString("Press [Enter] to navigate back");
            Program.NavigateBack();
        }