Beispiel #1
0
        private ActionResult UpdateOrDeleteExpenseBasedOnButtonClick(int[] expensesIds, string saveButton, string deleteButton)
        {
            //   var month = DateTime.Now.Month;
            //   var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            // var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month - 2, year);

            var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            var expenseList = budgetInfoProvider.GetExpensesToUpdate(monthInfo, expensesIds);

            if (deleteButton != null)
            {
                budgetInfoProvider.DeleteExpense(expensesIds);
                ViewBag.DeleteMessage = expensesIds.Count() + " Expenses Deleted";

                //  monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month - 1, year);

                monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);
                return(View("DeleteExpense", monthInfo));
            }

            return(View(expenseList));
        }
Beispiel #2
0
        public ActionResult SaveUpdatedExpenseInfo(ICollection <Expense> expenses)
        {
            //  var month = DateTime.Now.Month;
            //  var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            //var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month - 1, year);


            var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            foreach (var expense in expenses)
            {
                //budgetInfoProvider.SaveUpdatedExpenseInfo(month - 1, year, expense);\

                budgetInfoProvider.SaveUpdatedExpenseInfo(month, year, expense);
            }

            ModelState.Clear();

            return(View(monthInfo));
        }
Beispiel #3
0
        public ActionResult DisplayMonthInfoForEdditing()
        {
            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            // budgetInfoProvider.UpdateCurrentMonthInfo(month - 1, year, monthInfo);
            var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            ModelState.Clear();

            return(View("SaveUpdatedMonthInfo", monthInfo));
        }
Beispiel #4
0
        public ActionResult UpdateCurrentMonthInfoView()
        {
            // var month = DateTime.Now.Month;
            //  var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            // var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month - 1, year);

            var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            return(View(monthInfo));
        }
Beispiel #5
0
        public ActionResult CurrentMonthInfoView()
        {
            //  var month = DateTime.Now.Month;
            //  var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            //var currentMonthInfo = budgetInfoProvider.GetCurrentMonthInfo(month-2, year);

            var currentMonthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            ViewBag.Title = currentMonthInfo.Name + " " + year.ToString() + " Budget Raw Data";

            return(View(currentMonthInfo));
        }
Beispiel #6
0
        public ActionResult SaveUpdatedMonthInfo(Month monthInfo)
        {
            //    var month = DateTime.Now.Month;
            //   var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            // budgetInfoProvider.UpdateCurrentMonthInfo(month - 1, year, monthInfo);

            budgetInfoProvider.UpdateCurrentMonthInfo(month, year, monthInfo);
            var updatedMonthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            ModelState.Clear();

            return(View("CurrentMonthInfoView", updatedMonthInfo));
        }
Beispiel #7
0
        public ActionResult SaveNewExpense(Expense expense)
        {
            //  var month = DateTime.Now.Month;
            //  var year = DateTime.Now.Year;

            var month = 5;
            var year  = 2017;

            var budgetInfoProvider = new MonthlyBudgetInfoAccessor(new SqlDataAccessor(), new MonthlyBudgetStatisticsCalculator());

            expense.Id = 81;
            //budgetInfoProvider.CreateExpense(expense, month-1, year);

            budgetInfoProvider.CreateExpense(expense, month, year);

            ModelState.Clear();

            //var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month - 1, year);

            var monthInfo = budgetInfoProvider.GetCurrentMonthInfo(month, year);

            return(View("CurrentMonthInfo", monthInfo));
        }