def insert_order(self, order): try: order = Input.input_update_order(order) assert Check.isExistAllOptionOrder(order), \ '\033[91m you don\'t add all needed order\'s option \033[0m' check = self.model.create_order(order['itemId'], order['shopId'], order['customerId'], order['date']) if check: self.view.display_stored("", self.model.tableName) except Exception as err: print(err)
def update_order(self, order): orderId = Input.input_id(self.model.tableName) order = Input.input_update_order(order) older = self.model.read_order(orderId) newOrder = Check.updateOrder(order, [ older[0].OrderId, older[0].CustomerId, older[0].ItemId, older[0].ShopId, older[0].OrderDate ]) print(newOrder) check = self.model.update_order(orderId, newOrder['itemId'], newOrder['shopId'], newOrder['customerId'], newOrder['date'])
def update_order(self, order): orderId = Input.input_id(self.model.tableName) order = Input.input_update_order(order) older = self.model.read_order(orderId) newOrder = Check.updateOrder(order, older) check = self.model.update_order(orderId, newOrder['itemId'], newOrder['shopId'], newOrder['customerId'], newOrder['date']) if check: self.view.display_order_updated(orderId, older, order['itemId'], order['shopId'], newOrder['customerId'], newOrder['date'])