示例#1
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));
     });
 }
示例#2
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);
     });
 }
示例#3
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));
     });
 }
示例#4
0
 public void Handle(ICommandContext context, CreateNoteCommand command)
 {
     _lockService.ExecuteInLock(typeof(Note).Name, () =>
     {
         context.Add(new Note(command.AggregateRootId, command.Title));
     });
 }
示例#5
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);
            });
        }
示例#6
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));
     });
 }
示例#7
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));
     });
 }
示例#8
0
 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);
     })));
 }
示例#9
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);
     });
 }
示例#10
0
 /// <summary>创建权限
 /// </summary>
 public void Handle(ICommandContext context, CreatePermission command)
 {
     _lockService.ExecuteInLock(typeof(Permission).Name, () =>
     {
         _appSystemService.CheckExist(command.AppSystemId);
         _permissionService.Exist(command.ParentPermission);
         var info = new PermissionInfo(
             command.AppSystemId,
             command.Code,
             command.Name,
             command.PermissionType,
             command.ParentPermission,
             command.PermissionUrl,
             command.Sort,
             command.Describe,
             command.ReMark);
         context.Add(new Permission(command.AggregateRootId, info, command.IsVisible));
     });
 }
示例#11
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);
        }
示例#12
0
 /// <summary>创建模块
 /// </summary>
 public void Handle(ICommandContext context, CreateModule command)
 {
     _lockService.ExecuteInLock(typeof(Module).Name, () =>
     {
         _moduleService.Exist(command.ParentModule);
         _appSystemService.CheckExist(command.AppSystemId);
         var info = new ModuleInfo(
             command.AppSystemId,
             command.Code,
             command.Name,
             command.ModuleType,
             command.ParentModule,
             command.LinkUrl,
             command.Sort,
             command.Describe,
             command.ReMark);
         context.Add(new Module(command.AggregateRootId, info, command.VerifyType, command.IsVisible));
     });
 }
示例#13
0
 /// <summary>创建应用系统
 /// </summary>
 public void Handle(ICommandContext context, CreateAppSystem command)
 {
     _lockService.ExecuteInLock(typeof(AppSystem).Name, () =>
     {
         _accountService.CheckExist(command.AccountId);
         var info = new AppSystemInfo(
             command.Code,
             command.Name,
             command.AccountId,
             command.ReMark);
         var appSystem = new AppSystem(
             command.AggregateRootId,
             info,
             command.SafeKey);
         context.Add(appSystem);
     });
 }
示例#14
0
 public Task HandleAsync(ICommandContext context, CreateConference command)
 {
     return(Task.Factory.StartNew(() => _lockService.ExecuteInLock(typeof(ConferenceSlugIndex).Name, () =>
     {
         var conference = new Conference(command.AggregateRootId, new ConferenceInfo(
                                             command.AccessCode,
                                             new ConferenceOwner(command.OwnerName, command.OwnerEmail),
                                             command.Slug,
                                             command.Name,
                                             command.Description,
                                             command.Location,
                                             command.Tagline,
                                             command.TwitterSearch,
                                             command.StartDate,
                                             command.EndDate));
         _registerConferenceSlugService.RegisterSlug(command.Id, conference.Id, command.Slug);
         context.Add(conference);
     })));
 }