예제 #1
0
        public ActionResult Index(ReportDataModel model)
        {
            ViewBag.GenderId = GenericSelectList.GetSelectList(SelectListEnums.Gender, "GenderId", "GenderName", model.GenderId);
            ViewBag.EthnicityId = GenericSelectList.GetSelectList(SelectListEnums.Ethnicity, "EthnicityId", "EthnicityName", model.EthnicityId);
            ViewBag.NominationId = GenericSelectList.GetSelectList(SelectListEnums.Nomination, "NominationId", "NominationName", model.NominationId);
            ViewBag.FundingResponsibilityId = GetFundingResponsibilitiesExcludingOther(model);   // GenericSelectList.GetSelectList(SelectListEnums.FundingResponsibility, "FundingResponsibilityId", "FundingResponsibilityName", model.FundingResponsibilityId);
            ViewBag.ProjectId = GenericSelectList.GetSelectList(SelectListEnums.Project, "ProjectId", "ProjectName", model.ProjectId);
            ViewBag.AgeBracketId = GenericSelectList.GetSelectList(SelectListEnums.AgeBracket, "AgeBracketId", "AgeBracketText", model.AgeBracketId);  //GetAgeBracketSelectList(model.AgeGroupId);
            ViewBag.GroupByClauseId = GenericSelectList.GetSelectList(SelectListEnums.GroupBy, "GroupByClauseId", "GroupByClauseText", model.GroupByClauseId);    //GetGroupBySelectList(model.GroupById);

            return DownloadReport(model.DateFrom, model.DateTo, model.NominationId.ToString(), model.ProjectId.ToString(), model.AgeBracketId.ToString(),
                model.GenderId.ToString(), model.EthnicityId.ToString(), model.FundingResponsibilityId.ToString(), model.GroupByClauseId.ToString(), model.IncludeLeavingDetails, "pdf");
        }
예제 #2
0
        private IEnumerable<ReportDataModel> GetReportDataFromDb(DateTime startDt, DateTime endDt, string nominationId, string projectId, string genderId, string ethnicId, string fundingResponsibilityId, string groupBy, AgeBracket ageGroupData)
        {
            //Utility.WriteToLog("Inside GetReportFromDb method", "debug");

            int nomination;
            int.TryParse(nominationId, out nomination);

            int project;
            int.TryParse(projectId, out project);

            int gender;
            int.TryParse(genderId, out gender);

            int ethnic;
            int.TryParse(ethnicId, out ethnic);

            int fundingResponsibility;
            int.TryParse(fundingResponsibilityId, out fundingResponsibility);

            //Utility.WriteToLog("create ReportDataModel", "debug");

            var model = new ReportDataModel
            {
                DateFrom = startDt,
                DateTo = endDt,
                NominationId = nomination,
                ProjectId = project,
                AgeBracketText = ageGroupData == null ? null : ageGroupData.AgeBracketId.ToString(CultureInfo.InvariantCulture),
                GenderId = gender,
                EthnicityId = ethnic,
                FundingResponsibilityId = fundingResponsibility,
                GroupByClause = groupBy
            };

            //Utility.WriteToLog("get report data from report repository", "debug");
            var data = _unitOfWork.ReportRepository.GetReportData(model);

            return data;
        }
예제 #3
0
        private SelectList GetFundingResponsibilitiesExcludingOther(ReportDataModel model)
        {
            if (model == null)
            {
                var data = _unitOfWork.FundingResponsibilityRepository.Get(filter: x=> x.FundingResponsibilityId != 3, orderBy: x => x.OrderBy(k => k.FundingResponsibilityName));
                return new SelectList(data, "FundingResponsibilityId", "FundingResponsibilityName", null);

                //var boroughList = GenericSelectList.GetSelectList(SelectListEnums.FundingResponsibility,
                //    "FundingResponsibilityId", "FundingResponsibilityName");
                //return new SelectList(boroughList.Where(x => x.Value != "3"), "FundingResponsibilityId",
                //    "FundingResponsibilityName", null);
            }
            else
            {
                var data = _unitOfWork.FundingResponsibilityRepository.Get(filter: x => x.FundingResponsibilityId != 3, orderBy: x => x.OrderBy(k => k.FundingResponsibilityName));
                return new SelectList(data, "FundingResponsibilityId", "FundingResponsibilityName", model.FundingResponsibilityId);
                //var boroughList = GenericSelectList.GetSelectList(SelectListEnums.FundingResponsibility,
                //    "FundingResponsibilityId", "FundingResponsibilityName", model.FundingResponsibilityId);
                //return new SelectList(boroughList.Where(x => x.Value != "3"), "FundingResponsibilityId",
                //    "FundingResponsibilityName", model.FundingResponsibilityId);
            }

            
        }