def save_main_settings(main_settings_data): db = DB(DatabaseHelper.database_name, DataMapping()) old_main_settings_data = DatabaseHelper.get_main_settings_data() if old_main_settings_data is not None: main_settings_data.id = old_main_settings_data.id db.save_table_object(main_settings_data) db.execute_SQL("DELETE FROM NodeToControlNumberData") for nodeToControl in main_settings_data.NodeToControlNumberMapping: db.save_table_object(nodeToControl) return DatabaseHelper.get_main_settings_data()
def save_main_settings(main_settings_data): db = DB(DatabaseHelper.database_name, DataMapping()) old_main_settings_data = DatabaseHelper.get_main_settings_data() if old_main_settings_data is not None: main_settings_data.id = old_main_settings_data.id db.save_table_object(main_settings_data) db.execute_SQL("DELETE FROM NodeToControlNumberData") for nodeToControl in main_settings_data.NodeToControlNumberMapping: db.save_table_object(nodeToControl) return DatabaseHelper.get_main_settings_data()
def save_radio_settings(radio_settings_data): db = DB(DatabaseHelper.database_name, DataMapping()) print("save radio settings") saved_radio_settings_data = db.save_table_object(radio_settings_data) print("save radio settings 2") db.execute_SQL("DELETE FROM InboundRadioNodeData WHERE RadioSettingsId = " + str(saved_radio_settings_data.id)) for node in radio_settings_data.InboundRadioNodes: node.id = None node.RadioSettingsId = saved_radio_settings_data.id db.save_table_object(node) return DatabaseHelper.get_radio_settings_data(saved_radio_settings_data.id)
def save_radio_settings(radio_settings_data): db = DB(DatabaseHelper.database_name, DataMapping()) print("save radio settings") saved_radio_settings_data = db.save_table_object(radio_settings_data) print("save radio settings 2") db.execute_SQL( "DELETE FROM InboundRadioNodeData WHERE RadioSettingsId = " + str(saved_radio_settings_data.id)) for node in radio_settings_data.InboundRadioNodes: node.id = None node.RadioSettingsId = saved_radio_settings_data.id db.save_table_object(node) return DatabaseHelper.get_radio_settings_data( saved_radio_settings_data.id)
def remove_all_punches(): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL("DELETE FROM PunchData") db.execute_SQL("DELETE FROM RadioMessageData")
def set_no_station_number_found(punchDataId): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL( "UPDATE PunchData SET stationNumberNotFound = 1 WHERE id=" + str(punchDataId))
def set_punch_sent_to_meos(punchDataId): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL("UPDATE PunchData SET sentToMeos = 1 WHERE id=" + str(punchDataId))
def set_punch_sent_to_meos(punchDataId): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL("UPDATE PunchData SET sentToMeos = 1 WHERE id=" + str(punchDataId))
def remove_all_punches(): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL("DELETE FROM PunchData") db.execute_SQL("DELETE FROM RadioMessageData")
def set_no_station_number_found(punchDataId): db = DB(DatabaseHelper.database_name, DataMapping()) db.execute_SQL("UPDATE PunchData SET stationNumberNotFound = 1 WHERE id=" + str(punchDataId))