예제 #1
0
class Service(object):

    dbao = None

    def __init__(self):
        self.dbao = DBAO()

    def updateControl(self, water, heating, pump):
        return self.dbao.updateControl(water, heating, pump)

    def getControl(self):
        return self.dbao.selectControl()

    def deleteBoost(self):
        return self.dbao.deleteBoost()

    def updateHeater(self, heater):
        if heater.getRecordEnabled() == -1:
            return self.dbao.deleteDB(heater)
        elif heater.getID() == -1:
            return self.dbao.insertDB(heater)
        else:
            return self.dbao.updateDB(heater)

    def close(self):
        self.dbao.close()

    def getAllHeater(self):

        response = []

        for item in self.dbao.selectDB():
            response.append({
                'id': item.getID(),
                'day_no': item.getDay(),
                'heater_type': item.getHeaterType(),
                'water_used': item.getWaterUsed(),
                'heater_used': item.getHeatingUsed(),
                'time_start': item.getTimeStart(),
                'time_end': item.getTimeEnd(),
                'boost_used': item.getBoostUsed(),
                'record_enabled': item.getRecordEnabled()
            })

        return response
예제 #2
0
class Service(object):
	
	dbao = None
	#arrayTV = []

	def __init__(self):
		self.dbao = DBAO()
		self.dbao.createDB()
		
	def addNewShow(self, name, season, episode):
		return self.dbao.insertDB(name, season, episode)

	def updateShow(self,name, season, episode):
		return self.dbao.updateDB(name, season, episode)
		
	def haltShow(self, name):
		return self.dbao.updateDBAvail(name,0)
	
	def continueShow(self, name):
		return self.dbao.updateDBAvail(name, 1)
	
	def close(self):
		self.dbao.close()
		
	def getAllShows(self):
		
		response = []
		
		for item in self.dbao.selectDB():
			response.append({'Name': item.getName(), 'Season' : item.getSeason(), 'Episode' : item.getEpisode(), 'Avail':item.getAvail() })
						
		return json.dumps(response)
		
		
	def returnShows(self):
		return self.dbao.selectDB();
예제 #3
0
class Service(object):
	
	dbao = None

	def __init__(self):
		self.dbao = DBAO()
		
	def updateControl(self, water, heating, pump):
		return self.dbao.updateControl(water, heating, pump)
		
	def getControl(self):
		return self.dbao.selectControl()
	
	def deleteBoost(self):
		return self.dbao.deleteBoost()
		
	def updateHeater(self, heater ):
		if heater.getRecordEnabled() == -1:
			return self.dbao.deleteDB(heater)
		elif heater.getID() == -1:
			return self.dbao.insertDB(heater)
		else:
			return self.dbao.updateDB(heater)
		
	def close(self):
		self.dbao.close()
		
	def getAllHeater(self):
		
		response = []
		
		for item in self.dbao.selectDB():
			response.append({'id': item.getID(), 'day_no' : item.getDay(), 'heater_type' : item.getHeaterType(), 'water_used':item.getWaterUsed() ,  'heater_used': item.getHeatingUsed(),'time_start':item.getTimeStart() , 'time_end':item.getTimeEnd(),
			 'boost_used':item.getBoostUsed(), 'record_enabled':item.getRecordEnabled() })
						
		return response
			
			
			
예제 #4
0
 def __init__(self):
     self.dbao = DBAO()
예제 #5
0
	def __init__(self):
		self.dbao = DBAO()
		self.dbao.createDB()
예제 #6
0
	def __init__(self):
		self.dbao = DBAO()