Ejemplo n.º 1
0
        public MemoryStream GetFundsTemplate(int year)
        {
            string       excelTemplate = GetExcelTemplate(ReportType.FundsTemplate);
            var          templateFile  = new FileInfo(excelTemplate);
            ExcelPackage package       = new ExcelPackage(templateFile, true);

            GenerateFundsTemplate(package, _fundService.GetAllFunds(year, DbSource.ALL), year);

            var stream = new MemoryStream(package.GetAsByteArray());

            return(stream);
        }
Ejemplo n.º 2
0
        public ActionResult Index(YearFilterViewModel filters, int page = 1)
        {
            var pagingInfo = new PagingInfo()
            {
                PageNumber = page
            };
            var entities = Enumerable.Empty <Fund>();

            // keep track of filter across
            if (filters != null && !filters.IsEmpty)
            {
                TempData[FilterDateKey] = filters;
            }
            else
            {
                if (TempData.Peek(FilterDateKey) != null)
                {
                    filters = TempData.Peek(FilterDateKey) as YearFilterViewModel;
                }
            }

            if (filters.Year.HasValue)
            {
                entities = _fundService.GetAllFunds(filters.Year.Value, filters.DbSource, filters.DisplayName, filters.FundNumber, null, pagingInfo);
            }
            var viewmodel = entities.ToMappedPagedList <Fund, FundDetailsViewModel>(pagingInfo);

            ViewBag.FilterViewModel    = filters;
            ViewBag.AvailableDbSources = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text = DbSource.GC.ToString(), Value = ((int)DbSource.GC).ToString()
                },
                new SelectListItem()
                {
                    Text = DbSource.DIST.ToString(), Value = ((int)DbSource.DIST).ToString()
                }
            };
            return(View(viewmodel));
        }