Ejemplo n.º 1
0
        public long AddExpenseTransactionPaymentHistory(xPlug.BusinessObject.ExpenseTransactionPaymentHistory expenseTransactionPaymentHistory)
        {
            try
            {
                //Re-Map Object to Entity Object
                var myEntityObj = ExpenseTransactionPaymentHistoryMapper.Map <xPlug.BusinessObject.ExpenseTransactionPaymentHistory, ExpenseTransactionPaymentHistory>(expenseTransactionPaymentHistory);
                if (myEntityObj == null)
                {
                    return(-2);
                }
                using (var db = new ExpenseManagerDBEntities())
                {
                    db.AddToExpenseTransactionPaymentHistories(myEntityObj);
                    db.SaveChanges();
                    expenseTransactionPaymentHistory.ExpenseTransactionPaymentHistoryId = myEntityObj.ExpenseTransactionPaymentHistoryId;
                    var paymentVoucher = new BusinessObject.PaymentVoucherNumber
                    {
                        TransactionId          = expenseTransactionPaymentHistory.ExpenseTransactionPaymentHistoryId,
                        TransactionTotalAmount = expenseTransactionPaymentHistory.ExpenseTransaction.TotalApprovedAmount,
                        PaymentDate            = expenseTransactionPaymentHistory.PaymentDate,
                        DateSubmitted          = DateMap.GetLocalDate()
                    };
                    var pcvEntityObj = PaymentVoucherNumberMapper.Map <BusinessObject.PaymentVoucherNumber, PaymentVoucherNumber>(paymentVoucher);
                    db.AddToPaymentVoucherNumbers(pcvEntityObj);
                    db.SaveChanges();

                    return(expenseTransactionPaymentHistory.ExpenseTransactionPaymentHistoryId);
                }
            }
            catch (Exception ex)
            {
                ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
                return(0);
            }
        }
Ejemplo n.º 2
0
 public int AddPaymentVoucherNumber(xPlug.BusinessObject.PaymentVoucherNumber paymentVoucherNumber)
 {
     try
     {
         //Re-Map Object to Entity Object
         var myEntityObj = PaymentVoucherNumberMapper.Map <xPlug.BusinessObject.PaymentVoucherNumber, PaymentVoucherNumber>(paymentVoucherNumber);
         if (myEntityObj == null)
         {
             return(-2);
         }
         using (var db = new ExpenseManagerDBEntities())
         {
             db.AddToPaymentVoucherNumbers(myEntityObj);
             db.SaveChanges();
             paymentVoucherNumber.PaymentVoucherNumberId = myEntityObj.PaymentVoucherNumberId;
             return(paymentVoucherNumber.PaymentVoucherNumberId);
         }
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }