From d1d3438d2075157c45f62cd7eda08f1c0fa5cdf2 Mon Sep 17 00:00:00 2001 From: david_g Date: Thu, 4 Feb 2021 20:51:18 +0100 Subject: [PATCH] Clean Up von Client Test. --- client_test.py | 81 ++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 59 deletions(-) diff --git a/client_test.py b/client_test.py index b5c9263..bd1ccc9 100644 --- a/client_test.py +++ b/client_test.py @@ -61,10 +61,6 @@ class Client(): self.status = False self.checked_in = checked_in - # Automatic status adjustment - if len(self.bookings) >= 4: - self.status = True - Client.clients += 1 def check_in(self, room, key_num, period): print("Check In") @@ -103,7 +99,6 @@ Frühstück sowie die kostenlose Benutzung der Mini-Bar.") except: ("Schlüssel mit Daten nicht gefunden.") - def client_bill(self, bill_num): self.bookings.append(str(bill_num)) @@ -183,17 +178,11 @@ Frühstück sowie die kostenlose Benutzung der Mini-Bar.") print(i.ljust(16), ": ", dic_[i]) - - -#w43 = Client("David", "Gebert", "w43", "Suite", "01,02,03,03", 22, (51,61,77), False) -#w43.period_print() - - #----------------CLASS--ROOM------------------------------------------ -''' Implementierung der Klasse Zimmer ''' class Room: + ''' Implementierung der Klasse Zimmer ''' def __init__(self, room_number, guest=None, period=None): self.number = room_number @@ -221,7 +210,6 @@ class Room: for i in room_types: if i[0] == room_name: key_num = i[1]+1 - #print("Der Kunde erhält den Schlüssel", key_num) check = "exec(" + str(client_num) + ".check_in(" + "'" + str(room_name) + "'" + "," + str(key_num)\ + "," + "'" + str(period) + "'" +"))" @@ -250,14 +238,12 @@ class Room: num_string = "" stay_period_new.append(num_string) - #print(stay_period, stay_period_new) if int(stay_period[3]) < int(stay_period_new[1]): room_types = [["Single", 10], ["Double", 20], ["Suite", 30], ["Panorama_Suite", 40]] for i in room_types: if i[0] == room_name: key_num = i[1]+1 - #print("Der Kunde erhält den Schlüssel", key_num) check = "exec(" + str(client_num) + ".check_in(" + "'" + str(room_name) + "'" + "," + str(key_num)\ + "," + "'" + str(period) + "'" +"))" @@ -277,7 +263,6 @@ class Room: for i in room_types: if i[0] == room_name: key_num = i[1]+1 - #print("Der Kunde erhält den Schlüssel", key_num) check = "exec(" + str(client_num) + ".check_in(" + "'" + str(room_name) + "'" + "," + str(key_num)\ + "," + "'" + str(period) + "'" +"))" @@ -452,14 +437,12 @@ class Accounting(): print("Rechnung wurde storniert.") -#r43 = Accounting("Karl", "Otto", 16, 21,"2,3,4,5", "", False) - -#-------------YOU---ARE--LEAVING--CLASS--ACCOUNTING---------------------------- #-------------ADDITIONAL--ACCOUNTING--METHODS-------------------------- bill_list = [] def add_bill(name, surname, client_num, room, period): + bill_numb = "r" + str(Accounting.counter) c = bill_numb + " = Accounting(" + '"' + str(name) + '"' + "," + '"' + \ @@ -483,6 +466,7 @@ def show_single_bill(): except: print("Rechnung wurde nicht gefunden.") + def pay_your_bill(): print("Folgenden Rechnungsnummern stehen zur Auswahl:") print(bill_list) @@ -498,13 +482,11 @@ def pay_your_bill(): except: print("Rechung wurde nicht gefunden.") + def delete_bill(bill_numb): k = str(bill_numb) + ".delete_bill(bill_numb)" exec(k) - - - #-------------ADDITIONAL---CLIENT---METHODS------------------------- @@ -536,7 +518,6 @@ def add_client(): c = str(client_num) + " = Client(" + '"' + str(name) + '"' + "," + '"' + \ str(surname) + '"' + "," + '"' + str(client_num) + '"' + "," + '"' + str(room_num) \ + '"' + "," + '"' + str(period) + '"' + "," + '"'+ str(key_num) + '"' + ",[], False, False)" - #print(c) client_list.append(client_num) all_clients.append(client_num) return c @@ -547,7 +528,6 @@ exec(k) j = c0.check_in("Suite",31, "2,3,4,5") exec(j) -#print(c0.info()) clear() @@ -570,6 +550,7 @@ def play_sound(): return play_obj return None + def stop_sound(play_obj): if play_obj is not None: play_obj.stop() @@ -581,7 +562,6 @@ def ascii_print(): sys.stdout.write(line) time.sleep(0.1) - system_list = ["1", "2", "3", "4", "5"] """-------------START-----INTERFACE--------------------""" input("Start?") @@ -592,7 +572,7 @@ play_obj = play_sound() #Logo Print ascii_print() - + print("\t\tWELCOME TO THE GRAND BUDAPEST HOTEL SYSTEM") input("\t\t\tPress enter to continue") clear() @@ -665,15 +645,12 @@ Abbrechen break else: delete_bill(bill_numb) # Delete bill at client - + bill_list.remove(bill_numb) # Delete bill at bill_list delete_ = "del " + bill_numb exec(delete_) # Delete bill in system - #### - #Kunde auschecken - #### input() clear() continue @@ -681,9 +658,9 @@ Abbrechen if account == "abbrechen": clear() break - + #"""-----------INTERFACE-----CLIENT------------------""" - + if system == "2": #Client clear() while True: @@ -699,7 +676,7 @@ Abbrechen Abbrechen """) - + client = input().strip().lower() if client == "1": print("Kunde hinzufügen\n") @@ -722,11 +699,11 @@ Abbrechen input() clear() continue - + if client == "3": print("Kunde einchecken\n") print("Welchen Kunden möchten Sie einchecken?") - + print(client_list) while True: client = input() @@ -757,15 +734,15 @@ Abbrechen month_depature = input("Abreisemonat: ") if month_depature.isdigit() and 0 < int(month_depature) and int(month_depature) < 12: break - + period = str(day_arrival) + "," +str(month_arrival) + "," + str(day_depature) + "," + str(month_depature) check_ = str(room_) + ".is_free(" + "'" + str(client) + "'" + "," + "'" + str(room_) \ + "'" + "," + "'" + str(period) + "'" + ")" print(check_) exec(check_) - - + + clear() continue @@ -782,7 +759,7 @@ Abbrechen if client == "abbrechen": break - + clear() continue @@ -825,7 +802,7 @@ Abbrechen break #"""-----------INTERFACE-----ROOM------------------""" - + if system == "3": #Room clear() while True: @@ -848,7 +825,7 @@ Abbrechen 1. Ale Informationen 2. Nummer 3.Gast""") - + dorm_info = input() if dorm_info == "1": print("Zimmer:", dorm) @@ -878,7 +855,7 @@ Abbrechen if room_input == "abbrechen": clear() break - + if system == "4": #Key clear() @@ -888,7 +865,7 @@ Abbrechen print(""" 1. Schlüsselstatus anzeigen Abbrechen""") - + key_input = input().strip().lower() if key_input == "1": while True: @@ -932,7 +909,7 @@ Abbrechen""") with open('dienstplan.txt', 'r', encoding='utf8') as d: for line in d: print(line) - + while True: print("\nWillkommen dei den Dienstplänen") print("Welche der folgenen Aktionen möchten Sie ausführen") @@ -974,9 +951,6 @@ dienstplan.txt im Verzeichnis gefunden werden.") input() clear() break - - - if system == "beenden": clear() @@ -984,16 +958,5 @@ dienstplan.txt im Verzeichnis gefunden werden.") print("Auf Wiedersehen!") break - - - - - - - - - - - #break - +