Kundenverwaltung abfrage, welche Zimmer in Zeitraum frei funktioniert.

This commit is contained in:
david_g 2021-02-03 19:33:46 +01:00
parent 4abc71dd7b
commit 864ae2768d
1 changed files with 116 additions and 31 deletions

View File

@ -61,6 +61,28 @@ class Client():
Client.clients += 1
def check_in(self, room, key_num):
print("Check In")
while True:
print("Aufenthaltszeitraum")
while True:
day_arrival = input("Anreisetag: ")
if day_arrival.isdigit() and 0 < int(day_arrival) and int(day_arrival) < 28:
break
while True:
month_arrival = input("Anreisemonat: ")
if month_arrival.isdigit() and 0 < int(month_arrival) and int(month_arrival) < 12:
break
while True:
day_depature = input("Abreisetag: ")
if day_depature.isdigit() and 0 < int(day_depature) and int(day_depature) < 28:
break
while True:
month_depature = input("Abreisemonat: ")
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)
self.period = str(period)
room_list[reference.index(str(room))].occupy(self.surname, self.period)
self.room = str(room)
num_ = "key_" + str(key_num) + ".hand_out_key(" + str(key_num) + "," + "'" + str(self.surname) + "')"
@ -203,6 +225,60 @@ class Room:
self.resident = None
self.period = None
def is_free(self, client_num, room_name):
occupied = self.period
if occupied == None:
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 = str(client_num) + ".check_in(" + "'" + str(room_name) + "'" + "," + str(key_num)+ ")"
print(check)
exec(check)
def is_occupied(self, room_name, period):
if self.period == None:
print("Das Zimmer", str(room_name)," ist frei.")
if self.period != None:
stay_period = []
num_string = ""
for i in self.period:
if i.isnumeric():
num_string += i
if i == ",":
stay_period.append(num_string)
num_string = ""
stay_period.append(num_string)
stay_period_new = []
num_string = ""
for i in period:
if i.isnumeric():
num_string += i
if i == ",":
stay_period_new.append(num_string)
num_string = ""
stay_period_new.append(num_string)
#print(stay_period, stay_period_new)
if int(stay_period[3]) < int(stay_period_new[3]):
print("Das Zimmer", room_name, "ist in dem gewünschten Zeitraum frei.")
if int(stay_period[3]) > int(stay_period_new[3]):
print("Das Zimmer", room_name, " ist in dem gewünschten Zeitraum belegt.")
if int(stay_period[3]) == int(stay_period_new[3]):
if int(stay_period[2]) > int(stay_period_new[2]):
print("Das Zimmer", room_name, " ist in dem gewünschten Zeitraum belegt.")
if int(stay_period[2]) <= int(stay_period_new[2]):
print("Das Zimmer", room_name, "ist in dem gewünschten Zeitraum belegt.")
# room information
def info(self, action = None):
dic_ = {"Nummer" : self.number,
@ -407,27 +483,7 @@ def add_client():
if surname.isalpha():
break
while True:
print("Aufenthaltszeitraum")
while True:
day_arrival = input("Anreisetag: ")
if day_arrival.isdigit() and 0 < int(day_arrival) and int(day_arrival) < 28:
break
while True:
month_arrival = input("Anreisemonat: ")
if month_arrival.isdigit() and 0 < int(month_arrival) and int(month_arrival) < 12:
break
while True:
day_depature = input("Abreisetag: ")
if day_depature.isdigit() and 0 < int(day_depature) and int(day_depature) < 28:
break
while True:
month_depature = input("Abreisemonat: ")
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)
print(period)
period = None
client_num = "c" + str(Client.clients)
room_num = None
key_num = None
@ -624,6 +680,33 @@ Abbrechen
if client == "3":
print("Kunde einchecken\n")
while True:
print("In welchem Zeitraum möchten Sie schauen, ob Zimmer frei sind?")
print("Aufenthaltszeitraum")
while True:
day_arrival = input("Anreisetag: ")
if day_arrival.isdigit() and 0 < int(day_arrival) and int(day_arrival) < 28:
break
while True:
month_arrival = input("Anreisemonat: ")
if month_arrival.isdigit() and 0 < int(month_arrival) and int(month_arrival) < 12:
break
while True:
day_depature = input("Abreisetag: ")
if day_depature.isdigit() and 0 < int(day_depature) and int(day_depature) < 28:
break
while True:
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)
#print(period)
for i in reference:
k = str(i) + ".is_occupied(" + "'" + str(i) + "'" + "," + "'" + str(period) + "'" + ")"
#print(k)
exec(k)
print("Welchen Kunden möchten Sie einchecken?")
print(client_list)
while True:
@ -631,22 +714,24 @@ Abbrechen
if client in client_list:
break
while True:
print("Zimmernummer")
print("Zimmer")
room_ = input()
if room_ in reference:
break
else:
print("Dieses Zimmer ist in unserem hotel leider nicht vorhanden.")
print("Dieses Zimmer ist in unserem Hotel leider nicht vorhanden.")
room_types = [["Single", 10], ["Double", 20], ["Suite", 30], ["Panorama_Suite", 40]]
for i in room_types:
if i[0] == room_:
key_num = i[1]+1
print("Der Kunde erhält den Schlüssel", key_num)
#room_types = [["Single", 10], ["Double", 20], ["Suite", 30], ["Panorama_Suite", 40]]
#for i in room_types:
# if i[0] == room_:
# key_num = i[1]+1
# print("Der Kunde erhält den Schlüssel", key_num)
check = str(client) + ".check_in(" + "'" + str(room_) + "'" + "," + str(key_num)+ ")"
print(check)
exec(check)
#check = str(client) + ".check_in(" + "'" + str(room_) + "'" + "," + str(key_num)+ ")"
#print(check)
#exec(check)
clear()
continue
if client == "4":