def __add_car(self):
     '''
     Function that adds a car
     :return:
     '''
     id = readInt("Please give an id: ")
     model = input("Please give a model: ")
     year = readInt("Please give a year: ")
     engine = input("Please give a engine: ")
     self.__car_serv.add_car_srv(id, model, year, engine)
 def __delete_client(self):
     '''
     Function that deletes a client
     :return:
     '''
     id = readInt("Please give the id: ")
     self.__cl_serv.del_cl_srv(id)
 def show_ui(self):
     '''
     Function that shows the user interface
     :return:
     '''
     self.__add_data()
     while True:
         self.__print_ui()
         cmd = readInt("Please give command: ")
         if cmd == 1:
             self.__add_car()
         elif cmd == 2:
             self.__add_client()
         elif cmd == 3:
             self.__delete_car()
         elif cmd == 4:
             self.__delete_client()
         elif cmd == 5:
             self.__find_car_id()
         elif cmd == 6:
             self.__find_client_id()
         elif cmd == 7:
             self.__list_cars()
         elif cmd == 8:
             self.__list_clients()
         elif cmd == 9:
             self.__add_rental()
         elif cmd == 10:
             self.__list_rentals()
         elif cmd == 11:
             self.__list_sorted_rentals()
         else:
             print("Sorry, invalid command!")
 def __add_rental(self):
     '''
     Function that adds a rental
     :return:
     '''
     id_car = readInt("Pleas give the car id: ")
     car = self.__car_serv.find_car_srv(id_car)
     if car is None:
         print("There is no car with this id!")
         pass
     id_cl = readInt("Please give the client id: ")
     cl = self.__cl_serv.find_cl_srv(id_cl)
     if cl is None:
         print("There is no client with this id! ")
         pass
     self.__rt_serv.add_rent_srv(id_car, id_cl)
 def __find_client_id(self):
     '''
     Function that finds a client by id
     :return:
     '''
     id = readInt("Please give the id: ")
     find_cl = self.__cl_serv.find_cl_srv(id)
     if find_cl is not None:
         print(find_cl)
 def __find_car_id(self):
     '''
     Function that finds a car by id
     :return:
     '''
     id = readInt("Please give the id: ")
     find_car = self.__car_serv.find_car_srv(id)
     if find_car is not None:
         print(find_car)
 def __add_client(self):
     '''
     Function that adds a client
     :return:
     '''
     id = readInt("Please give an id: ")
     name = input("Please give a name: ")
     addr = input("Please give an address: ")
     self.__cl_serv.add_cl_srv(id, name, addr)
Ejemplo n.º 8
0
def startUI():
    '''
    Function that starts the user interface menu
    Takes no argument
    Doesn't return anything
    '''
    while True:
        try:
            specfiyMenu = readInt(
                "Apasati 1 pentru Menu Based UI sau 2 pentru Command Based UI: "
            )
            if specfiyMenu == 1:
                menuBasedUI()
            elif specfiyMenu == 2:
                commandBasedUI()
            else:
                raise TypeError("NUMARUL INTRODUS POATE FI DOAR 1 SAU 2")
        except TypeError as msg:
            print(msg)
Ejemplo n.º 9
0
def menuBasedUI():
    '''
    control the menuBased UI
    :return:
    '''
    listOfApartments = initApartments()
    while True:
        printMenu()
        command = readInt("Selectati comanda dorita: ")
        if command == 1:
            printAddSubmenu()
            addCostControl(listOfApartments)
        elif command == 2:
            printDeleteSubmenu()
            deleteCostControl(listOfApartments)
        elif command == 3:
            printSearchSubmenu()
            searchingCostControl(listOfApartments)
        elif command == 4:
            printViewSubmenu()
            viewCostControl(listOfApartments)
        elif command == 5:
            exit()
Ejemplo n.º 10
0
def initApartments():
    numofApartments = readInt("Dati numarul de apartamente: ")
    listOfApartments = createNewList(numofApartments)
    return listOfApartments