예제 #1
0
        public void Accountant_PrintMonethlyReportPost()
        {
            MonthlyDistrictReportViewModel viewModel = new MonthlyDistrictReportViewModel()
            {
                SelectedDistrict = "9D2B0228-5555-4C23-8B49-01A698857709"
            };

            var view = controller.PrintMonthlyReport(viewModel) as ViewResult;

            Assert.AreEqual("MonthlyDistrictReport", view.ViewName);
            Assert.IsNotNull(view.ViewData.Model);
            accountantService.Verify(a => a.printMonthlyCostByDistrict(It.IsAny <Guid>()), Times.AtLeastOnce());
        }
예제 #2
0
        /// <summary>
        /// Display a form to select which district to print
        /// GET: ~/Accountant/Accountant/PrintMonthlyReport
        /// </summary>
        /// <returns></returns>
        public ActionResult PrintMonthlyReport()
        {
            var report    = new List <IMSLogicLayer.Models.ReportRow>();
            var districts = Accountant.getDistricts().Select(d => new SelectListItem {
                Value = d.Id.ToString(), Text = d.Name
            }).ToList();

            var model = new MonthlyDistrictReportViewModel()
            {
                DistrictList = districts,
            };

            return(View("MonthlyDistrictReport", model));
        }
예제 #3
0
        public ActionResult PrintMonthlyReport(MonthlyDistrictReportViewModel district)
        {
            if (district == null || district.SelectedDistrict == null)
            {
                return(RedirectToAction("PrintMonthlyReport", "Accountant"));
            }

            var report     = new List <IMSLogicLayer.Models.ReportRow>();
            var districtId = new Guid(district.SelectedDistrict);

            report = Accountant.printMonthlyCostByDistrict(districtId).ToList();

            var districts = Accountant.getDistricts().Select(d => new SelectListItem {
                Value = d.Id.ToString(), Text = d.Name
            }).ToList();

            var model = new MonthlyDistrictReportViewModel()
            {
                DistrictList = districts,
                Report       = report
            };

            return(View("MonthlyDistrictReport", model));
        }