protected override async Task Handle(NotifyAreaExitCommand request, CancellationToken cancellationToken) { var now = DateTime.UtcNow; var profile = await repository.GetProfileAsync(request.ProfileId, request.DeviceId, cancellationToken); if (profile == null) { throw new DomainException("Profile not found."); } if (!profile.ActiveQuarantine(DateTime.UtcNow)) { throw new DomainException("Profile is not in quarantine."); } var exit = new AreaExit(profile.Id, request.Severity, timeConvertService.UnixTimeStampToDateTime(request.RecordTimestamp)); profile.AddAreaExit(exit); var check = new PresenceCheck(profile.Id, now, now, PresenceCheckStatus.LEFT); check.SetSeverity(exit.Severity); profile.AddPresenceCheck(check); await repository.UnitOfWork.SaveChangesAsync(cancellationToken); }
public void UseObject() { if (gameObject.GetComponent <AreaExit> () != null) { AreaExit areaexit = gameObject.GetComponent <AreaExit> (); areaexit.Transition(); InteractionDescription = areaexit.exit; Debug.Log("Areahase exit"); } else if (gameObject.GetComponent <ElevatorExit> () != null) { ElevatorExit elevatorexit = gameObject.GetComponent <ElevatorExit> (); elevatorexit.UseElevator(); InteractionDescription = elevatorexit.ElevatorDescription; Debug.Log("Area has elevator"); } }
protected override async Task Handle(NotifyAreaExitCommand request, CancellationToken cancellationToken) { var profile = await repository.GetProfileAsync(request.ProfileId, request.DeviceId, cancellationToken); if (profile == null) { throw new DomainException("Profile not found."); } if (!profile.IsInQuarantine) { throw new DomainException("Profile is not in quarantine."); } var exit = new AreaExit(request.Latitude, request.Longitude, request.Accuracy, timeConvertService.UnixTimeStampToDateTime(request.RecordTimestamp)); profile.AddAreaExit(exit); await repository.UnitOfWork.SaveChangesAsync(cancellationToken); }