private AccountState(AccountSnapshot snapshot, IReadOnlyCollection <IDomainEvent> domainEvents)
        {
            Contract.Requires(snapshot != null);
            Contract.Requires(domainEvents != null);

            Redirect(snapshot);
            Redirect(domainEvents);
        }
Beispiel #2
0
 public CurrentUserProfileModel(AccountSnapshot account)
 {
     // this class will be extended if need should arise ...
     this.Roles    = account.AspNetUser.AspNetRoles.Select(x => x.Id).ToArray();
     this.Naming   = account.Person.PersonName;
     this.Id       = account.Person.Id;
     this.OfficeId = account.ProviderSnapShot?.GetCurrentOfficeId();
 }
Beispiel #3
0
        public async Task Create(decimal balance, int id)
        {
            var accountActor = this.cluster.GrainFactory.GetGrain <IAccount>(id);
            var dto          = new AccountSnapshot()
            {
                Balance = balance,
                Id      = id
            };
            await accountActor.Create(dto, Guid.NewGuid().ToString());

            var snapshot = await accountActor.Get();

            Assert.Equal(snapshot.Balance, dto.Balance);
        }
Beispiel #4
0
        public Account(AccountReference Ref)
        {
            m_Ref = Ref;
            //Used for file naming - filename safe characters only
            m_AccountCode = string.Format("{0}-{1}",
                                          Enum.GetName(typeof(Banks), Ref.Bank), Ref.AccountNumber);

            m_SnapshotFile = Path.Combine(App.LocalData, m_AccountCode + "-Snapshot.json");

            //Load the account settings
            m_SettingsFile = Path.Combine(App.LocalData, m_AccountCode + "-Settings.json");
            if (File.Exists(m_SettingsFile))
            {
                m_Settings = JSON.LoadParse <AccountSettings>(m_SettingsFile);
                m_RecurrenceIDGenerator = m_Settings.Recurrences.Max(r => r.ID);
            }
            else
            {
                m_Settings = new AccountSettings()
                {
                    Recurrences = new List <Recurrence>()
                };
                m_RecurrenceIDGenerator = 0;
            }

            //Load the snapshot
            if (File.Exists(m_SnapshotFile))
            {
                AccountSnapshot Snapshot = JSON.LoadParse <AccountSnapshot>(m_SnapshotFile);
                m_Statement             = Snapshot.Statement;
                m_StatementDownloadDate = Snapshot.When;
            }
            else
            {
                m_Statement             = new Xact[0];
                m_StatementDownloadDate = DateTime.Today;
            }
        }
 private void When(AccountSnapshot snapshot)
 {
     Balance = snapshot.Balance;
 }
        private AccountState(AccountSnapshot snapshot)
        {
            Contract.Requires(snapshot != null);

            Redirect(snapshot);
        }
 public void Revert(AccountSnapshot snapshot)
 {
     Amount = snapshot.Amount;
 }