示例#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);
                }
            }
        }