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_message(radioMessageData): db = DB(DatabaseHelper.database_name, DataMapping()) rm = db.save_table_object(radioMessageData) print(radioMessageData.dataRecordArray) if radioMessageData.dataRecordArray is not None: for rec in radioMessageData.dataRecordArray: rec.radioMessageId = rm.id if rm.messageType == PUNCH: rec.origFromNode = rm.fromNode db.save_table_object(rec) return DatabaseHelper.get_radio_message(rm.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 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_channel(channel): db = DB(DatabaseHelper.database_name, DataMapping()) db.save_table_object(channel)