protected virtual async Task<bool> VerifyDomainAccountWriteAccess(Guid domainId, SettingsFactory settingsFactory, Settings settings, IDomainService domainService) { AccountDomain domain = await GetDomain( domainId, settingsFactory, settings, GetAccessToken(), domainService ); return !domain.Account.Locked && VerifyDomainAccount(domain); }
public async Task <AccountDomain?> Register( string correlationToken, AccountDomain account, CancellationToken token) { var entityEntry = await _accountsContext .Accounts .AddAsync( account, token); return(entityEntry.Entity); }
private static void GoldLifted(WealthTrackerEventArgs e) { // sanity if (e == null || e.item == null || e.from == null || e.from.NetState == null) { return; } // eliminate tracking of all but approved scenarios if (ScenarioFilter(e) == false) { return; } NetState state = e.from.NetState; int iphc = state.ToString().GetHashCode(); // hash code of IP address IPDomain ipd = null; AccountDomain ad = null; if (m_IPList.Contains(iphc)) // if we have it already { ipd = m_IPList[iphc] as IPDomain; // get the IPDomain at this IP address if (ipd.accountList.Contains(e.from.Account) == false) // if we don't have an account domain, create it { ipd.accountList.Add(e.from.Account, new AccountDomain()); } ad = ipd.accountList[e.from.Account] as AccountDomain; // get the account domain } else { m_IPList[iphc] = new IPDomain(); // start a new list of clients at this IP address ipd = m_IPList[iphc] as IPDomain; // get the IPDomain at this IP address ipd.accountList.Add(e.from.Account, new AccountDomain()); // add another client at this IP + location ad = ipd.accountList[e.from.Account] as AccountDomain; // get the account domain } // update domain information if (ad != null && ipd != null) { ad.mobileList[e.from.Serial] = e.from; // record mobile (not sure what the key should be) ad.gold += e.item.Amount; // update gold for this IPDomain ad.lastTick = DateTime.Now; // last gold pickup ad.location = e.from.Location; // last gold pickup location ipd.gold += e.item.Amount; // update gold for this IPDomain ipd.lastTick = DateTime.Now; // last gold pickup ipd.location = e.from.Location; // last gold pickup location } }
public async Task <IActionResult> GetAccountDomain([FromRoute] Guid?id) { IActionResult result = null; try { if (result == null && !id.HasValue || id.Value.Equals(Guid.Empty)) { result = BadRequest("Missing domain id value"); } if (result == null) { using ILifetimeScope scope = _container.BeginLifetimeScope(); SettingsFactory settingsFactory = scope.Resolve <SettingsFactory>(); CoreSettings settings = settingsFactory.CreateAccount(_settings.Value); IDomainFactory domainFactory = scope.Resolve <IDomainFactory>(); IDomain innerDomain = await domainFactory.Get(settings, id.Value); if (innerDomain != null && !UserCanAccessAccount(innerDomain.AccountId)) { innerDomain = null; } if (innerDomain == null) { result = NotFound(); } else { IMapper mapper = MapperConfigurationFactory.CreateMapper(); AccountDomain accountDomain = mapper.Map <AccountDomain>(innerDomain); IAccountFactory accountFactory = scope.Resolve <IAccountFactory>(); accountDomain.Account = mapper.Map <Account>(await accountFactory.Get(settings, innerDomain.AccountId)); result = Ok(accountDomain); } } } catch (Exception ex) { using (ILifetimeScope scope = _container.BeginLifetimeScope()) { await LogException(ex, scope.Resolve <IExceptionService>(), scope.Resolve <SettingsFactory>(), _settings.Value); } result = StatusCode(StatusCodes.Status500InternalServerError); } return(result); }
public JsonResult <object> AddAccount(AccountRequest request) { var baseInfo = GetBaseInfo(); if (request == null) { return(JsonError("请求数据错误")); } if (_accountService.Exist(request.NickName)) { return(JsonError("昵称已经存在")); } AccountDomain domain = request.ToDomainModel(); domain.CreateTime = DateTime.Now; _accountService.NewCreate(domain); return(JsonNet("添加成功")); }
public static AccountInfrastr AccountFromDomainToInfra(this AccountDomain @this) { if (@this != null) { return(new AccountInfrastr() { AccountId = @this.AccountId, AccountNumber = @this.AccountNumber, AccountBalance = @this.AccountBalance, ClientClientId = @this.ClientClientId //,ClientOfAccount = @this.ClientOfAccount.ClientFromDomainToInfra() }); } else { return(null); } }
public UserDomain(AccountDomain accountDomain, CoreRepository coreRepository) { this.accountDomain = accountDomain; this.coreRepository = coreRepository; }
public LoginController() { _accountDomain = new AccountDomain(); }
public void Update(AccountDomain inst) { accountRepository.UpdateAcc(inst.AccountFromDomainToInfra()); }
public AccountController() { _accountDomain = new AccountDomain(); }
public AccountController(AccountDomain domain) { this.domain = domain; }
public ITSupporterController() { _ITSupporterDomain = new ITSupporterDomain(); _accountDomain = new AccountDomain(); _deviceDomain = new DeviceDomain(); }
/// <summary> /// 增 - 直接添加 /// </summary> /// <param name="domain"></param> public void NewCreate(AccountDomain domain) { DataProvider.Create(domain.ToDbModel()); }
public static Account ToDbModel(this AccountDomain model) { return(Mapper.Map <Account>(model)); }