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); }
//ustawienie domyślnego użytkownika przy pierwszym uruchomieniu public static void DefaultUser() { users = new List <User>(); if (!File.Exists(@"./users.bin")) { //default admin User admin = new Admin("admin", "admin2020", "", "", "", ""); //default user User user = new Employee("user", "user2020", "", "", "", ""); users.Add(admin); users.Add(user); } else { SerializeBIN.LoadUsers(); } }