Exemplo n.º 1
0
        public async Task Initialize()
        {
            await _repository.Initialize();

            await AddTransactionsViewModel.Initialize();

            SearchTransactions.Initialize();

            var i = 0;

            while (true)
            {
                var monthBalanceViewModel = new MonthBalanceViewModel(DateTime.Now.PreviousMonth(i), _repository, _windowService);
                await monthBalanceViewModel.Initialize();

                if (monthBalanceViewModel.TotalBalance.Income > 0 || monthBalanceViewModel.TotalBalance.Expense < 0 || i == 0) // always add current month
                {
                    monthBalanceViewModel.DetailTransactionsRequested += async(sender, args) =>
                    {
                        await SearchTransactions.SearchForDatesAndCategory(args.DateFrom, args.DateTo, args.Category);
                    };
                    MonthBalanceViewModels.Add(monthBalanceViewModel);
                    i++;
                }
                else
                {
                    break;
                }
            }

            await CheckGoalsButtons();
        }
Exemplo n.º 2
0
        public ActionResult Search(SearchViewModel TheSearch, Int32 StockAccountID)
        {
            // get the stock account
            StockAccount CustomerStockAccount = db.StockAccount.Find(StockAccountID);

            // make a list to hold the transactions
            List <BankingTransaction> StockTransaction = SearchTransactions.Search(db, TheSearch, 4, StockAccountID);

            // Get the customer
            var CustomerQuery = from u in db.Users
                                where u.UserName == User.Identity.Name
                                select u;

            AppUser Customer = CustomerQuery.FirstOrDefault();

            // Get all of the trades for the customer
            var TradesQuery = from t in db.Trades
                              where t.StockAccount.StockAccountID == CustomerStockAccount.StockAccountID
                              select t;

            List <Trade> Trades = TradesQuery.ToList();

            // add the stuff to view bag
            ViewBag.Trades       = Trades;
            ViewBag.Customer     = Customer;
            ViewBag.Transactions = StockTransaction;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.ResultsCount = StockTransaction.Count;
            return(View("Details", CustomerStockAccount));
        }
Exemplo n.º 3
0
        public ActionResult Search(SearchViewModel TheSearch, Int32 CheckingID)
        {
            Checking checking = db.CheckingAccount.Find(CheckingID);
            List <BankingTransaction> Transactions = SearchTransactions.Search(db, TheSearch, 1, CheckingID);

            // Add the list to the view bag
            ViewBag.CheckingTransactions = Transactions;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.ResultsCount = Transactions.Count;
            return(View("Details", checking));
        }
Exemplo n.º 4
0
        public ActionResult Search(SearchViewModel TheSearch, Int32 SavingID)
        {
            Saving saving = db.SavingsAccount.Find(SavingID);
            List <BankingTransaction> Transactions = SearchTransactions.Search(db, TheSearch, 2, SavingID);

            // Add the list to the view bag
            ViewBag.SavingsTransactions = Transactions;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.ResultsCount = Transactions.Count;
            return(View("Details", saving));
        }
Exemplo n.º 5
0
        public ActionResult Search(SearchViewModel TheSearch, Int32 IRAID)
        {
            // get the ira
            IRA ira = db.IRAAccount.Find(IRAID);

            List <BankingTransaction> IraTransactions = SearchTransactions.Search(db, TheSearch, 3, IRAID);

            ViewBag.IraTransactions = IraTransactions;
            ViewBag.Ranges          = SearchTransactions.AmountRange();
            ViewBag.Dates           = SearchTransactions.DateRanges();
            ViewBag.ResultsCount    = IraTransactions.Count;
            return(View("Details", ira));
        }
Exemplo n.º 6
0
        // GET: StockAccounts/Details
        // Shows all of the Trades for the stock account
        // Takes the Users to the index page of the StockTradeViewModel
        public ActionResult Details()
        {
            // Get the customer
            var CustomerQuery = from u in db.Users
                                where u.UserName == User.Identity.Name
                                select u;

            AppUser Customer = CustomerQuery.FirstOrDefault();

            // Get the Stock Account
            var StockAccountQuery = from s in db.StockAccount
                                    where s.Customer.Id == Customer.Id
                                    select s;

            StockAccount CustomerStockAccount = StockAccountQuery.FirstOrDefault();

            // Check to see if the stock account is active
            if (CustomerStockAccount.ApprovalStatus == ApprovedorNeedsApproval.NeedsApproval)
            {
                RedirectToAction("Portal", "Home");
            }


            // Get all of the trades for the customer
            var TradesQuery = from t in db.Trades
                              where t.StockAccount.StockAccountID == CustomerStockAccount.StockAccountID
                              select t;

            List <Trade> Trades = TradesQuery.ToList();

            // Get all of the transactions
            var TransQuery = from t in db.BankingTransaction
                             where t.StockAccount.StockAccountID == CustomerStockAccount.StockAccountID
                             select t;

            List <BankingTransaction> Trans = TransQuery.ToList();

            // Add to view bag
            ViewBag.Trades       = Trades;
            ViewBag.Transactions = Trans;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.Customer     = Customer;
            ViewBag.ResultsCount = Trans.Count;

            return(View(CustomerStockAccount));
        }
Exemplo n.º 7
0
        // GET: IRAs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IRA ira = db.IRAAccount.Find(id);

            if (ira == null)
            {
                return(HttpNotFound());
            }

            // Get the List off all of the Banking Transaction For this Account
            List <BankingTransaction> IRATransactions = ira.BankingTransactions.ToList();

            // Pass the List to the ViewBag
            ViewBag.IraTransactions = IRATransactions;
            ViewBag.Ranges          = SearchTransactions.AmountRange();
            ViewBag.Dates           = SearchTransactions.DateRanges();
            ViewBag.ResultsCount    = IRATransactions.Count;
            return(View(ira));
        }
Exemplo n.º 8
0
        // GET: Savings/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Saving saving = db.SavingsAccount.Find(id);

            if (saving == null)
            {
                return(HttpNotFound());
            }

            // Get the List off all of the Banking Transaction For this Account
            List <BankingTransaction> SavingTransactions = saving.BankingTransactions.ToList();

            // Pass the List to the ViewBag
            ViewBag.SavingsTransactions = SavingTransactions;
            ViewBag.Ranges       = SearchTransactions.AmountRange();
            ViewBag.Dates        = SearchTransactions.DateRanges();
            ViewBag.ResultsCount = SavingTransactions.Count;
            return(View(saving));
        }
 public TransactionController(TransactionCatalog tc, SearchTransactions st)
 {
     _tc = tc;
     _st = st;
 }