Ejemplo n.º 1
0
 public JsonResult GetRunningTotals(DateTime date, TransactionInquiryTypes.InquiryType inquiryType)
 {
     try
     {
         return(Json(Repo.GetTransactionRunningTotal(Utilities.ShortDateString(date), inquiryType), JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message);
         throw;
     }
 }
Ejemplo n.º 2
0
        public string GetTransactionRunningTotal(DateTime date, TransactionInquiryTypes.InquiryType inquiryType)
        {
            IQueryable <TRANSACTIONS> amount;

            switch (inquiryType)
            {
            case TransactionInquiryTypes.InquiryType.Expenses:
                amount = db.TRANSACTIONS.Where(t => t.TRANSACTION_DATE == date && t.IS_DEBIT);
                break;

            case TransactionInquiryTypes.InquiryType.Income:
                amount = db.TRANSACTIONS.Where(t => t.TRANSACTION_DATE == date && !t.IS_DEBIT);
                break;

            default:
                amount = db.TRANSACTIONS;
                break;
            }
            return(amount.Any() ? amount.Sum(a => a.TRANSACTION_AMOUNT).ToString(CultureInfo.CurrentCulture) : "0");
        }