Beispiel #1
0
        public void Handle(ICommandContext context, StartTransfer command)
        {
            var sourceAccount = context.Get <BankAccount>(command.TransferInfo.SourceAccountId);
            var targetAccount = context.Get <BankAccount>(command.TransferInfo.TargetAccountId);

            context.Add(new TransferProcess(sourceAccount, targetAccount, command.TransferInfo));
        }
 public void Handle(ICommandContext context, CreateNoteCommand command)
 {
     _lockService.ExecuteInLock(typeof(Note).Name, () =>
     {
         context.Add(new Note(command.AggregateRootId, command.Title));
     });
 }
Beispiel #3
0
        public void Handle(ICommandContext context, CreateUserCommand command)
        {
            _lockService.ExecuteInLock(typeof(UserMobileIndex).Name, () =>
            {
                User parent = null;
                if (command.ParentId != Guid.Empty)
                {
                    parent = context.Get <User>(command.ParentId);
                }
                //创建user 领域对象
                var user = new User(command.AggregateRootId, parent, new UserInfo(
                                        command.Mobile,
                                        command.NickName,
                                        command.Portrait,
                                        command.Gender,
                                        command.Region,
                                        command.Password,
                                        command.WeixinId,
                                        command.UnionId));

                //验证Mobile 的唯一性
                _registerUserMobileService.RegisterMobile(command.Id, user.Id, command.Mobile);
                //将领域对象添加到上下文中
                context.Add(user);
            });
        }
Beispiel #4
0
        public void Handle(ICommandContext context, CreateOrderGoodsCommand command)
        {
            var orderGoods = new OrderGoods(
                command.AggregateRootId,
                command.OrderId,
                new OrderGoodsInfo(
                    command.OrderGoods.GoodsId,
                    command.OrderGoods.SpecificationId,
                    command.OrderGoods.WalletId,
                    command.OrderGoods.StoreOwnerWalletId,
                    command.OrderGoods.GoodsName,
                    command.OrderGoods.GoodsPic,
                    command.OrderGoods.SpecificationName,
                    command.OrderGoods.Price,
                    command.OrderGoods.OrigianlPrice,
                    command.OrderGoods.Quantity,
                    command.OrderGoods.Total,
                    command.OrderGoods.StoreTotal,
                    DateTime.Now.Add(ConfigSettings.OrderGoodsServiceAutoExpiration),
                    command.OrderGoods.Benevolence)
                );

            //添加到上下文
            context.Add(orderGoods);
        }
Beispiel #5
0
 public void Handle(ICommandContext context, PredictDataCommand command)
 {
     context.Add(new LotteryPredictData(command.AggregateRootId, command.NormConfigId, command.CurrentPredictPeriod,
                                        command.StartPeriod, command.EndPeriod, command.MinorCycle, command.PredictedData, command.PredictedResult,
                                        command.CurrentScore, command.CreateBy, command.PredictTable, command.LotteryCode,
                                        command.IsSwitchFormula));
 }
Beispiel #6
0
        /// <summary>创建WebApp
        /// </summary>
        public void Handle(ICommandContext context, CreateWebApp command)
        {
            var info = new WebAppInfo(command.AppKey, command.AppName, command.Url, command.PutAccountUrl, command.VerifyTicketUrl,
                                      command.NotifyUrl);
            var webApp = new WebApp(command.AggregateRootId, info);

            context.Add(webApp);
        }
Beispiel #7
0
 public void Handle(ICommandContext context, AddNormConfigCommand command)
 {
     context.Add(new NormConfig(command.AggregateRootId,
                                command.UserId, command.LotteryId, command.PlanId, command.LastStartPeriod,
                                command.PlanCycle, command.ForecastCount, command.UnitHistoryCount, command.HistoryCount,
                                command.MinRightSeries, command.MaxRightSeries, command.MinErrorSeries,
                                command.MaxErrorSeries, command.LookupPeriodCount, command.ExpectMinScore, command.ExpectMaxScore, command.Sort, command.CustomNumbers));
 }
 public void Handle(ICommandContext context, CreateTestAggregateCommand command)
 {
     if (command.SleepMilliseconds > 0)
     {
         Thread.Sleep(command.SleepMilliseconds);
     }
     context.Add(new TestAggregate(command.AggregateRootId, command.Title));
 }
        public async Task HandleAsync(ICommandContext context, CreateSeatAssignments command)
        {
            var order = await context.GetAsync <Order>(command.AggregateRootId);

            OrderSeatAssignments orderSeatAssignments = order.CreateSeatAssignments();

            context.Add(orderSeatAssignments);
        }
Beispiel #10
0
 public void Handle(ICommandContext context, RegisterNewAccountCommand command)
 {
     _lockService.ExecuteInLock(typeof(Account).Name, () =>
     {
         _registerAccountService.RegisterAccount(command.AggregateRootId, command.Name);
         context.Add(new Account(command.AggregateRootId, command.Name, command.Password));
     });
 }
Beispiel #11
0
 public void Handle(ICommandContext context, GrabOrderCommand command)
 {
     _lockService.ExecuteInLock(typeof(GrabOrder).Name, () =>
     {
         GrabOrderLockService.OrderGrabValidate(command.OrderId);
         context.Add(new GrabOrder(command.AggregateRootId, command.OrderId, command.OperSoufunId, command.OperSoufunName, command.OwnerSoufunId));
     });
 }
Beispiel #12
0
 public void Handle(ICommandContext context, PlaceOrder command)
 {
     context.Add(new Order(
                     command.AggregateRootId,
                     command.ConferenceId,
                     command.Seats.Select(x => new SeatQuantity(new SeatType(x.SeatType, x.SeatName, x.UnitPrice), x.Quantity)),
                     _pricingService));
 }
Beispiel #13
0
        public void Handle(ICommandContext context, RegisterUser command)
        {
            var user = new UserRegisterService(_uniqueService, context.CommandId)
                       .Register(command.LoginId, command.Password, command.UserName, command.Email);

            context.Add(user);

            //Console.WriteLine("添加一个用户");
        }
 public Task HandleAsync(ICommandContext context, RegisterNewAccountCommand command)
 {
     return(Task.Factory.StartNew(() => _lockService.ExecuteInLock(typeof(Account).Name, () =>
     {
         var account = new Account(command.AggregateRootId, command.Name, command.Password);
         _registerAccountService.RegisterAccount(account);
         context.Add(account);
     })));
 }
        public void Handle(ICommandContext context, CreateBenevolenceIndexCommand command)
        {
            var benevolenceIndex = new BenevolenceIndex(
                command.AggregateRootId,
                command.BenevolenceIndex,
                command.BenevolenceAmount);

            context.Add(benevolenceIndex);
        }
Beispiel #16
0
 public Task HandleAsync(ICommandContext context, CreateTestAggregateCommand command)
 {
     if (command.SleepMilliseconds > 0)
     {
         Thread.Sleep(command.SleepMilliseconds);
     }
     context.Add(new TestAggregate(command.AggregateRootId, command.Title));
     return(Task.CompletedTask);
 }
Beispiel #17
0
 public void Handle(ICommandContext context, RegisterNewAccountCommand command)
 {
     _lockService.ExecuteInLock(typeof(Account).Name, () =>
     {
         var account = _factory.CreateAccount(command.Name, command.Password);
         _registerAccountIndexService.RegisterAccountIndex(command.Id, account.Id, command.Name);
         context.Add(account);
     });
 }
 public void Handle(ICommandContext context, CreatePayment command)
 {
     context.Add(new Payment(
                     command.AggregateRootId,
                     command.OrderId,
                     command.ConferenceId,
                     command.Description,
                     command.TotalAmount,
                     command.Lines.Select(x => new PaymentItem(x.Description, x.Amount)).ToList()));
 }
Beispiel #19
0
 /// <summary>注册账号
 /// </summary>
 public void Handle(ICommandContext context, RegisterAccount command)
 {
     _lockService.ExecuteInLock(typeof(Account).Name, () =>
     {
         var info    = new AccountInfo(command.Code, command.AccountName, command.Password);
         var account = new Account(command.AggregateRootId, info);
         _accountService.RegisterAccountIndex(command.AggregateRootId, command.Code, command.AccountName);
         context.Add(account);
     });
 }
Beispiel #20
0
        public void Handle(ICommandContext context, UpdateNextDayFirstPeriodCommand command)
        {
            var aggreagate = context.Get <LotteryFinalData>(command.AggregateRootId);

            if (aggreagate == null)
            {
                context.Add(new LotteryFinalData(command.AggregateRootId, command.LotteryId, command.TodayFirstPeriod));
            }
            context.Get <LotteryFinalData>(command.AggregateRootId).UpdateFirstPeriod(command.TodayFirstPeriod, command.LotteryId);
        }
        public void Handle(ICommandContext context, CreateReplyCommand command)
        {
            Reply parent = null;

            if (!string.IsNullOrEmpty(command.ParentId))
            {
                parent = context.Get <Reply>(command.ParentId);
            }
            context.Add(new Reply(command.AggregateRootId, command.PostId, parent, command.AuthorId, command.Body));
        }
Beispiel #22
0
        /// <summary>创建账号
        /// </summary>
        public void Handle(ICommandContext context, CreateAccount command)
        {
            var info = new AccountInfo(
                command.AccountName,
                command.AccountPassword,
                command.AccountType,
                command.ReMark);

            context.Add(new Account(command.AggregateRootId, info));
        }
Beispiel #23
0
        public void Handle(ICommandContext context, CompleteDynamicTableCommand command)
        {
            var aggreagate = context.Get <LotteryInfo>(command.AggregateRootId);

            if (aggreagate == null)
            {
                context.Add(new LotteryInfo(command.AggregateRootId));
            }
            context.Get <LotteryInfo>(command.AggregateRootId).CompleteDynamicTable(command.IsComplteDynamicTable);
        }
Beispiel #24
0
 /// <summary>创建用户
 /// </summary>
 public void Handle(ICommandContext context, CreateUser command)
 {
     _lockService.ExecuteInLock(typeof(User).Name, () =>
     {
         _appSystemService.CheckExist(command.AppSystemId);
         _userService.RegisterUserCodeIndex(command.AggregateRootId, command.Code);
         var info = new UserInfo(command.Code, command.AppSystemId, command.UserName, command.ReMark);
         context.Add(new User(command.AggregateRootId, info));
     });
 }
Beispiel #25
0
        public async Task HandleAsync(ICommandContext context, RegisterNewAccountCommand command)
        {
            var account = new Account(command.AggregateRootId, command.Name, command.Password);
            await _lockService.ExecuteInLock(typeof(Account).Name, () =>
            {
                return(_registerAccountService.RegisterAccount(account));
            });

            context.Add(account);
        }
 public void Handle(ICommandContext context, CreatePartnerCommand command)
 {
     context.Add(new Partner(
                     command.AggregateRootId,
                     command.UserId,
                     command.WalletId,
                     command.Region,
                     command.Province,
                     command.City,
                     command.Province,
                     command.Level));
 }
        public void Handle(ICommandContext context, CreateThirdCurrencyCommand command)
        {
            var thirdCurrency = new ThirdCurrency(command.AggregateRootId, new ThirdCurrencyInfo(
                                                      command.Name,
                                                      command.Icon,
                                                      command.ComponyName,
                                                      command.Conversion,
                                                      command.IsLocked,
                                                      command.Remark
                                                      ));

            context.Add(thirdCurrency);
        }
Beispiel #28
0
        public void Handle(ICommandContext context, CreateGranteeCommand command)
        {
            var grantee = new Grantee(GuidUtil.NewSequentialId(), command.Publisher, new GranteeInfo(
                                          command.Section,
                                          command.Title,
                                          command.Description,
                                          command.Max,
                                          command.Days,
                                          DateTime.Now.AddDays(command.Days),
                                          command.Pics
                                          ));

            context.Add(grantee);
        }
Beispiel #29
0
        public void Handle(ICommandContext context, CreateGoodsBlockWarpCommand command)
        {
            var goodsBlockWarp = new GoodsBlockWarp(
                command.AggregateRootId,
                new GoodsBlockWarpInfo(
                    command.Name,
                    command.Style,
                    command.GoodsBlocks,
                    command.IsShow,
                    command.Sort));

            //将领域对象添加到上下文中
            context.Add(goodsBlockWarp);
        }
Beispiel #30
0
 /// <summary>创建角色
 /// </summary>
 public void Handle(ICommandContext context, CreateRole command)
 {
     _lockService.ExecuteInLock(typeof(Role).Name, () =>
     {
         _appSystemService.CheckExist(command.AppSystemId);
         var info = new RoleInfo(
             command.Code,
             command.AppSystemId,
             command.Name,
             command.RoleType,
             command.ReMark);
         context.Add(new Role(command.AggregateRootId, info, command.IsEnabled));
     });
 }