def updateRequestApprovalStatus(requestID, approval): if (requestID != None and approval != None): result = db.update("update access_request set IsApproved = {} where Id = {}".format(approval, requestID)) if result is True and approval == '1': requestObject = db.query("SELECT roomID, UserId from access_request where id = {}".format(requestID)) result = requestObject[0] id = db.insert("insert into access_rights(RoomId, UserId) values({}, {})".format(result['roomID'], result['UserId'])) return result else: return False
def UpdateChatId(self,ChatId): db.update("update users set ChatId = {} where Id = {}" .format(int(ChatId),self.Id))
def UpdateLastLogin(self): LastLogin = time.strftime('%Y-%m-%d %H:%M:%S') db.update("update users set LastLogin = '******' where Id = {}" .format(LastLogin,self.Id))
def addCardId(cardID, userID): if (cardID != None): id = db.update("update users set cardId = '{}' where Id = {}".format(cardID, userID)) return id return None
def TryUpdateDb(self): return db.update( "update access_logs set Exit_time = '{}' where Id = {}".format( self.ExitTime, self.Id))
def TryUpdateDb(self): return db.update( "update access_rights set roomId = {}, userId = {} where Id = {}". format(self.RoomId, self.UserId, self.Id))
def TryUpdateDb(self): return db.update( "update rooms set RoomName = '{}', IotDeviceName = '{}', IoTLightDevice = '{}' where Id = {}" .format(self.RoomName, self.IotDeviceName, self.IoTLightDevice, self.Id))