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

            if (userId == Guid.Empty)
            {
                throw new AggregateValidationException("Invalid user id.");
            }

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