Esempio n. 1
0
        public ActionResult Index(int id)
        {
            ViewBag.Title = "Redigera";

            var model = new EditBillViewModel();
            var bill  = EconomyBusiness.GetBillById(id);

            if (bill == null)
            {
                return(HttpNotFound("Finns ingen faktura med id: " + id.ToString()));
            }

            model.BillId                = bill.BillID;
            model.DueDate               = bill.DueDate;
            model.Amount                = Math.Round(bill.Amount, 2);
            model.SelectedCategoryId    = bill.CategoryID;
            model.SelectedSubCategoryId = bill.SubCategoryID;
            model.SelectedPayerId       = bill.PayerID;
            model.Description           = bill.Description;

            model.Categories    = EconomyBusiness.GetAllCategories();
            model.SubCategories = EconomyBusiness.GetAllSubCategories();
            model.Payers        = EconomyBusiness.GetAllPayers();

            return(View("Index", model));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var model = EconomyBusiness.GetMonthlyBills();

            ViewBag.RunButtonDisabled = EconomyBusiness.IsMonthlyPaymentsExecuted(DateTime.Now);

            return(View(model));
        }
Esempio n. 3
0
        public JsonResult GetSubCategories(CategoryJson categoryJson)
        {
            var model = EconomyBusiness.GetSubCategoriesByCategory(categoryJson.CategoryId).ToList();

            var list = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });


            return(Json(list, JsonRequestBehavior.DenyGet));
        }
Esempio n. 4
0
        public ActionResult Copy(int id)
        {
            var model = EconomyBusiness.CopyBill(id);

            if (model != null)
            {
                return(RedirectToAction("Index", "Invoice", new
                {
                    id = model.BillID
                }));
            }
            return(Create());
        }
Esempio n. 5
0
        public ActionResult Create()
        {
            ViewBag.Title = "Skapa";

            var model = new EditBillViewModel();


            model.Categories    = EconomyBusiness.GetAllCategories();
            model.SubCategories = EconomyBusiness.GetAllSubCategories();
            model.Payers        = EconomyBusiness.GetAllPayers();

            return(View("Edit", model));
        }
Esempio n. 6
0
        public ActionResult Index(int?page)
        {
            if (!Request.IsAuthenticated)
            {
                return(RedirectToAction("Login", "User"));
            }

            page = page ?? 0;

            ViewBag.Title = "Skapa";

            var model = EconomyBusiness.GetBills(page.Value, 50);

            return(View(model));
        }
Esempio n. 7
0
        public ActionResult Edit(int id)
        {
            ViewBag.Title = "Redigera";

            var model = new EditBillViewModel();
            var bill  = EconomyBusiness.GetMonthlyBillById(id);

            model.BillId                = bill.MonthlyBillID;
            model.Amount                = bill.Amount;
            model.SelectedCategoryId    = bill.CategoryID;
            model.SelectedSubCategoryId = bill.SubCategoryID;
            model.SelectedPayerId       = bill.PayerID;
            model.Description           = bill.Description;

            model.Categories    = EconomyBusiness.GetAllCategories();
            model.SubCategories = EconomyBusiness.GetAllSubCategories();
            model.Payers        = EconomyBusiness.GetAllPayers();

            return(View("Edit", model));
        }
Esempio n. 8
0
        public ActionResult Index()
        {
            var model = new StatisticsViewModel();

            model.Categories    = EconomyBusiness.GetAllCategories();
            model.SubCategories = EconomyBusiness.GetAllSubCategories();
            model.Descriptions  = EconomyBusiness.GetAllDescriptions();

            model.Years = StatisticsBusiness.GetYears();

            int selectedYear = -AppSettings.GetAppSettingsInteger("YearsBack");//DateTime.Now.AddYears(-AppSettings.GetAppSettingsInteger("YearsBack")).Year;

            model.SelectedYear = DateTime.Now.AddYears(selectedYear).Year;

            model.ChartSrc = StatisticsBusiness.GetChart(new FilterJson {
                CategoryId  = 0, SubCategoryId = 0,
                Description = string.Empty,
                FromYear    = model.SelectedYear
            });
            return(View(model));
        }
Esempio n. 9
0
        public JsonResult IsMonthlyPaymentsExecuted(DateTime date)
        {
            var model = EconomyBusiness.IsMonthlyPaymentsExecuted(date);

            return(Json(model));
        }
Esempio n. 10
0
        public JsonResult RunMonthlyPayments(DateTime date)
        {
            var model = EconomyBusiness.RunMonthlyPayments(date);

            return(Json(model));
        }
Esempio n. 11
0
        public JsonResult AutoCompleteDescription()
        {
            var model = EconomyBusiness.GetAllDescriptions().ToList();

            return(Json(model, JsonRequestBehavior.DenyGet));
        }
Esempio n. 12
0
        public JsonResult SaveMonthlyBill(BillJson billJson)
        {
            var model = EconomyBusiness.SaveMonthlyBill(billJson);

            return(Json(model));
        }