예제 #1
0
        public ActionResult SavePercent(int budgetPlanCategoryId, string allocatedPercent)
        {
            BudgetPlanningService s     = new BudgetPlanningService();
            int            budgetPlanId = s.GetSelectedBudgetPlan();
            SummaryService ss           = new SummaryService();
            decimal        temp         = 0;

            allocatedPercent = allocatedPercent.Replace('%', (char)0);
            if (Decimal.TryParse(allocatedPercent, out temp))
            {
                BudgetPlanCategoryDto b = new BudgetPlanCategoryDto();
                b.BudgetPlanCategoryId = budgetPlanCategoryId;
                b.AllocatedPercentage  = allocatedPercent;
                b.UsePercent           = true;
                s.SaveBudgetPlanCategory(b);
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Allocated percentage cannot be parsed as a decimal number. Please make sure Percent is a number.");
            }
            return(BudgetPlanCategoryListing(budgetPlanId));
        }
예제 #2
0
        public ActionResult SaveAmount(int budgetPlanCategoryId, string allocatedAmount)
        {
            BudgetPlanningService s = new BudgetPlanningService();
            int budgetPlanId        = s.GetSelectedBudgetPlan();

            allocatedAmount = allocatedAmount.TrimStart('$'); // get rid of the dollar signs
            decimal temp = 0;

            if (Decimal.TryParse(allocatedAmount, out temp))
            {
                BudgetPlanCategoryDto b = new BudgetPlanCategoryDto();
                b.BudgetPlanCategoryId = budgetPlanCategoryId;
                b.AllocatedAmount      = allocatedAmount;
                b.UsePercent           = false;
                s.SaveBudgetPlanCategory(b);
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Allocated amount cannot be parsed as a decimal number. Please make sure Amount is a number.");
            }
            return(BudgetPlanCategoryListing(budgetPlanId));
        }
예제 #3
0
        // GET: BudgetPlaning
        public ActionResult Index()
        {
            BudgetPlanningService s = new BudgetPlanningService();

            return(View(s.GetSelectedBudgetPlan()));
        }