def read_renter_list_entity_update_input(self): renterListEntity = RentingListScheme() renterListEntity.car_number = input("enter car number: ") while not CheckInput.test_car_number(renterListEntity.car_number): renterListEntity.car_number = input("Wrong input!\nTry again: ") renterListEntity.date = input("enter renting date(format: year-mm-dd): ") while not CheckInput.test_date(renterListEntity.date): renterListEntity.date = input("Wrong input!\nTry again: ") if CheckInput.check_renting_list_entity_existence(renterListEntity.car_number, renterListEntity.date): renterListEntity.driver_license = input("enter renter driver license: ") while not CheckInput.test_driver_license(renterListEntity.driver_license): renterListEntity.driver_license = input("Wrong input!\nTry again: ") while not CheckInput.check_renter_existence(renterListEntity.driver_license): renter_entity = RenterScheme() input_str = "" input_str = input("There is no such renter!\nWanna add?\n(y/n): ") for case in switch(input_str): if case('y'): renter_entity = self.read_renter_input() renterListEntity.driver_license = renter_entity.driver_license db.insert_renter(renter_entity) break if case('n'): print("can't insert renting list entity") return else: print("____________________") print("no such option, try again!") else: print("There's no such renting list entity") return None return renterListEntity
def delete_entity(db_name): if db_name == "cars": car_number = user_input.get_car_number_input() if not CheckInput.check_car_existence(car_number): print("There is no such car in db!\n") else: db.delete_car(car_number) elif db_name == "renters": driver_license = input("enter renter driver license: ") while not CheckInput.test_driver_license(driver_license): driver_license = input("Wrong input!\nTry again: ") if not CheckInput.check_renter_existence(driver_license): print("There is no such renter in db!\n") else: db.delete_renter(driver_license) elif db_name == "renting_list": car_number = user_input.get_car_number_input() date = input("enter renting date(format: year-mm-dd): ") while not CheckInput.test_date(date): date = input("Wrong input!\nTry again: ") if not CheckInput.check_renting_list_entity_existence( car_number, date): print("There is no such renting list entity in db!\n") else: db.delete_renting_list_entity(car_number, date)