示例#1
0
 def update_item(self, item):
     itemId = Input.input_id(self.model.tableName)
     item = Input.input_update_item(item)
     older = self.model.read_item(itemId)
     item = Check.updateItem(item, older)
     check = self.model.update_item(itemId, item['name'], item['price'],
                                    item['quantity'], item['color'],
                                    item['material'], item['description'])
     if check:
         self.view.display_item_updated(itemId, older, item['name'],
                                        item['price'], item['quantity'],
                                        item['color'], item['material'],
                                        item['description'])
示例#2
0
 def insert_item(self, items):
     try:
         items = Input.input_update_item(items)
         description = None
         assert Check.isExistAllOptionItem(
             items
         ), '\033[91m you don\'t add all needed item\'s option \033[0m '
         if 'description' in items:
             description = items['description']
         check = self.model.create_item(items['name'], items['price'],
                                        items['quantity'], items['color'],
                                        items['material'], description)
         if check:
             self.view.display_stored('name', self.model.tableName)
     except Exception as err:
         print(err)