removed client _test.py
This commit is contained in:
parent
faf928c33d
commit
29b08bef4f
125
client _test.py
125
client _test.py
|
@ -1,125 +0,0 @@
|
|||
import math
|
||||
|
||||
|
||||
class key:
|
||||
how_many_keys = 0
|
||||
|
||||
# Initialisierung eines Schlüssels
|
||||
def __init__(self, keynumber):
|
||||
self.number = keynumber
|
||||
self.possessor = "Reception"
|
||||
|
||||
#where are the keys
|
||||
def status_key(self, keynumber=None):
|
||||
return self.number, self.possessor
|
||||
|
||||
def hand_out_key(self, keynumber, Guest):
|
||||
self.possessor = Guest
|
||||
|
||||
def get_back_key(self, keynumber):
|
||||
self.possessor = "Reception"
|
||||
|
||||
key_list = []
|
||||
for i in range(11, 42, 10):
|
||||
a = "key_" + str(i) + " = key(" + str(i) + ")"
|
||||
exec(a)
|
||||
a2 = "key_list.append(key_" + str(i) + ")"
|
||||
exec(a2)
|
||||
|
||||
b = "key_" + str(i+1) + " = key(" + str(i+1) + ")"
|
||||
exec(b)
|
||||
b2 = "key_list.append(key_" + str(i+1) + ")"
|
||||
exec(b2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Client():
|
||||
months = ['Januar', 'Februar','März','April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
|
||||
|
||||
clients = 0
|
||||
def __init__(self, name: str, surname: str, client_num: int, room_num: int, period, key_num: int, bookings, status: bool):
|
||||
self.name = name
|
||||
self.surname = surname
|
||||
self.client_num = client_num
|
||||
self.room_num = room_num
|
||||
self.period = period
|
||||
self.key_num = key_num
|
||||
self.bookings = bookings
|
||||
self.status = status
|
||||
|
||||
# Automatic status adjustment
|
||||
if len(self.bookings) >= 4:
|
||||
self.status = True
|
||||
Client.clients += 1
|
||||
|
||||
def change_room(self, surname, room_num = 0, key_num = 0):
|
||||
self.room_num = room_num
|
||||
num_ = "key_" + str(key_num) + ".hand_out_key(" + str(key_num) + "," + "'" + str(surname) + "')"
|
||||
try:
|
||||
exec(num_)
|
||||
self.key_num = key_num
|
||||
except:
|
||||
("Schlüssel mit Daten nicht gefunden.")
|
||||
|
||||
def name_change(self, name, surname):
|
||||
self.name = name
|
||||
self.surname = surname
|
||||
|
||||
# Length of stay as print
|
||||
def period_print(self):
|
||||
stay_period = []
|
||||
for i in self.period:
|
||||
if i.isdigit():
|
||||
stay_period.append(i)
|
||||
|
||||
|
||||
stay_period = tuple(stay_period)
|
||||
# Same month
|
||||
if stay_period[1] == stay_period[3]:
|
||||
days = int(stay_period[0]) - int(stay_period[2])
|
||||
month_num = int(stay_period[1]) + 1
|
||||
month_print = Client.months[month_num]
|
||||
print("Der Kunde bleibt", abs(days), "Tage.")
|
||||
print("Vom", stay_period[0], "bis", stay_period[2], month_print)
|
||||
# Across months
|
||||
if stay_period[1] != stay_period[3]:
|
||||
days = 28 - int(stay_period[0]) + int(stay_period[2])
|
||||
month_num_1 = int(stay_period[1]) - 1
|
||||
month_num_2 = int(stay_period[3]) - 1
|
||||
month_print_1 = Client.months[month_num_1]
|
||||
month_print_2 = Client.months[month_num_2]
|
||||
print("Der Kunde bleibt", abs(days), "Tage.")
|
||||
print("Vom", stay_period[0], month_print_1, "bis", stay_period[2], month_print_2)
|
||||
|
||||
|
||||
# Client information
|
||||
def info(self, action = None):
|
||||
dic_ = {"Name" : self.name,
|
||||
"Nachname" : self.surname,
|
||||
"Kundennummer" : self.client_num,
|
||||
"Zimmernummer" : self.room_num,
|
||||
"Aufenthaltsdauer": self.period,
|
||||
"Schlüsselnummer" : self.key_num,
|
||||
"Buchungen" : self.bookings,
|
||||
"VIP-Status" : self.status
|
||||
}
|
||||
if action != None:
|
||||
# If asked client information is stay period
|
||||
if action == "Aufenthaltsdauer":
|
||||
client_num = self.client_num
|
||||
stay = str(client_num)+ ".period_print()"
|
||||
exec(stay)
|
||||
# If asked client information is different
|
||||
if action != "Aufenthaltsdauer":
|
||||
for i in dic_:
|
||||
if i == action:
|
||||
print(action, "ist", dic_[i])
|
||||
else:
|
||||
for i in dic_:
|
||||
print(i.ljust(16), ": ", dic_[i])
|
||||
|
||||
|
||||
|
||||
w43 = Client("David", "Gebert", "w43", 0, "11,2,5,3", 22, (51,61,77), False)
|
Loading…
Reference in New Issue