示例#1
0
        public ActionResult UpdateTransaction(Transaction transaction)
        {
            if (!ModelState.IsValid || transaction.Id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Errors"));
            }

            _db.Execute(new UpdateTransactionCommand(transaction));

            var t     = _db.Query(new GetTransactionByIdQuery(transaction.Id));
            var model = new UnreconciledViewModel();

            model.Transactions = new List <Transaction> {
                t
            };
            model.LedgerList   = new SelectList(_db.Query(new GetAllLedgersQuery()), "Ledger", "LedgerDesc", t.Id);
            model.AccountsList = new SelectList(_db.Query(new GetAllAccountsQuery()), "Id", "Desc");
            model.Ledger       = t.Id;

            if (t.IsABillDue())
            {
                return(PartialView("GetRowBillsDue", model));
            }
            if (t.IsUnreconciled())
            {
                return(PartialView("GetRowUnreconciled", model));
            }
            return(PartialView("GetRowReconciled", model));
        }
示例#2
0
        public ViewResult BillsDue()
        {
            var model = new UnreconciledViewModel();

            model.Transactions = _db.Query(new GetBillsDueQuery());
            model.LedgerList   = new SelectList(_db.Query(new GetAllLedgersQuery()).Where(l => l.IsActive), "Ledger", "LedgerDesc");
            model.AccountsList = new SelectList(_db.Query(new GetAllAccountsQuery()), "Id", "Desc");
            return(View(model));
        }
示例#3
0
        public ViewResult Unreconciled(int id)
        {
            var model = new UnreconciledViewModel();

            model.Transactions   = _db.Query(new GetUnreconciledTransactionsForLedgerQuery(id)).OrderBy(t => t.Amount).ToList();
            model.CurrentBalance = _db.Query(new GetCurrentBalanceForLedgerQuery(id));
            model.ActualBalance  = _db.Query(new GetActualBalanceForLedgerQuery(id));
            model.LedgerList     = new SelectList(_db.Query(new GetAllLedgersQuery()), "Ledger", "LedgerDesc", id);
            model.AccountsList   = new SelectList(_db.Query(new GetAllAccountsQuery()), "Id", "Desc");
            model.Ledger         = id;
            return(View(model));
        }
示例#4
0
        public PartialViewResult GetRow(int id)
        {
            var model = new UnreconciledViewModel();

            var t = _db.Query(new GetTransactionByIdQuery(id));

            model.Transactions = new List <Transaction> {
                t
            };
            model.LedgerList   = new SelectList(_db.Query(new GetAllLedgersQuery()), "Ledger", "LedgerDesc", id);
            model.AccountsList = new SelectList(_db.Query(new GetAllAccountsQuery()), "Id", "Desc");
            model.Ledger       = id;

            if (t.IsABillDue())
            {
                return(PartialView("GetRowBillsDue", model));
            }
            if (t.IsUnreconciled())
            {
                return(PartialView("GetRowUnreconciled", model));
            }
            return(PartialView("GetRowReconciled", model));
        }