Example #1
0
        public void TestAccountValid()
        {
            var account = new Account();

            Assert.AreNotEqual(null, account.Competnces);
            Assert.AreNotEqual(null, account.Name);
            Assert.AreNotEqual(null, account.Id);
            Assert.AreNotEqual(null, account.Password);
        }
Example #2
0
		public async Task<ActionResult> AddHandle(Account account)
		{
			var model = Service.Create(HttpContext.Items["StorageId"]);

			account.Guid = Guid.NewGuid();
			var result = await model.AccountManager.Create(account).ToTask();

			model.Release();
			return RedirectToAction("Index");
		}
Example #3
0
        Value<ACCOUNT_REQUEST_RESULT> IAccountManager.Create(Account account)
        {
            var result = _Find(account.Name);
            if(result != null)
            {
                return ACCOUNT_REQUEST_RESULT.REPEAT;
            }

            _Database.Add(account, obj => obj.Id);
            return ACCOUNT_REQUEST_RESULT.OK;
        }
Example #4
0
        private void _Attach(Account account)
        {
            _Binder.Bind<IStorageCompetences>(this);

            if(account.HasCompetnce(Account.COMPETENCE.ACCOUNT_FINDER))
            {
                _Binder.Bind<IAccountFinder>(_Storage);
                _Binder.Bind<IGameRecorder>(_Storage);
            }

            if(account.HasCompetnce(Account.COMPETENCE.ACCOUNT_MANAGER))
            {
                _Binder.Bind<IAccountManager>(_Storage);
            }

            _Binder.Bind<ITradeNotes>(_Storage);
            _Binder.Bind<IFormulaFarmRecorder>(_Storage);
            _Binder.Bind<IFormulaPlayerRecorder>(_Storage);
        }
Example #5
0
 public StroageAccess(ISoulBinder binder, Account account, IStorage storage)
 {
     _Binder = binder;
     _Account = account;
     _Storage = storage;
 }
Example #6
0
 private void _ToVerify()
 {
     _Account = null;
     var verify = new Verify(_ExpansionFeature.AccountFinder);
     var stage = new Storage.Verify(_Binder, verify);
     stage.DoneEvent += _VerifySuccess;
     _Machine.Push(stage);
 }
Example #7
0
 private void _VerifySuccess(Account account)
 {
     if(account.IsFormulaQueryer())
     {
         _Account = account;
         _OnVerifySuccessEvent(_Account.Guid);
         _ToFishStage();
     }
     else
     {
         _ToVerify();
     }
 }
Example #8
0
 Value<ACCOUNT_REQUEST_RESULT> IAccountManager.Create(Account account)
 {
     _Accounts.Add(account);
     return ACCOUNT_REQUEST_RESULT.OK;
 }
Example #9
0
        Value<ACCOUNT_REQUEST_RESULT> IAccountManager.Update(Account account)
        {
            if(_Accounts.RemoveAll(a => a.Id == account.Id) > 0)
            {
                _Accounts.Add(account);
                return ACCOUNT_REQUEST_RESULT.OK;
            }

            return ACCOUNT_REQUEST_RESULT.NOTFOUND;
        }
Example #10
0
		private void _GetAccounts(Account[] obj)
		{
			_Accounts = obj;
		}
Example #11
0
 private void _VerifySuccess(Account account)
 {
     _VerifySuccessEvent(account.Guid);
     _Account = account;
     _ToQueryRecord();
 }
Example #12
0
        private void _HandleGuest()
        {
            _Logger.Info().Message("_HandleGuest From DB Start.").Write();

            var accounts = _Find("Guest");

            _Logger.Info().Message("_HandleGuest From DB Finish.").Write();

            if (accounts == null)
            {
                var account = new Account
                {
                    Guid = Guid.NewGuid(),
                    Name = "Guest",
                    Password = "vgame",
                    Competnces = new Flag<Account.COMPETENCE>(Account.COMPETENCE.FORMULA_QUERYER)
                };

                _Database.Add(account, obj => obj.Id);
            }
        }
Example #13
0
 private Verify _CreateVerify()
 {
     _Account = null;
     var verify = new Verify(_AccountFinder);
     return verify;
 }
Example #14
0
        private void _HandleAdministrator()
        {
            _Logger.Info().Message("_HandleAdministrator From DB Start.").Write();

            var accounts = _Find(_DefaultAdministratorName);

            _Logger.Info().Message("_HandleAdministrator From DB Finish.").Write();

            if (accounts == null)
            {
                var account = new Account
                {
                    Guid = Guid.NewGuid(),
                    Name = _DefaultAdministratorName,
                    Password = "vgame",
                    Competnces = Account.AllCompetnce()
                };

                _Database.Add(account, obj => obj.Id);

                _Database.Add(new TradeNotes
                {
                    Owner = account.Guid
                }, obj => obj.Id);
            }
        }
Example #15
0
        Value<ACCOUNT_REQUEST_RESULT> IAccountManager.Update(Account account)
        {
            if(_Database.Update(account, a => a.Id))
            {
                return ACCOUNT_REQUEST_RESULT.OK;
            }

            return ACCOUNT_REQUEST_RESULT.NOTFOUND;
        }
Example #16
0
 private void _ToRelease(Account account)
 {
     var stage = new StroageAccess(_Binder, account, _Storage);
     stage.OnDoneEvent += _ToVerify;
     _Machine.Push(stage);
 }
Example #17
0
 private FishHunter.Verify _CreateVerify()
 {
     _Account = null;
     var verify = new FishHunter.Verify(_Storage);
     return verify;
 }
Example #18
0
 private void _VerifySuccess(Account account)
 {
     _VerifySuccessEvent(account.Guid);
     _Account = account;
     _ToRelease(account);
 }