public void update() { //storage STORAGE storage = new STORAGE(); storage.ID_BOARD = mindmap.board.id; storage.NAME_S = STORAGEcontroller.getNameStorage(storage.ID_BOARD); storage.DATE_MODIFIED = DateTime.Now; //board BOARD board = new BOARD(); board.ID = storage.ID_BOARD; board.WIDTH = mindmap.board.picbox.Width; board.HEIGHT = mindmap.board.picbox.Height; board.COLOR = HexConverter(mindmap.board.picbox.BackColor); //node TOPICcontroller.removeNode(convertNodeToTopic(board, mindmap.listDelete)); mindmap.listDelete.Clear(); List <TOPIC> existTopics = new List <TOPIC>() { }; existTopics = TOPICcontroller.getListTopic(board.ID); List <TOPIC> updateTopics = new List <TOPIC>(); List <TOPIC> newTopics = new List <TOPIC>(); newTopics = convertNodeToTopic(board, this.listNode); foreach (TOPIC topic in newTopics.ToList()) { foreach (TOPIC etopic in existTopics.ToList()) { if (topic.ID == etopic.ID) { updateTopics.Add(topic); newTopics.Remove(topic); } } } TOPICcontroller.updateListTopic(updateTopics); TOPICcontroller.addListTopic(newTopics, board.ID); BOARDcontroller.updateBoard(board); if (STORAGEcontroller.updateStorage(storage)) { MessageBox.Show("saved successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void saveListNode(BOARD board) { TOPICcontroller.addListTopic(convertNodeToTopic(board, this.listNode)); }