Esempio n. 1
0
 def save(self, db: DBManager):
     if self._id:
         order = db.get_order(self._id)
         order.is_current = self.is_current
         order.product_id = self.product_id
         order.quantity = self.quantity
         db.save_element(order)
     else:
         db.save_element(self.get_order())
Esempio n. 2
0
 def change_status(db: DBManager, order_id, order_status):
     """
     change status of order
     :param db:
     :param order_id:
     :param order_status:
     :return:
     """
     order: OrderInfo = db.get_order_info(order_id=order_id)
     order.status = order_status
     db.save_element(order)
Esempio n. 3
0
 def dialog_store_save(self, db: DBManager):
     """
     save info about store from dialog to database
     :return:
     """
     store = Store()
     store.title = self._dialog.store['title']
     store.address = self._dialog.store['address']
     store.longitude = self._dialog.store['longitude']
     store.latitude = self._dialog.store['latitude']
     store.price_km = self._dialog.store['price']
     db.save_element(store)
Esempio n. 4
0
 def save(self, db: DBManager):
     if self._id:
         order = db.get_order_info(self._id)
         order.is_current = self._current
         order.client_id = self._client
         order.delivery_cost = self._delivery_cost
         order.order_date = self._date
         order.status = self._status
         order.store_id = self._store
         db.save_element(order)
     else:
         self._date = datetime.now()
         order = self._get_order_info()
         self._id = db.save_element(order)
     return order