コード例 #1
0
        public ActionResult Year(int year)
        {
            ViewBag.PreviousYear = year - 1;
            ViewBag.Year = year;
            ViewBag.NextYear = year + 1;
            ViewBag.DecadeStartYear = year / 10 * 10;
            ViewBag.DecadeEndYear = year / 10 * 10 + 9;

            IAssetRepository assetRepository = new EFAssetRepository(User.Identity.Name);
            ICreditRepository creditRepository = new EFCreditRepository(User.Identity.Name);
            ProjectionGenerator generator = new ProjectionGenerator(assetRepository, creditRepository);
            List<DateTime> dateList = new List<DateTime>();
            for (int m = 1; m <= 12; m++)
            {
                dateList.Add(new DateTime(year, m, 1));
            }
            ProjectionViewModel viewModel = generator.GenerateProjection(dateList, false);

            return View(viewModel);
        }
コード例 #2
0
        // year = start year
        public ActionResult Decade(int year)
        {
            ViewBag.PreviousYearStart = year - 10;
            ViewBag.PreviousYearEnd = year - 1;
            ViewBag.YearStart = year;
            ViewBag.YearEnd = year + 9;
            ViewBag.NextYearStart = year + 10;
            ViewBag.NextYearEnd = year + 19;

            IAssetRepository assetRepository = new EFAssetRepository(User.Identity.Name);
            ICreditRepository creditRepository = new EFCreditRepository(User.Identity.Name);
            ProjectionGenerator generator = new ProjectionGenerator(assetRepository, creditRepository);
            List<DateTime> dateList = new List<DateTime>();
            for (int y = year; y < year + 10; y++)
            {
                dateList.Add(new DateTime(y, 1, 1));
            }
            ProjectionViewModel viewModel = generator.GenerateProjection(dateList, true);

            return View(viewModel);
        }
コード例 #3
0
ファイル: ProjectionTest.cs プロジェクト: robsymes/finproj
        public void DecadeProjection()
        {
            List<DateTime> dateList = new List<DateTime>
            {
                new DateTime(2010, 1, 1),
                new DateTime(2011, 1, 1),
                new DateTime(2012, 1, 1),
                new DateTime(2013, 1, 1),
            };

            IAssetRepository assetRepository = new TestAssetRepository("rob");
            ICreditRepository creditRepository = new TestCreditRepository("rob");
            ProjectionGenerator generator = new ProjectionGenerator(assetRepository, creditRepository);
            ProjectionViewModel viewModel = generator.GenerateProjection(dateList, true);

            Assert.AreEqual(2, viewModel.AssetRows.Count);
            Assert.AreEqual(4, viewModel.AssetRows[0].Values.Count);
            Assert.AreEqual(4, viewModel.AssetRows[1].Values.Count);

            Assert.AreEqual(6720.0M, viewModel.CashflowRow.Values[0]);
            Assert.AreEqual(8640.0M, viewModel.CashflowRow.Values[1]);
            Assert.AreEqual(10560.0M, viewModel.CashflowRow.Values[2]);
        }