Пример #1
0
        private void BuildMovementService(MoveArea moveArea)
        {
            var shape = ShapeFactory <int> .Create(moveArea.Shape);

            var validHeight   = int.TryParse(moveArea.Dimension.Height, out int height);
            var validWidth    = int.TryParse(moveArea.Dimension.Width, out int width);
            var validMoveStep = int.TryParse(moveArea.MoveStep, out int moveStep);

            if (!validHeight || !validWidth || !validMoveStep || height == 0 || width == 0 || moveStep == 0)
            {
                throw new ArgumentException("Invalid dimension for the move area");
            }

            shape.Height = height;
            shape.Width  = width;


            _service = new MovementService <int, int>
                       (
                new Robo <int, int>(shape)
            {
                Step = moveStep
            }
                       );
        }
Пример #2
0
    public static async Task <IResult> Move([FromBody] string key, IMovementService movementService, IBeanService beanService, IOptions <AppSettings> settings)
    {
        List <string> messages = new();

        if (key != settings.Value.ApiKey)
        {
            return(Results.BadRequest(new ApiError(Strings.NotAuthorized)));
        }
        var beanids = await beanService.BeanIdsAsync();

        foreach (var beanid in beanids)
        {
            var result = await movementService.MoveAsync(beanid, settings.Value.MinimumValue, DateTime.UtcNow);

            if (!result.Successful)
            {
                messages.Add(result.ErrorMessage());
            }
        }
        if (messages.Any())
        {
            return(Results.BadRequest(new ApiError(messages.ToArray())));
        }
        return(Results.Ok());
    }
Пример #3
0
 public MovementController()
 {
     _productService      = new ProductServiceSQL();
     _movementService     = new MovementServiceSQL();
     _movementTypeService = new MovementTypeServiceSQL();
     _warehouseService    = new WarehouseServiceSQL();
 }
Пример #4
0
 public AccountService(IAccountRepository accountRepository, IMovementService movementService,
                       ISharedService sharedService)
 {
     _accountRepository = accountRepository;
     _movementService   = movementService;
     _sharedService     = sharedService;
 }
 public CubeController(int numberOfMoves, IMovementService movementService, ISoundService soundService, ISmokeService smokeService)
 {
     _numberOfMoves   = numberOfMoves;
     _movementService = movementService;
     _soundService    = soundService;
     _smokeService    = smokeService;
 }
Пример #6
0
 public AiAgent(IComponentService componentService, IProductionManager productionManager, IMovementService movementService, InfanteryMindStateService infanteryMindStateService, IHeatMapService heatMapService)
 {
     ComponentService = componentService;
     ProductionManager = productionManager;
     MovementService = movementService;
     InfanteryMindStateService = infanteryMindStateService;
     HeatMapService = heatMapService;
 }
Пример #7
0
 public MovementsController(IClientService clientService, IProductsService productsService, IProductTypeService productTypeService, IMovementService movementService, IMovementTypeService movementTypeService)
 {
     _clientService       = clientService;
     _productsService     = productsService;
     _productTypeService  = productTypeService;
     _movementService     = movementService;
     _movementTypeService = movementTypeService;
 }
Пример #8
0
 public Builder(IMovementService _movementService, IGridService _gridService, IDrawingService _drawingService)
 {
     gridService     = _gridService;
     movementService = _movementService;
     drawingService  = _drawingService;
     gridService.SetNewGrid();
     mainGrid = gridService.mainGrid;
     drawingService.PrintTable(mainGrid);
 }
 public ValidateMaxDistanceAllowedSubscriber(
     IGeneralSettings generalSettings,
     IMovementService movementService,
     ILogger <ValidateMaxDistanceAllowedSubscriber> logger)
 {
     this.generalSettings = generalSettings;
     this.movementService = movementService;
     this.logger          = logger;
 }
Пример #10
0
    public static async Task <IResult> ForBean(int beanid, IMovementService movementService)
    {
        if (beanid <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "movement id"))));
        }
        var movements = await movementService.GetForBeanAsync(beanid);

        return(Results.Ok(movements));
    }
 public SendDeliveryCommandHandler(
     IMovementService movementService,
     IRepository <Delivery> deliveryRepository,
     IPublisher publisher,
     ILogger <SendDeliveryCommandHandler> logger)
 {
     this.movementService    = movementService;
     this.deliveryRepository = deliveryRepository;
     this.publisher          = publisher;
     this.logger             = logger;
 }
Пример #12
0
 public static async Task <IResult> Sigma(int beanid, int days, IMovementService movementService)
 {
     if (beanid <= 0)
     {
         return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "bean id"))));
     }
     if (days <= 0)
     {
         return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "number of days"))));
     }
     return(Results.Ok(await movementService.GetStandardDeviationAsync(beanid, days)));
 }
Пример #13
0
    public static async Task <IResult> MostRecent(int beanid, IMovementService movementService)
    {
        if (beanid <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "bean id"))));
        }
        var movement = await movementService.MostRecentAsync(beanid);

        return(movement is null
      ? Results.BadRequest(new ApiError(string.Format(Strings.ItemNotFound, "bean", "id", beanid)))
      : Results.Ok(movement));
    }
Пример #14
0
 //TODO: Refactor this
 public MessageParser(IMovementService movementService, IMessageService messageService, IFlightDataValidation flightDataValidation,
                      IFlightService flightService,
                      IContainerService containerService, IParserMovementUtility parserMovementUtility, IParserCPMUtility parserCPMUtility)
 {
     this.movementService       = movementService;
     this.messageService        = messageService;
     this.flightDataValidation  = flightDataValidation;
     this.flightService         = flightService;
     this.containerService      = containerService;
     this.parserMovementUtility = parserMovementUtility;
     this.parserCPMUtility      = parserCPMUtility;
 }
Пример #15
0
    public static async Task <IResult> HistoryById(int beanid, int days, IMovementService movementService)
    {
        if (beanid <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "bean id"))));
        }

        var                            date      = days == 0 ? default : DateTime.UtcNow.AddDays(-(days - 1));
                                   var movements = await movementService.HistoryAsync(beanid, date);

                                   return(Results.Ok(movements));
    }
Пример #16
0
 public UserService(IUserRepository userRepository,
                    IAccountRepository accountRepository,
                    IMovementService movementService,
                    IMapper mapper,
                    IUserValidation validation)
 {
     _mapper            = mapper;
     _validation        = validation;
     _userRepository    = userRepository;
     _accountRepository = accountRepository;
     _movementService   = movementService;
 }
Пример #17
0
 public MovementHandler(IAdjustmentRepository adjustmentRepository,
                        IOutputRepository outputRepository,
                        IPurchaseRepository purchaseRepository,
                        IMovementRepository movementRepository,
                        IMovementService movementService)
 {
     _adjustmentRepository = adjustmentRepository;
     _outputRepository     = outputRepository;
     _purchaseRepository   = purchaseRepository;
     _movementRepository   = movementRepository;
     _movementService      = movementService;
 }
Пример #18
0
        public MovementServiceTests()
        {
            _tripInformerService = Substitute.For <ITripInformerService>();
            var drivers = new List <Type>()
            {
                typeof(Pilot),
                typeof(Policeman),
                typeof(FlightServiceChief)
            };

            _movementService = new MovementService(drivers, _tripInformerService);
        }
Пример #19
0
        void Start()
        {
            _movementService = Registration.Resolve <IMovementService>();
            var soundService = Registration.Resolve <ISoundService>();
            var smokeService = Registration.Resolve <ISmokeService>();

            _cubeController = new CubeController(NumberOfMoves, _movementService, soundService, smokeService)
            {
                Menu = Menu
            };

            _cubeController.DisableMenu();
        }
Пример #20
0
    public static async Task <IResult> ById(int movementid, IMovementService movementService)
    {
        if (movementid <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "movement id"))));
        }
        var movement = await movementService.ReadAsync(movementid);

        if (movement is null)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.ItemNotFound, "movement", "id", movementid))));
        }
        return(Results.Ok(movement));
    }
Пример #21
0
    public static async Task <IResult> Top(int beanid, int count, IMovementService movementService)
    {
        if (beanid <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "bean id"))));
        }
        if (count <= 0)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "movement count"))));
        }
        var movements = await movementService.TopForBeanAsync(beanid, count);

        return(Results.Ok(movements));
    }
Пример #22
0
        public DefaultCharacterService(IRepository <ICharacter> repository,
                                       IMovementService movementService, ICharacterAttributeRowService attributeRowService,
                                       IMoveService moveService, IUniqueDataService uniqueDataService, IGameParameterParserService gameParameterParserService)
            : base(repository, gameParameterParserService)
        {
            Guard.VerifyObjectNotNull(attributeRowService, nameof(attributeRowService));
            Guard.VerifyObjectNotNull(moveService, nameof(moveService));
            Guard.VerifyObjectNotNull(movementService, nameof(movementService));
            Guard.VerifyObjectNotNull(uniqueDataService, nameof(uniqueDataService));

            _attributeRowService = attributeRowService;
            _moveService         = moveService;
            _movementService     = movementService;
            _uniqueDataService   = uniqueDataService;
        }
Пример #23
0
 public SportListController(ISportListService sportListService,
                            ISportDayService sportDayService,
                            IAreaService areaService,
                            IMovementService movementService,
                            SessionHelper sessionHelper,
                            IUserService userService,
                            IUserSportListsService userSportListsService)
 {
     _sportListService      = sportListService;
     _sportDayService       = sportDayService;
     _areaService           = areaService;
     _movementService       = movementService;
     _sessionHelper         = sessionHelper;
     _userService           = userService;
     _userSportListsService = userSportListsService;
 }
Пример #24
0
        public TripService(ITripInformerService tripInformerService, IMovementService movementService)
        {
            _currentPlace = Terminal.CreateWithSmartFortwo(new List <CrewMember>
            {
                new Pilot("Soler"),
                new Officer("Coleta"),
                new Officer("Ivan"),
                new FlightServiceChief("Kelvin"),
                new FlightAttendant("Pâmela"),
                new FlightAttendant("Guerreiro"),
                new Policeman("Tyler"),
                new Prisoner("Mahnke")
            });
            _destinyPlace = new Airplane();

            _tripInformerService = tripInformerService;
            _movementService     = movementService;
        }
Пример #25
0
    public static async Task <IResult> HistoryByName(string beanname, int days, IMovementService movementService, IBeanService beanService)
    {
        if (string.IsNullOrWhiteSpace(beanname))
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.Invalid, "bean name"))));
        }
        var bean = await beanService.ReadAsync(beanname);

        if (bean is null)
        {
            return(Results.BadRequest(new ApiError(string.Format(Strings.ItemNotFound, "bean", "name", beanname))));
        }

        var                            date      = days == 0 ? default : DateTime.UtcNow.AddDays(-(days - 1));
                                   var movements = await movementService.HistoryAsync(bean.Id, date);

                                   return(Results.Ok(movements));
    }
Пример #26
0
        public HuntingViewModel(Guid scavengerId)
        {
            _isHunting        = false;
            _movementService  = DependencyService.Get <IMovementService>();
            _directionService = DependencyService.Get <IDirectionService>();
            _scavengerService = DependencyService.Get <IScavengerService>();
            _soundService     = DependencyService.Get <ISoundService>();
            _scavengerClient  = DependencyService.Get <IScavengerClient>();

            _directionService.OnDirectionChanged    += _directionService_OnDirectionChanged;
            _movementService.CurrentPositionChanged += _movementService_CurrentPointChanged;
            _scavengerClient.OnEggFound             += Client_OnEggFound;
            _scavengerId = scavengerId;

            _scavengerService.OnConnected    += ScavengerService_OnConnected;
            _scavengerService.OnDisconnected += ScavengerService_OnDisconnected;
            //var locationService = DependencyService.Get<ILocationService>();
            //locationService.LocationChanged += _locationService_LocationChanged;
        }
 public OperationTypeFamilyService(
     IOperationTypeFamilyRepository operationTypeFamilyRepository,
     ISelectService selectService,
     IMovementService movementService,
     IMapper mapper,
     IHostingEnvironment hostingEnvironment,
     IContextTransaction contextTransaction,
     IMailService mailService
     //IOperationTypeService operationTypeService
     )
 {
     _operationTypeFamilyRepository = operationTypeFamilyRepository;
     _selectService      = selectService;
     _mapper             = mapper;
     _movementService    = movementService;
     _hostingEnvironment = hostingEnvironment;
     _contextTransaction = contextTransaction;
     _mailService        = mailService;
     //_operationTypeService = operationTypeService;
 }
Пример #28
0
 public ReferentialService(
     IBankFileDefinitionService bankFileDefinitionService,
     IOperationMethodService operationMethodService,
     IOperationDetailService operationDetailService,
     IOperationTypeService operationTypeService,
     IOperationTransverseService operationTransverseService,
     IAccountService accountService,
     IOperationService operationService,
     IOperationTypeFamilyService operationTypeFamilyService,
     IMovementService movementService
     )
 {
     BankFileDefinitionService  = bankFileDefinitionService;
     OperationMethodService     = operationMethodService;
     OperationDetailService     = operationDetailService;
     OperationTypeService       = operationTypeService;
     OperationTransverseService = operationTransverseService;
     AccountService             = accountService;
     OperationService           = operationService;
     OperationTypeFamilyService = operationTypeFamilyService;
     MovementService            = movementService;
 }
Пример #29
0
        public void SeedCharacterData(WebCharacter character,
                                      ICharacterService characterService,
                                      IMovementService movementService,
                                      IMoveService moveService,
                                      ICharacterAttributeRowService characterAttributeRowService,
                                      IUniqueDataService uniqueDataService)
        {
            Guard.VerifyObjectNotNull(character, nameof(character));
            Guard.VerifyObjectNotNull(characterService, nameof(characterService));
            Guard.VerifyObjectNotNull(movementService, nameof(movementService));
            Guard.VerifyObjectNotNull(moveService, nameof(moveService));
            Guard.VerifyObjectNotNull(characterAttributeRowService, nameof(characterAttributeRowService));
            Guard.VerifyObjectNotNull(uniqueDataService, nameof(uniqueDataService));

            _characterDataScraper.PopulateCharacterFromWeb(character);

            var entityCharacter = Mapper.Map <Character>(character);

            characterService.Add(entityCharacter);
            movementService.AddMany(character.Movements);
            moveService.AddMany(character.Moves);
            characterAttributeRowService.AddMany(character.AttributeRows);
            uniqueDataService.AddMany(character.UniqueProperties);
        }
Пример #30
0
 public InternalController(IOptions <AppSettings> settings, IMovementService movementService, IBeanService beanService)
 {
     _movementService = movementService;
     _beanService     = beanService;
     _settings        = settings.Value;
 }
 private void FactoryService()
 => _movementService = new MovementService(_movementRepositoryMock.Object);