Пример #1
0
        public static void Run()
        {
            //---------------------------------------------------------------------
            bool end = false;

            do
            {
                SetupMenu();
                Console.WriteLine();

                switch (Helper.InputInt("\nWybierz opcję: "))
                {
                case 1:
                    AddUser();
                    SerializeBIN.SaveUsers();
                    break;

                case 2:
                    Program.users.ForEach(Console.WriteLine);
                    Helper.Wait();
                    break;

                case 6:
                    SerializeBIN.SaveUsers();
                    Helper.Wait();
                    break;

                case 7:
                    SerializeBIN.LoadUsers();
                    Helper.Wait();
                    break;

                case 8:
                    SerializeXML.SaveRoomData();
                    SerializeXML.SaveReservationData();
                    Helper.Wait();
                    break;

                case 9:
                    SerializeXML.LoadRoomData();
                    SerializeXML.LoadReservationData();
                    Helper.Wait();
                    break;

                case 0:

                    end = true;
                    break;

                default:
                    break;
                }
            } while (!end);
        }
Пример #2
0
        public static void LoadData()
        {
            Console.WriteLine($"\n{ Helper.HeaderText()}\n");

            if (Helper.ContinueQuestion("Czy wczytać zapisane dane (t/n): "))
            {
                if (File.Exists(@"./reservationdata.xml") && (File.Exists(@"./hoteldata.xml")))
                {
                    SerializeXML.LoadRoomData();
                    SerializeXML.LoadReservationData();
                    Thread.Sleep(2000);
                }
                else
                {
                    Console.WriteLine("Brak zapisanych danych");
                    Thread.Sleep(2000);
                }
            }
        }
Пример #3
0
        public static void Start()
        {
            //---------------------------------------------------------------------
            bool end = false;



            do
            {
                Helper.MainMenu();
                Console.WriteLine();

                switch (Helper.InputInt("\nWybierz opcję: "))
                {
                case (int)MainMenu.AddReservation:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Rezerwacja pokoju");
                    hotel.AddReservation();
                    //hotel.ReservationsList.ForEach(Console.WriteLine);
                    Helper.Wait();

                    break;

                case (int)MainMenu.CancelReservation:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Usuwanie rezerwacji");
                    hotel.RemoveReservation();
                    Helper.Wait();
                    hotel.ReservationsList.ForEach(Console.WriteLine);
                    break;

                case (int)MainMenu.ShowReservations:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Wszystkie Rezerwacje:\n");
                    hotel.ReservationsList.ForEach(Console.WriteLine);
                    Helper.Wait();
                    break;

                case (int)MainMenu.ShowRooms:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Wszystkie Pokoje");
                    Hotel.hotellist.ForEach(Console.WriteLine);
                    Helper.Wait();
                    break;

                case (int)MainMenu.ShowFreeRooms:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Wolne pokoje");
                    Hotel.hotellist.FindAll(s => s.Status == false).ForEach(Console.WriteLine);
                    Helper.Wait();
                    break;

                case (int)MainMenu.ShowReservedRooms:
                    Console.Clear();
                    Console.WriteLine($"\n{Helper.HeaderText()}\n");
                    Console.WriteLine("Zarezerwowane pokoje");
                    Hotel.hotellist.FindAll(s => s.Status != false).ForEach(Console.WriteLine);
                    Helper.Wait();
                    break;

                case (int)MainMenu.SetUp:

                    if (currentuser.IsAdminn())
                    {
                        Setup.Run();
                    }
                    else
                    {
                        Console.WriteLine("Nie masz uprawnień");
                        Helper.Wait();
                    }

                    break;

                case (int)MainMenu.Exit:

                    end = true;

                    SerializeBIN.SaveUsers();
                    SerializeXML.SaveRoomData();
                    SerializeXML.SaveReservationData();
                    break;

                default:
                    break;
                }
            } while (!end);
        }