Пример #1
0
        internal static int GetNextGameTimeId(int weekId)
        {
            ApplicationDbContext _db     = new ApplicationDbContext();
            DateTime             dateNow = CustomDateFunctions.GetDateTime();
            var nextFootballGameId       = _db.FootballGame.OrderBy(fg => fg.gameDate).Where(fg => fg.gameDate > dateNow && fg.weekId == weekId).Select(fg => fg.gameId).First();

            return(nextFootballGameId);
        }
Пример #2
0
        internal static List <Accounts> GetAccounts()
        {
            ApplicationDbContext _db      = new ApplicationDbContext();
            List <Accounts>      acctList = _db.Accounts.OrderBy(a => a.acctType).ThenBy(a => a.acctBalance).ToList();

            foreach (var acct in acctList)
            {
                if (acct.acctBillDueDate < CustomDateFunctions.GetDateTime())
                {
                    UpdateBillDueDate(acct.acctBillDueDate.Value.AddMonths(1), acct.acctId); //this updates the DB
                    acct.acctBillDueDate = acct.acctBillDueDate.Value.AddMonths(1);          //for showing on the screen without reload
                }
            }
            return(acctList);
        }
Пример #3
0
        // GET: MyFinances
        public async Task <ActionResult> Index()
        {
            List <Accounts> myAccounts       = FinanceFactory.GetAccounts();
            var             thisPaycheckDate = _db.Paycheck.Find(1).paycheckDate;
            // make next paycheck in 2 weeks
            var nextPaycheckDate = thisPaycheckDate.AddDays(14);

            //test now with thisPaycheckDate to update date or not
            if (CustomDateFunctions.GetDateTime() > thisPaycheckDate.AddDays(1))
            {
                FinanceFactory.UpdatePaycheckDate(nextPaycheckDate);
            }
            ViewBag.TotalCashAccounts   = FinanceFactory.GetTotalValueOfAccounts(myAccounts, 1);
            ViewBag.TotalCreditAccounts = FinanceFactory.GetTotalValueOfAccounts(myAccounts, 2);
            ViewBag.NextPaycheck        = (string.Format("{0}/{1}/{2}", thisPaycheckDate.Month, thisPaycheckDate.Day, thisPaycheckDate.Year));
            ViewBag.BillsListPayCheck   = FinanceFactory.GetBillsDue(thisPaycheckDate, nextPaycheckDate);

            return(View(myAccounts));
        }