Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }