示例#1
0
        /// <summary>
        /// RATIO REPORTS ALWAYS HAVE 3 PARTS
        ///     1.  THE CURRENT INSTITUTION BEING USED AS THE CONTROL
        ///     2.  THE UBPR GROUP BASED ON ASSETS
        ///     3.  THE CUSTOM PEER GROUP / DEFAULTS TO STATE(?)
        /// </summary>
        /// <param name="reportTypeId"></param>
        /// <param name="timePeriodTypeId"></param>
        /// <param name="filters"></param>
        /// <returns></returns>
        //public RatioReport GetRatioReport(int reportTypeId, int timePeriodTypeId, Dictionary<string, string> filters, string listOfInsitutions) {
        //    string currentInstitutionFdic = filters.FirstOrDefault(x => x.Key == Constants.CURRENT_INSTITUTION_FDIC).Value;
        //    var reportRepo = GetGenericBlipShipRepository<ReportType>();
        //    var dbReport = reportRepo.GetFirst(x => x.ReportTypeId == reportTypeId);
        //    //  GET THE INSITUTION SELECTED
        //    IGenericWarehouse<Institution> insitutionRepo = GetGenericWarehouseRepository<Institution>();
        //    var institution = insitutionRepo.GetFirst(x => x.FdicCertNumber == currentInstitutionFdic);
        //    //  1.  THE CURRENT INSTITUTION BEING USED AS THE CONTROL
        //    var institutionReport = GetReportInstitutionsById(reportTypeId, timePeriodTypeId ,currentInstitutionFdic);
        //    //  2.  THE UBPR GROUP BASED ON ASSETS
        //    var ubprReport = GetReportInstitutionsByUbpr(reportTypeId, timePeriodTypeId,(int)institution.UbprPeerGroupId).ToList();
        //    //  3.  THE CUSTOM BASED ON USER INPUT
        //    var customReport = listOfInsitutions.Trim().Length > 0
        //        ? GetReportByCustomFilters(reportTypeId, timePeriodTypeId, listOfInsitutions.Trim().Remove(listOfInsitutions.Trim().Length - 1, 1))
        //        : new List<WarehouseRatioReport>();
        //    //  4.  THE TOP 20% OF UBPR. DO IT LIKE A CUSTOM REPORT.
        //    var queryRepo = GetWarehouseRepository();
        //    var newList = queryRepo.GetTopTwentyPercentOfUbpr(dbReport.ReportTypeId, (int)institution.UbprPeerGroupId);
        //    var rankedReport = GetReportByCustomFilters(reportTypeId, timePeriodTypeId, string.Join<string>(",", newList));
        //    foreach (var detail in rankedReport) {
        //        detail.Fdic = "UBPR Top 20 Percent";
        //        detail.Idrssd = "UBPR Top 20 Percent";
        //        detail.InstitutionName = "UBPR Top 20 Percent";
        //    }
        //    //  FILL OUT THE REPORT DETAILS
        //    var returnReport = new RatioReport();
        //    returnReport.ReportName = dbReport.ReportTypeName;
        //    returnReport.ReportDescription = dbReport.ReportTypeDescription;
        //    returnReport.ReportDataFormat = dbReport.DataFormat;
        //    institutionReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RatioReportDetail>(x)));
        //    ubprReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RatioReportDetail>(x)));
        //    customReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RatioReportDetail>(x)));
        //    rankedReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RatioReportDetail>(x)));
        //    returnReport.Ranking = new List<BpiInstitutionRank>();
        //    returnReport.Ranking = GetInstitutionRank(reportTypeId, currentInstitutionFdic);
        //    return returnReport;
        //}
        //public RangeReport GetRangeReport(int reportTypeId, int timePeriodTypeId, Dictionary<string, string> filters, string listOfInsitutions) {
        //    string currentInstitutionFdic = filters.FirstOrDefault(x => x.Key == Constants.CURRENT_INSTITUTION_FDIC).Value;
        //    var reportRepo = GetGenericBlipShipRepository<ReportType>();
        //    var dbReport = reportRepo.GetFirst(x => x.ReportTypeId == reportTypeId);
        //    //  GET THE INSITUTION SELECTED
        //    IGenericWarehouse<Institution> insitutionRepo = GetGenericWarehouseRepository<Institution>();
        //    var institution = insitutionRepo.GetFirst(x => x.FdicCertNumber == currentInstitutionFdic);
        //    //  1.  THE CURRENT INSTITUTION BEING USED AS THE CONTROL
        //    var institutionReport = GetRangeReportByInstitutionId(reportTypeId, timePeriodTypeId, currentInstitutionFdic);
        //    //  2.  THE UBPR GROUP BASED ON ASSETS
        //    var ubprReport = GetRangeReportByUbpr(reportTypeId, timePeriodTypeId, (int)institution.UbprPeerGroupId).ToList();
        //    //  3.  THE CUSTOM BASED ON USER INPUT
        //    var customReport = listOfInsitutions.Trim().Length > 0
        //        ? GetRangeReportByCustomFilters(reportTypeId, timePeriodTypeId, listOfInsitutions.Trim().Remove(listOfInsitutions.Trim().Length - 1, 1))
        //        : new List<WarehouseRangeReport>();
        //    //  4.  THE TOP 20% OF UBPR. DO IT LIKE A CUSTOM REPORT.
        //    //var queryRepo = GetWarehouseRepository();
        //    //var newList = queryRepo.GetTopTwentyPercentOfUbpr(dbReport.ReportTypeId, (int)institution.UbprPeerGroupId);
        //    //var rankedReport = GetReportByCustomFilters(reportTypeId, timePeriodTypeId, string.Join<string>(",", newList));
        //    //foreach (var detail in rankedReport)
        //    //{
        //    //    detail.Fdic = "UBPR Top 20 Percent";
        //    //    detail.Idrssd = "UBPR Top 20 Percent";
        //    //    detail.InstitutionName = "UBPR Top 20 Percent";
        //    //}
        //    //  FILL OUT THE REPORT DETAILS
        //    var returnReport = new RangeReport();
        //    returnReport.ReportName = dbReport.ReportTypeName;
        //    returnReport.ReportDescription = dbReport.ReportTypeDescription;
        //    returnReport.ReportDataFormat = dbReport.DataFormat;
        //    institutionReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RangeReportDetail>(x)));
        //    ubprReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RangeReportDetail>(x)));
        //    customReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RangeReportDetail>(x)));
        //    //rankedReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<RangeReportDetail>(x)));
        //    return returnReport;
        //}
        public BpiReport GetReportData(int reportTypeId, int timePeriodTypeId, Dictionary<string, string> filters, string listOfInsitutions)
        {
            string currentInstitutionFdic = filters.FirstOrDefault(x => x.Key == Constants.CURRENT_INSTITUTION_FDIC).Value;
            var reportRepo = GetGenericBlipShipRepository<ReportType>();
            var dbReport = reportRepo.GetFirst(x => x.ReportTypeId == reportTypeId);

            //  GET THE INSITUTION SELECTED
            var insitutionRepo = GetGenericBlipShipRepository<Institution>();
            var institution = insitutionRepo.GetFirst(x => x.FdicCertNumber == currentInstitutionFdic);

            //  1.  THE CURRENT INSTITUTION BEING USED AS THE CONTROL
            var institutionReport = GetReportInstitutionsById(reportTypeId, timePeriodTypeId, currentInstitutionFdic);

            //  2.  THE UBPR GROUP BASED ON ASSETS
            var ubprReport = GetReportInstitutionsByUbpr(reportTypeId, timePeriodTypeId, (int)institution.UbprPeerGroupId).ToList();

            //  3.  THE CUSTOM BASED ON USER INPUT
            var customReport = listOfInsitutions.Trim().Length > 0
                ? GetReportByCustomFilters(reportTypeId, timePeriodTypeId, listOfInsitutions.Trim().Remove(listOfInsitutions.Trim().Length - 1, 1))
                : new List<ReportData>();

            //  4.  THE TOP 20% OF UBPR. DO IT LIKE A CUSTOM REPORT.
            var queryRepo = GetBlipShipRepository();
            var newList = queryRepo.GetTopTwentyPercentOfUbpr(dbReport.ReportTypeId, (int)institution.UbprPeerGroupId).ToList();
            var rankedReport = GetReportByCustomFilters(reportTypeId, timePeriodTypeId, string.Join<string>(",", newList));

            foreach (var detail in rankedReport)
            {
                detail.Fdic = "UBPR Top 20 Percent";
                //detail.Idrssd = "UBPR Top 20 Percent";
                detail.Institution = "UBPR Top 20 Percent";
            }

            //  FILL OUT THE REPORT DETAILS
            var returnReport = new BpiReport();
            returnReport.ReportName = dbReport.ReportTypeName;
            returnReport.ReportDescription = dbReport.ReportTypeDescription;
            returnReport.ReportDataFormat = dbReport.DataFormat;

            institutionReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<BpiReportDetail>(x)));
            ubprReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<BpiReportDetail>(x)));
            customReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<BpiReportDetail>(x)));
            rankedReport.ForEach(x => returnReport.ReportDetail.Add(Mapper.DynamicMap<BpiReportDetail>(x)));

            //  FILL OUT RANKING
            returnReport.Ranking = new List<BpiInstitutionRank>();
            returnReport.Ranking = GetInstitutionRank(reportTypeId, currentInstitutionFdic);

            //  TODO FILL OUT TIME PERIOD TYPES
            //var allTimePeriods = new TypeService().GetAllTimePeriodTypes();
            //var rawData = GetGenericBlipShipRepository<ReportData>();

            //returnReport.TimePeriodTypes = new List<WarehouseTimePeriodType>();
            //foreach (var timeType in allTimePeriods)
            //{
            //    if(rawData.Exists(x => x.ReportTypeId == reportTypeId && x.xAxis.Contains(timeType.TimePeriodTypeFindReplaceValue))){

            //        returnReport.TimePeriodTypes.Add(
            //            allTimePeriods.First(x => x.TimePeriodTypeId == timeType.TimePeriodTypeId)
            //        );
            //    }
            //}

            return returnReport;
        }
示例#2
0
 public DashboardModel()
 {
     RatioReport = new BpiReport();
     RangeReport = new BpiReport();
 }