Clean Up von Client Test.

This commit is contained in:
david_g 2021-02-04 20:51:18 +01:00
parent 470a1c2ae1
commit d1d3438d20

View File

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