Beispiel #1
0
 def search(self, key):
     if key not in self._listRented:
         raise RepoError("filmul nu este inchiriat!\n")
     
     for x in self._listRented:
         if x == key:
             return x
Beispiel #2
0
 def get_all_movies_same_title(self, key):
     list_same_title = []
     for x in self._listMovies:
         if x.same_title(key):
             list_same_title.append(x)
             
     if len(list_same_title) == 0:
         raise RepoError("Nu exista acest titlu")
     else :
         return list_same_title
Beispiel #3
0
 def get_all_customers_same_name(self, key):
     list_same_name = []
     
     for x in self._listCustomers:
         if x.same_name(key):
             list_same_name.append(x)
             
     if len(list_same_name) == 0 :
         raise  RepoError("Nu exista acest nume")
     else:
         return list_same_name        
Beispiel #4
0
 def get_all_movies_same_status(self, key):
     list_same_status = []
     
     for x in self._listMovies:
         if x.same_status(key):
             list_same_status.append(x)
             
     if len(list_same_status) == 0:
         raise RepoError("Nu exista acest status")
     else :
         return list_same_status
Beispiel #5
0
    def add_rental(self, mid, cid, start_date, return_date):

        rental = Rental(mid, cid, start_date, return_date)

        customer = Customer(cid, None, None, None)

        movie = Movie(mid, None, None, None)

        self.__repoCustomer.search(customer)
        movie_found = self.__repoMovie.search(movie)
        if movie_found.get_status() == "rented":
            raise RepoError("film deja inchiriat!\n")

        else:
            self.__validRented.validate_rental(rental)
            self.__repoRented.add(rental)
Beispiel #6
0
 def add(self, cust):
     if cust in self._listCustomers:
         raise RepoError("id existent!\n")
     
     self._listCustomers.append(cust)
Beispiel #7
0
 def add(self, movie):
     if movie in self._listMovies:
         raise RepoError("id existent!\n")
     
     self._listMovies.append(movie)
Beispiel #8
0
 def search(self, key):
     if key not in self._listCustomers:
         raise RepoError("id inexistent!\n")
     for x in self._listCustomers:
         if x == key:
             return x
Beispiel #9
0
 def add(self, rental):
     if rental in self._listRented:
         raise RepoError("film deja inchiriat!\n")
     
     self._listRented.append(rental)