Esempio n. 1
0
 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);
        }
Esempio n. 3
0
        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
            }
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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("添加成功"));
        }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 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();
 }
Esempio n. 11
0
 public AccountController(AccountDomain domain)
 {
     this.domain = domain;
 }
Esempio n. 12
0
 public ITSupporterController()
 {
     _ITSupporterDomain = new ITSupporterDomain();
     _accountDomain     = new AccountDomain();
     _deviceDomain      = new DeviceDomain();
 }
Esempio n. 13
0
 /// <summary>
 /// 增 - 直接添加
 /// </summary>
 /// <param name="domain"></param>
 public void NewCreate(AccountDomain domain)
 {
     DataProvider.Create(domain.ToDbModel());
 }
Esempio n. 14
0
 public static Account ToDbModel(this AccountDomain model)
 {
     return(Mapper.Map <Account>(model));
 }