private List <Order> _GetAssignedOrders( ICollection <Route> routes) { List <Order> orders = new List <Order>(); foreach (Route route in routes) { orders.AddRange(SolveHelper.GetAssignedOrders(route)); } return(orders); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// private SolveRequestData _BuildRequestData() { List <Route> routes = new List <Route>(); List <Order> orders = new List <Order>(); // get unlocked routes from RoutesToSequence and all orders // assigned to converting routes foreach (Route route in _inputParams.RoutesToSequence) { if (route.Schedule.Equals(Schedule)) { if (!route.IsLocked) { routes.Add(route); orders.AddRange(SolveHelper.GetAssignedOrders(route)); } } else { // route does not have corresponding route results that // belongs to schedule throw new RouteException(String.Format( Properties.Messages.Error_InvalidRouteToSequence, route.Id)); } } // check if we have unlocked routes if (routes.Count == 0) { throw new RouteException(Properties.Messages.Error_InvalidRoutesToSequenceCount); } // get barriers planned on schedule's date ICollection <Barrier> barriers = SolverContext.Project.Barriers.Search( (DateTime)Schedule.PlannedDate); SolveRequestData reqData = new SolveRequestData(); reqData.Routes = routes; reqData.Orders = orders; reqData.Barriers = barriers; return(reqData); }