Esempio n. 1
0
        private void Reports()
        {
            Console.Clear();
            Console.WriteLine("1 Report Gold and Silver Customers");
            Console.WriteLine("2 Report most recent rented cars");
            Console.WriteLine("3 Report most rented cars in a given month");
            Console.WriteLine("4 Report less rented carts in a given month");
            Console.WriteLine("5 Back to main menu");
            Console.WriteLine("6 Main menu");

            while (true)
            {
                var key = Console.ReadLine().ToString();

                switch (key)
                {
                case "1":
                    var customers = TablePrinter.GetDataInTableFormat(controller.GoldAndSilverCustomers(2));
                    Console.WriteLine(customers);
                    BackToReports();
                    break;

                case "2":
                    var recentCars = TablePrinter.GetDataInTableFormat(controller.MostRecentCars());
                    Console.WriteLine(recentCars);
                    BackToReports();
                    break;

                case "3":
                    var mostRented = TablePrinter.GetDataInTableFormat(controller.MostRentedCars(1));
                    Console.WriteLine(mostRented);
                    BackToReports();
                    break;

                case "4":
                    var lessRented = TablePrinter.GetDataInTableFormat(controller.MostRentedCars(0));
                    Console.WriteLine(lessRented);
                    BackToReports();
                    break;

                case "5":
                    GoToMainMenu();
                    break;

                case "6":
                    GoToMainMenu();
                    break;

                default:
                    Console.WriteLine("Please, choose 1-5 number");
                    break;
                }
            }
        }
Esempio n. 2
0
        private void ListReservations()
        {
            int  number   = 0;
            bool plate    = true;
            bool clientId = false;
            bool start    = false;
            bool end      = false;
            bool location = false;

            while (true)
            {
                Console.Clear();
                var table = TablePrinter.GetDataInTableFormat(controller.ReservationsList(number));
                Console.WriteLine(table);

                Console.WriteLine("Sort by: _                                 1 - Car plate");
                Console.WriteLine("                                           2 - Client ID");
                Console.WriteLine("                                           3 - Start Date");
                Console.WriteLine("                                           4 - End Date");
                Console.WriteLine("                                           5 - Location");
                Console.WriteLine("                                           6 - to Main menu");
                number = Utility.InputAndValidatInt();

                switch (number)
                {
                case 1:
                    if (plate == false)
                    {
                        number = 0;
                        plate  = true;
                    }
                    else
                    {
                        number = 1;
                        plate  = false;
                    }
                    break;

                case 2:
                    if (clientId == false)
                    {
                        number   = 2;
                        clientId = true;
                    }
                    else
                    {
                        number   = 3;
                        clientId = false;
                    }
                    break;

                case 3:
                    if (start == false)
                    {
                        number = 4;
                        start  = true;
                    }
                    else
                    {
                        number = 5;
                        start  = false;
                    }
                    break;

                case 4:
                    if (end == false)
                    {
                        number = 6;
                        end    = true;
                    }
                    else
                    {
                        number = 7;
                        end    = false;
                    }
                    break;

                case 5:
                    if (location == false)
                    {
                        number   = 8;
                        location = true;
                    }
                    else
                    {
                        number   = 9;
                        location = false;
                    }
                    break;

                case 6:
                    GoToMainMenu();
                    break;

                default:
                    number = 0;
                    break;
                }
            }
        }
Esempio n. 3
0
        private void CustomerList()
        {
            int  number    = 0;
            bool id        = true;
            bool name      = false;
            bool birthDate = false;
            bool location  = false;

            while (true)
            {
                Console.Clear();
                var table = TablePrinter.GetDataInTableFormat(controller.CustomerList(number));
                Console.WriteLine(table);

                Console.WriteLine("Sort by: _                                 1 - ClientID");
                Console.WriteLine("                                           2 - Client name");
                Console.WriteLine("                                           3 - Birth date");
                Console.WriteLine("                                           4 - Location");
                Console.WriteLine("                                           5 - to Main menu");
                number = Utility.InputAndValidatInt();

                switch (number)
                {
                case 1:
                    if (id == false)
                    {
                        number = 0;
                        id     = true;
                    }
                    else
                    {
                        number = 1;
                        id     = false;
                    }
                    break;

                case 2:
                    if (name == false)
                    {
                        number = 2;
                        name   = true;
                    }
                    else
                    {
                        number = 3;
                        name   = false;
                    }
                    break;

                case 3:
                    if (birthDate == false)
                    {
                        number    = 4;
                        birthDate = true;
                    }
                    else
                    {
                        number    = 5;
                        birthDate = false;
                    }
                    break;

                case 4:
                    if (location == false)
                    {
                        number   = 6;
                        location = true;
                    }
                    else
                    {
                        number   = 7;
                        location = false;
                    }
                    break;

                case 5:
                    GoToMainMenu();
                    break;

                default:
                    number = 0;
                    break;
                }
            }
        }
Esempio n. 4
0
        private void CarsList()
        {
            int  number       = 0;
            bool id           = true;
            bool plate        = false;
            bool manufacturer = false;
            bool model        = false;
            bool price        = false;
            bool location     = false;

            CarWebService cars = new CarWebService();

            while (true)
            {
                Console.Clear();
                var table = TablePrinter.GetDataInTableFormat(cars.WebServiceCarsList(number));
                Console.WriteLine(table);

                Console.WriteLine("Sort by: _                                 1 - Car ID");
                Console.WriteLine("                                           2 - Plate");
                Console.WriteLine("                                           3 - Manufacturer");
                Console.WriteLine("                                           4 - Model");
                Console.WriteLine("                                           5 - Price Per Day");
                Console.WriteLine("                                           6 - Location");
                Console.WriteLine("                                           7 - to Main menu");
                number = Utility.InputAndValidatInt();

                switch (number)
                {
                case 1:
                    if (id == false)
                    {
                        number = 0;
                        id     = true;
                    }
                    else
                    {
                        number = 1;
                        id     = false;
                    }
                    break;

                case 2:
                    if (plate == false)
                    {
                        number = 2;
                        plate  = true;
                    }
                    else
                    {
                        number = 3;
                        plate  = false;
                    }
                    break;

                case 3:
                    if (manufacturer == false)
                    {
                        number       = 4;
                        manufacturer = true;
                    }
                    else
                    {
                        number       = 5;
                        manufacturer = false;
                    }
                    break;

                case 4:
                    if (model == false)
                    {
                        number = 6;
                        model  = true;
                    }
                    else
                    {
                        number = 7;
                        model  = false;
                    }
                    break;

                case 5:
                    if (price == false)
                    {
                        number = 8;
                        price  = true;
                    }
                    else
                    {
                        number = 9;
                        price  = false;
                    }
                    break;

                case 6:
                    if (location == false)
                    {
                        number   = 10;
                        location = true;
                    }
                    else
                    {
                        number   = 11;
                        location = false;
                    }
                    break;

                case 7:
                    GoToMainMenu();
                    break;

                default:
                    number = 0;
                    break;
                }
            }
        }