Beispiel #1
0
 protected TransactionItem(TransactionEntity transaction, string userId, Guid applicationId)
 {
     Id                     = Guid.NewGuid();
     ApplicationId          = applicationId;
     TransactionId          = transaction.Id;
     TransactionName        = transaction.Name;
     TransactionDescription = transaction.Description;
     OutgoingStatusId       = transaction.OutgoingStatusId;
     TransactionAt          = DateTime.UtcNow;
     UserId                 = userId;
 }
Beispiel #2
0
        public void ApplyTransaction(TransactionEntity transaction, string userId)
        {
            if (StatusId != null && transaction.IncomingStatusId != StatusId)
            {
                throw new AggregateIllegalLogicException("Wrong transaction. Check configuration.");
            }

            if (string.IsNullOrWhiteSpace(userId))
            {
                throw new AggregateValidationException("Invalid user id.");
            }

            TransactionItems.Add(TransactionItem.Create(transaction, userId.ToString(), Id));
            UpdatedAt = DateTime.UtcNow;
        }
Beispiel #3
0
 public static TransactionItem Create(TransactionEntity transaction, string userId, Guid applicationId) =>
 new TransactionItem(transaction, userId, applicationId);