/// <summary> /// Save the current loaded route. /// </summary> internal bool RouteSave() { try { if (!this.MapViewToEntity()) { return(false); } // Save the route Route.Save(this.Route); foreach (RouteElement routeElement in this.Route.Elements) { // TODO: This secuence should be implemented inside the ORM layer RouteElement.Save(routeElement); } // Add the route into the project if (!OTCContext.Project.Routes.Contains(this.Route)) { OTCContext.Project.Routes.Add(this.Route); } this.HasChanges = false; return(true); } catch (Exception ex) { MessageBox.Show(Logger.LogError(this, ex), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void SaveCurrentRoute() { // Save the route Route.Save(this.Route); foreach (RouteElement routeElement in this.Route.Elements) { if (routeElement.Element != null) { RouteElement.Save(routeElement); } else { RouteElement.Delete(routeElement); // unused route element } } // Add the route into the project if (!OTCContext.Project.Routes.Contains(this.Route)) { OTCContext.Project.Routes.Add(this.Route); } this.HasChanges = false; }