public Account(Identifier acctId, DateTime dateOpened, KindsOfAccounts accountType, bool isOppositeForm) : base(dateOpened) { Id = acctId ?? throw new ArgumentNullException(nameof(acctId)); DueFrequency = null; FormOfCredit = null; IsOppositeForm = isOppositeForm; AccountType = accountType; }
public IAccount <Identifier> Add(string accountName, KindsOfAccounts accountType, bool isOppositeForm, int?refId = null, DateTime?atTime = null) { if (string.IsNullOrWhiteSpace(accountName)) { throw new ArgumentNullException(nameof(accountName)); } var existing = _dataStore.FirstOrDefault(a => a.Id.Equals(accountName)); if (existing != null) { ((AccountId)existing.Id).SetRefId(refId); return(existing); } var dt = atTime.GetValueOrDefault(DateTime.UtcNow); var acct = new Account(new AccountId(accountName, refId), dt, accountType, isOppositeForm) { Name = accountName }; _dataStore.Add(acct); return(acct); }