Ejemplo n.º 1
0
        public CashAccountTransaction
        (
            CashTransactionType transactionType,
            CashAccountId cashAcctID,
            CashAcctTransactionDate transactionDate,
            CashAcctTransactionAmount transactionAmount,
            ExternalAgentId agentId,
            EconomicEventId eventId,
            CheckNumber checkNumber,
            string remittanceAdvice,
            UserId userID
        )
            : this()
        {
            CashTransactionType       = transactionType;
            CashAccountId             = cashAcctID ?? throw new ArgumentNullException("The cash account id is required.");
            CashAcctTransactionDate   = transactionDate ?? throw new ArgumentNullException("The cash transaction date is required.");
            CashAcctTransactionAmount = transactionAmount ?? throw new ArgumentNullException("The cash transaction amount is required.");
            AgentId          = agentId ?? throw new ArgumentNullException("The external agent id is required.");
            EventId          = eventId ?? throw new ArgumentNullException("The cash economic event id is required.");
            CheckNumber      = checkNumber ?? throw new ArgumentNullException("The check number is required.");
            RemittanceAdvice = remittanceAdvice;
            UserId           = userID ?? throw new ArgumentNullException("The user id is required.");

            CheckValidity();
        }
 public void Configure(EntityTypeBuilder <CashAccountTransaction> entity)
 {
     entity.ToTable("CashAccountTransactions", schema: "Finance");
     entity.HasKey(e => e.Id);
     entity.Property(p => p.Id).HasColumnType("INT").HasColumnName("CashTransactionId");
     entity.Property(p => p.CashAccountId)
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("CashAccountId")
     .IsRequired();
     entity.Property(p => p.CashTransactionType)
     .HasColumnType("INT")
     .HasColumnName("CashTransactionTypeId")
     .IsRequired();
     entity.Property(p => p.CashAcctTransactionDate)
     .HasConversion(p => p.Value, p => CashAcctTransactionDate.Create(p))
     .HasColumnType("datetime2(0)")
     .HasColumnName("CashAcctTransactionDate")
     .IsRequired();
     entity.Property(p => p.CashAcctTransactionAmount)
     .HasConversion(p => p.Value, p => CashAcctTransactionAmount.Create(p))
     .HasColumnType("DECIMAL(18,2)")
     .HasColumnName("CashAcctTransactionAmount")
     .IsRequired();
     entity.Property(p => p.AgentId)
     .HasConversion(p => p.Value, p => ExternalAgentId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("AgentId")
     .IsRequired();
     entity.Property(p => p.EventId)
     .HasConversion(p => p.Value, p => EconomicEventId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("EventId")
     .IsRequired();
     entity.Property(p => p.CheckNumber)
     .HasConversion(p => p.Value, p => CheckNumber.Create(p))
     .HasColumnType("NVARCHAR(25)")
     .HasColumnName("CheckNumber")
     .IsRequired();
     entity.Property(p => p.RemittanceAdvice)
     .HasColumnType("NVARCHAR(50)")
     .HasColumnName("RemittanceAdvice");
     entity.Property(p => p.UserId)
     .HasConversion(p => p.Value, p => UserId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("UserId")
     .IsRequired();
     entity.Property(e => e.CreatedDate)
     .HasColumnType("datetime2(7)")
     .ValueGeneratedOnAdd()
     .HasDefaultValueSql("sysdatetime()");
     entity.Property(e => e.LastModifiedDate).HasColumnType("datetime2(7)");
 }
        public async Task ShouldInsert_CashTransaction_UsingCashAccountAggregate()
        {
            CashAccount account = await _cashAcctRepo.GetByIdAsync(new Guid("6a7ed605-c02c-4ec8-89c4-eac6306c885e"));

            CashAccountTransaction transaction = new CashAccountTransaction
                                                 (
                CashTransactionType.CashDisbursementLoanPayment,
                CashAccountId.Create(account.Id),
                CashAcctTransactionDate.Create(new DateTime(2021, 11, 7)),
                CashAcctTransactionAmount.Create(4363.82M),
                ExternalAgentId.Create(new Guid("12998229-7ede-4834-825a-0c55bde75695")),
                EconomicEventId.Create(new Guid("cf4279a1-da26-4d10-bff0-cf6e0933661c")),
                CheckNumber.Create("12214554"),
                "12M877",
                UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744"))
                                                 );

            account.AddCashAccountTransaction(transaction);
            _cashAcctRepo.Update(account);
            await _unitOfWork.Commit();
        }
Ejemplo n.º 4
0
 public void UpdateExternalAgentId(ExternalAgentId agentId)
 {
     AgentId = agentId ?? throw new ArgumentNullException("The external agent id is required.");
     UpdateLastModifiedDate();
     CheckValidity();
 }