public Guid Add(AccountTransaction accountTransaction)
        {
                    
            ValidationResultInfo vri = Validate(accountTransaction);
            if (!vri.IsValid)
            {
                throw new DomainValidationException(vri, "Failed To Validate AccountTransaction");
            }
            tblAccountTransaction tblAccTr  =_ctx.tblAccountTransaction.FirstOrDefault(n => n.Id == accountTransaction.Id);
            DateTime dt = DateTime.Now;
            if (tblAccTr == null)
            {
                tblAccTr = new tblAccountTransaction();
                tblAccTr.Id = accountTransaction.Id;
                _ctx.tblAccountTransaction.AddObject(tblAccTr);
                _log.DebugFormat("accountTransaction.Id == 0");
            }
           


            tblAccTr.AccountId = accountTransaction.Account.Id;
            tblAccTr.Amount = accountTransaction.Amount;
            tblAccTr.DocumentType = (int)accountTransaction.DocumentType;
            tblAccTr.DocumentId = accountTransaction.DocumentId;
            tblAccTr.DateInserted = accountTransaction.DateInserted;
            
            _log.DebugFormat("Saving/Updating AccountTransaction");

           _ctx.SaveChanges();
            return tblAccTr.Id;
        }
 public AccountTransaction Map(tblAccountTransaction tblAccTr){
 
     AccountTransaction accTr = new AccountTransaction(tblAccTr.Id){
     
         Account  = _accountRepository.GetById(tblAccTr.AccountId),
         Amount = (decimal)tblAccTr.Amount,
         DocumentType = (DocumentType)tblAccTr.DocumentType,
         DocumentId = tblAccTr.DocumentId,
         DateInserted = tblAccTr.DateInserted
     };
 
   
     return accTr;
 
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new tblAccountTransaction object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="accountId">Initial value of the AccountId property.</param>
 /// <param name="amount">Initial value of the Amount property.</param>
 /// <param name="documentType">Initial value of the DocumentType property.</param>
 /// <param name="documentId">Initial value of the DocumentId property.</param>
 /// <param name="dateInserted">Initial value of the DateInserted property.</param>
 public static tblAccountTransaction CreatetblAccountTransaction(global::System.Guid id, global::System.Guid accountId, global::System.Decimal amount, global::System.Int32 documentType, global::System.Guid documentId, global::System.DateTime dateInserted)
 {
     tblAccountTransaction tblAccountTransaction = new tblAccountTransaction();
     tblAccountTransaction.Id = id;
     tblAccountTransaction.AccountId = accountId;
     tblAccountTransaction.Amount = amount;
     tblAccountTransaction.DocumentType = documentType;
     tblAccountTransaction.DocumentId = documentId;
     tblAccountTransaction.DateInserted = dateInserted;
     return tblAccountTransaction;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblAccountTransaction EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblAccountTransaction(tblAccountTransaction tblAccountTransaction)
 {
     base.AddObject("tblAccountTransaction", tblAccountTransaction);
 }