Esempio n. 1
0
 public void Handle(ICommandContext context, UpdateUserNormDefaultConfigCommand command)
 {
     context.Get <UserNormDefaultConfig>(command.AggregateRootId).UpdateUserNormDefaultConfig(command.PlanCycle,
                                                                                              command.ForecastCount, command.UnitHistoryCount, command.HistoryCount, command.MinRightSeries, command.MaxRightSeries,
                                                                                              command.MinErrortSeries, command.MaxErrortSeries, command.LookupPeriodCount, command.ExpectMinScore,
                                                                                              command.ExpectMaxScore);
 }
Esempio n. 2
0
        public async Task <string> GetUserNormDefaultConfig(UserNormDefaultConfigInput input)
        {
            var validatorResult = await _userNormDefaultConfigInputValidator.ValidateAsync(input);

            if (!validatorResult.IsValid)
            {
                throw new LotteryDataException(validatorResult.Errors.Select(p => p.ErrorMessage + "</br>").ToString(";"));
            }
            var userNormConfig =
                _userNormDefaultConfigService.GetUserNormConfig(_lotterySession.UserId, LotteryInfo.Id);

            if (userNormConfig == null)
            {
                var command = new AddUserNormDefaultConfigCommand(Guid.NewGuid().ToString(), _lotterySession.UserId, LotteryInfo.Id, input.PlanCycle, input.ForecastCount, input.UnitHistoryCount, input.HistoryCount,
                                                                  input.MinRightSeries, input.MaxRightSeries, input.MinErrorSeries, input.MaxErrorSeries, input.LookupPeriodCount, input.ExpectMinScore, input.ExpectMaxScore);
                await SendCommandAsync(command);
            }
            else
            {
                var command = new UpdateUserNormDefaultConfigCommand(userNormConfig.Id, input.PlanCycle, input.ForecastCount, input.UnitHistoryCount, input.HistoryCount,
                                                                     input.MinRightSeries, input.MaxRightSeries, input.MinErrorSeries, input.MaxErrorSeries, input.LookupPeriodCount, input.ExpectMinScore, input.ExpectMaxScore);
                await SendCommandAsync(command);
            }
            return("设置默认的公式指标成功");
        }