def subscribeCustomer(self, customer: Customer, plan: ExercisePlan,
                             dailyStart: int, dailyEnd: int, reservationDate: datetime) -> bool:
     if not self.checkAvailability(plan, dailyStart, dailyEnd):
         return False
     plan.getTrainer().assignToCustomer(dailyStart, dailyEnd)
     for item in plan.getPlanItems():
         item.getEquipment().reserveEquipment(dailyStart, dailyEnd)
     subscription = Subscription(len(customer.getSubscribtions()), plan, reservationDate, dailyStart, dailyEnd)
     customer.subscribe(subscription)
     plan.getTrainer().addSubscribtion(subscription)
Beispiel #2
0
from Models import Session, Customer, Goods
Session1 = Session()
customer1 = Customer(id = 118, customername = 'Kiborg', firstName = 'Andriy', lastName = 'Levitskiy', email = '*****@*****.**', password = '******', phone = '+380504658342')
customer2 = Customer(id = 128, customername = 'Lider', firstName = 'Bob', lastName = 'Vey', email = '*****@*****.**', password = '******', phone = '+380504658342')

goods1 = Goods(id = 111, name = "Watch", price = 2750, status = 3)
goods2 = Goods(id = 122, name = "Phone", price = 27000, status = 2)

Session1.add(customer1)
Session1.add(customer2)
Session1.add(goods1)
Session1.add(goods2)

Session1.commit()
Session1.close()
Beispiel #3
0
 def cancelSubscribtion(self, customer: Customer,
                        subscription: Subscription):
     subscription.clearSubscription()
     customer.cancelSubscribtion(subscription)
 def createCustomer(self, name: str) -> Customer:
     customer = Customer(len(self.__customers), name)
     self.__customers.append(customer)
     return customer
Beispiel #5
0
 def deleteCustomer(self, customer: Customer):
     for sub in customer.getSubscribtions():
         sub.clearSubscription()
     self.__customers.remove(customer)