public void Load() { DataConnector dataConnector = new DataConnector(); dataConnector.OpenConnection("mySql"); WorkflowDAO workflowDAO = new WorkflowDAO(dataConnector.MySqlConnection); ElementDAO elementDAO = new ElementDAO(dataConnector.MySqlConnection); RelationDAO relationDAO = new RelationDAO(dataConnector.MySqlConnection); dataConnector.CloseConnection(); }
public void Store() { DataConnector dataConnector = new DataConnector(); dataConnector.OpenConnection("mySql"); WorkflowDAO workflowDAO = new WorkflowDAO(dataConnector.MySqlConnection); ElementDAO elementDAO = new ElementDAO(dataConnector.MySqlConnection); RelationDAO relationDAO = new RelationDAO(dataConnector.MySqlConnection); WorkflowDTO workflowDTO = new WorkflowDTO(); workflowDTO.id = this.id; workflowDTO.name = this.name; if (this.startElement != null) { workflowDTO.startElement = this.startElement.id; } if (this.finishElement != null) { workflowDTO.finishElement = this.finishElement.id; } this.id = (int)workflowDAO.StoreWorkflow(workflowDTO); foreach (FlowElement element in elements) { ElementDTO elementDTO = new ElementDTO(); elementDTO.id = element.id; elementDTO.owner = this.id; elementDTO.name = element.name; elementDTO.enabled = element.enabled; elementDTO.elementType = element.elementType; elementDAO.StoreElement(elementDTO); } foreach (Relation relation in relations) { RelationDTO relationDTO = new RelationDTO(); relationDTO.origin = relation.origin.id; relationDTO.destinarion = relation.destination.id; relationDAO.StoreRelation(relationDTO); } dataConnector.CloseConnection(); }