Example #1
0
        // Updates work task id on newly digitized routenetwork-elements
        // that do not yet have a WorkTaskMrid
        private async Task UpdateWorkTaskIdOnNewlyDigitized(Guid workTaskMrId)
        {
            foreach (var command in _eventStore.Get())
            {
                foreach (var routeNetworkEvent in command.RouteNetworkEvents)
                {
                    switch (routeNetworkEvent)
                    {
                    case RouteNodeAdded routeNodeAdded:
                        var routeNodeSt = await _geoDatabase.GetRouteNodeShadowTable(routeNodeAdded.NodeId);

                        // If the id is empty, we update it to the current work task id.
                        if (routeNodeSt.WorkTaskMrid == Guid.Empty)
                        {
                            routeNodeSt.WorkTaskMrid = workTaskMrId;
                            await _geoDatabase.UpdateRouteNode(routeNodeSt);
                        }
                        break;

                    case RouteSegmentAdded routeSegmentAdded:
                        var routeSegmentSt = await _geoDatabase.GetRouteSegmentShadowTable(routeSegmentAdded.SegmentId);

                        // If the id is empty, we update it to the current work task id.
                        if (routeSegmentSt is not null && routeSegmentSt.WorkTaskMrid == Guid.Empty)
                        {
                            routeSegmentSt.WorkTaskMrid = workTaskMrId;
                            await _geoDatabase.UpdateRouteSegment(routeSegmentSt);
                        }
                        break;
                    }
                }
            }
        }
 public async Task Handle(RollbackInvalidRouteNode request, CancellationToken token)
 {
     _logger.LogWarning($"Rollbacks invalid {nameof(RouteNode)} with id: '{request.RollbackToNode.Mrid}'. {request.Message}");
     await _geoDatabase.UpdateRouteNode(request.RollbackToNode);
 }