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); }
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)); } }
internal DeveloperAddedEvent(IAcSession acSession, DeveloperId source, bool isPrivate) : this(acSession, source) { this.IsPrivate = isPrivate; }
public DeveloperAddedEvent(IAcSession acSession, DeveloperId source) : base(acSession, source) { }
internal DeveloperRemovedEvent(IAcSession acSession, DeveloperId source, bool isPrivate) : this(acSession, source) { this.IsPrivate = isPrivate; }
public DeveloperRemovedEvent(IAcSession acSession, DeveloperId source) : base(acSession, source) { }
public Task<bool> SaveRejectionAsync(DeveloperId id) { return _developerSaveRejection.Run(id); }
public Task<bool> SaveAcceptenceAsync(DeveloperId id) { return _developerSaveAcceptanceDoer.Run(id); }
public Task<Developer> GetByIdAsync(DeveloperId id) { return _developerGetByIdDoer.Run(id); }
get => _departuresClient ?? (_departuresClient = new DeparturesClient(DeveloperId, DeveloperKey));