public async Task <Developer> Run(DeveloperId id)
        {
            using var connection = new SQLiteConnection
                                       (_geekLemonContext.ConnectionString);

            var q = @$ "SELECT Id,UniqueId,Name,Status FROM Developers
                    WHERE Id = @Id";

            try
            {
                var r = await connection.
                        QueryFirstOrDefaultAsync <DevloperTemp>
                            (q, new
                {
                    @Id = id.Value,
                });

                var rmaped = _mapper.Map <Developer>(r);

                return(rmaped);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public async Task <bool> Run(DeveloperId id)
        {
            using var connection = new SQLiteConnection
                                       (_geekLemonContext.ConnectionString);

            var q = @"UPDATE Developers
                SET Status = @Status
                WHERE Id = @Id;";

            try
            {
                var result = await connection.ExecuteAsync(q,
                                                           new
                {
                    @Id     = id.Value.ToString(),
                    @Status = (int)DeveloperStatus.Accepted
                });
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
ファイル: SysUserSet.cs プロジェクト: zszqwe/anycmd
            private void Handle(IAcSession acSession, Guid accountId, bool isCommand)
            {
                var         acDomain              = _set._acDomain;
                var         devAccountById        = _set._devAccountById;
                var         devAccountByLoginName = _set._devAccountByLoginName;
                var         accountRepository     = acDomain.RetrieveRequiredService <IRepository <Account> >();
                var         developerRepository   = acDomain.RetrieveRequiredService <IRepository <DeveloperId> >();
                DeveloperId entity;

                lock (Locker)
                {
                    var account = accountRepository.GetByKey(accountId);
                    if (account == null)
                    {
                        throw new ValidationException("账户不存在");
                    }
                    if (devAccountById.ContainsKey(accountId))
                    {
                        throw new ValidationException("给定标识标识的开发人员已经存在" + accountId);
                    }
                    entity = new DeveloperId
                    {
                        Id = accountId
                    };
                    try
                    {
                        var accountState = AccountState.Create(account);
                        devAccountById.Add(accountId, accountState);
                        devAccountByLoginName.Add(account.LoginName, accountState);
                        if (isCommand)
                        {
                            developerRepository.Add(entity);
                            developerRepository.Context.Commit();
                        }
                    }
                    catch
                    {
                        devAccountById.Remove(accountId);
                        devAccountByLoginName.Remove(account.LoginName);
                        developerRepository.Context.Rollback();
                        throw;
                    }
                }
                if (isCommand)
                {
                    acDomain.MessageDispatcher.DispatchMessage(new DeveloperAddedEvent(acSession, entity, isPrivate: true));
                }
            }
コード例 #4
0
ファイル: DeveloperAddedEvent.cs プロジェクト: zszqwe/anycmd
 internal DeveloperAddedEvent(IAcSession acSession, DeveloperId source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
コード例 #5
0
ファイル: DeveloperAddedEvent.cs プロジェクト: zszqwe/anycmd
 public DeveloperAddedEvent(IAcSession acSession, DeveloperId source) : base(acSession, source)
 {
 }
コード例 #6
0
 internal DeveloperRemovedEvent(IAcSession acSession, DeveloperId source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
コード例 #7
0
 public DeveloperRemovedEvent(IAcSession acSession, DeveloperId source) : base(acSession, source) { }
コード例 #8
0
 public Task<bool> SaveRejectionAsync(DeveloperId id)
 {
     return _developerSaveRejection.Run(id);
 }
コード例 #9
0
 public Task<bool> SaveAcceptenceAsync(DeveloperId id)
 {
     return _developerSaveAcceptanceDoer.Run(id);
 }
コード例 #10
0
 public Task<Developer> GetByIdAsync(DeveloperId id)
 {
     return _developerGetByIdDoer.Run(id);
 }
コード例 #11
0
 get => _departuresClient ?? (_departuresClient = new DeparturesClient(DeveloperId, DeveloperKey));