public ActionResult Index(FinReportFilter frepf)
        {
            if (frepf != null)
            {
                LReportsRepository   rep = new LReportsRepository();
                IQueryable <Project> prj = rep.GetResults(frepf);

                if (prj != null)
                {
                    // ViewData["report31"] = rep.IndicatorByBaseline(prj);
                    ViewData["prj"]     = prj;
                    ViewData["report1"] = rep.RequestedAndAwardedAmountByRegion(prj);
                    ViewData["report2"] = rep.RequestedAmountByArea(prj);
                    ViewData["report3"] = rep.RequestedAmountByGrantType(prj);
                    ViewData["report4"] = rep.AwardedAmountByArea(prj);
                    ViewData["report5"] = rep.AwardedAmountByGrantType(prj);
                }

                return(View(frepf));
            }
            else
            {
                return(View());
            }
        }
Exemple #2
0
        public ActionResult index()
        {
            FinReportFilter frepf = new FinReportFilter();

            frepf.IsAllTransfered    = true;
            frepf.IsAwardedAmount    = true;
            frepf.isProjectName      = false;
            frepf.isOrganizationName = true;
            frepf.IsRefund           = true;
            frepf.IsUsedAmount       = true;
            frepf.IsStatus           = true;
            frepf.IsCancellation     = true;
            frepf.IsGrantType        = true;
            frepf.IsCompetitionCode  = true;
            frepf.IsArea             = true;
            frepf.IsCashOnHand       = true;

            //Status is fixed for all Grants.
            List <string> status = new List <string>();

            status.Add("4"); //closed
            status.Add("6"); //terminated.

            LReportsRepository   rep = new LReportsRepository();
            IQueryable <Project> prj = rep.GetResults3(frepf, null, null, null, null, status, null, null, null); //1. gets resulting project list after filtering.

            List <Project> prjList = prj.ToList();

            ViewData["prj"] = prj;



            return(View(frepf));
        }
        ////dispetcher, resends model to ReportView.
        //public ActionResult ResultContainerDisplay(List<List<VsContainer>> results)
        //{
        //    return PartialView("ReportViewControl", results);
        //}



        /// <summary>
        ///   ==Logic:
        ///   1. identify which field required, using List of controls/filters passed, frepf.
        ///  2. call aggregator/grouper methods for identified fields.
        ///   3.  collect the results and return.
        /// </summary>
        /// <param name="prjList"></param>
        /// <param name="frepf"></param>
        /// <param name="Area"></param>
        /// <param name="gtype"></param>
        /// <param name="compete"></param>
        /// <param name="status"></param>
        /// <param name="period"></param>
        /// <returns></returns>
        public Dictionary <ContainerType, List <FinCatReport> > FinReportCore(IQueryable <Project> prjList, FinReportFilter frepf, List <String> Area, List <String> gtype, List <String> compete,
                                                                              List <String> status, List <String> period, List <String> region)
        {
            // var LLVsContainer = new Dictionary<int, List<FinCatReport>>();
            var LLVsContainer = new List <FinCatReport>();

            LReportsRepository  rep    = new LReportsRepository();
            List <FinCatReport> result = null;

            //  var allHolder = new Dictionary<ContainerType, Dictionary<int, List<FinCatReport>>>();  //Dictionary<areaID, List<CatID, SumTrans,SumBudget>
            var allHolder = new Dictionary <ContainerType, List <FinCatReport> >();  //Dictionary<areaID, List<CatID, SumTrans,SumBudget>

            if (Area != null && Area.Count > 0)
            {
                //  LLVsContainer.Clear();
                // foreach (string area in Area)
                {
                    result = rep.BudgetVsArea(prjList);
                    if (result != null && result.Any())
                    {
                        allHolder.Add(ContainerType.BudgetVsArea, result);
                    }
                    // LLVsContainer.Add(result);
                }
                // allHolder.Add(ContainerType.BudgetVsArea, LLVsContainer);
            }
            if (compete != null && compete.Count > 0)
            {
                result = rep.BudgetVsRound(prjList);
                if (result != null && result.Any())
                {
                    allHolder.Add(ContainerType.BudgetVsRound, result);
                }
            }
            if (status != null && status.Count > 0)
            {
                result = rep.BudgetVsStatus(prjList);
                if (result != null && result.Any())
                {
                    allHolder.Add(ContainerType.BudgetVsStatus, result);
                }
                ;
            }
            if (gtype != null && gtype.Count > 0)
            {
                result = rep.BudgetVsType(prjList);
                if (result != null && result.Any())
                {
                    allHolder.Add(ContainerType.BudgetVsType, result);
                }
            }


            return(allHolder);
        }
        //
        // GET: /PopulateFinArtwithCat/

        public ActionResult Index()
        {
            LReportsRepository rr = new LReportsRepository();

            rr.AggregateBudgeByCat();

            // Step1: rr.PopulateFinCatIDStrict();
            //  Step2: rr.PopulateFinCatIDNonStrict();

            /* after 2 Populations, execute EDIT where 0 and fix some of them by HAND! about 60 of them. cancellation/refund shit!!
             * SELECT     TOP (200) FinArticleCatID, BudgetID, FinArticleCatText, Price, TransferAmt, FinCatID
             * FROM         FinArticleCategoryR
             * WHERE     (FinCatID = 0)
             * ORDER BY FinArticleCatText */

            return(View());
        }
        public ActionResult Indicator(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype, List <String> compete,
                                      List <String> status, List <String> oblast, List <String> period, List <String> amount,
                                      List <String> location)
        {
            AppDropDownsService               ServiceDDL     = new AppDropDownsService();
            IEnumerable <ProgramAreaList>     ProgramArea    = ServiceDDL.GetProgramAreaList();
            IEnumerable <ProposalStatusList>  ProposalStatus = ServiceDDL.GetProposalStatusList();
            IEnumerable <GrantTypeList>       GrantType      = ServiceDDL.GetGrantTypeList();
            IEnumerable <CompetitionCodeList> CompletionCode = ServiceDDL.GetCompetitionCodeList();
            IEnumerable <ProposalStatusList>  Status         = ServiceDDL.GetProposalStatusList();
            IEnumerable <RegionList>          Region         = ServiceDDL.GetRegionList();

            ViewData["ProgramArea"]    = ProgramArea;
            ViewData["ProposalStatus"] = ProposalStatus;
            ViewData["GrantType"]      = GrantType;
            ViewData["CompletionCode"] = CompletionCode;
            ViewData["Status"]         = Status;
            ViewData["Region"]         = Region;



            if (frepf != null)
            {
                LReportsRepository rep = new LReportsRepository();
                // IQueryable<Project> prj = rep.GetResults(frepf);
                IQueryable <Project> prj = rep.GetResults2(frepf, ID, Area, gtype, compete,
                                                           status, oblast, period, amount, location);
                List <Project> prjList = prj.ToList();

                if (prj != null)
                {
                    // List<LabelByCount> test =  rep.IndicatorByBaseline(prj, 2);
                    ViewData["report31"] = rep.IndicatorByBaseline(prj);
                    ViewData["report32"] = rep.IndicatorByBenchmark(prj);
                    ViewData["report33"] = rep.IndicatorByFinal(prj);
                    ViewData["prj"]      = prj;
                }

                return(View(frepf));
            }
            else
            {
                return(View());
            }
        }
        private static List <VsContainer> RepCall(IQueryable <Project> prjList, ContainerType ct, int Amounts)
        {
            LReportsRepository rep    = new LReportsRepository();
            List <VsContainer> result = null;

            switch (ct)
            {
            case ContainerType.AreaVsType:
                result = rep.doAreaVsType(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.AreaVsRound:
                result = rep.DoAreaVsCompetitionCode(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.AreaVsStatus:
                result = rep.DoAreaVsStatus(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.TypeVsRound:
                result = rep.DoGrantTypeVsCompetitionCode(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.TypeVsStatus:
                result = rep.DoGrantTypeVsStatus(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.RoundVsStatus:
                result = rep.DoCompetitionCodeVsStatus(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.AreaVsRegion:
                result = rep.DoAreaVsRegion(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.RoundVsRegion:
                result = rep.DoRoundVsRegion(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;

            case ContainerType.TypeVsRegion:
                result = rep.DoTypeVsRegion(prjList, Amounts).OrderBy(k => k.Field2).ToList();
                break;
            }
            return(result);
        }
        private static Dictionary <int, List <FinCatReport> > FillContainer(IQueryable <Project> prjList, FinReportFilter frepf, ContainerType ct,
                                                                            Dictionary <int, List <FinCatReport> > LLVsContainer)
        {
            bool areaVsType = false;

            LReportsRepository rep = new LReportsRepository();

            List <FinCatReport> result = null;

            switch (ct)
            {
            case ContainerType.BudgetVsArea: result = rep.BudgetVsArea(prjList);
                if (result != null && result.Any())
                {
                    LLVsContainer.Add(1, result);
                }
                break;

            case ContainerType.BudgetVsRound: result = rep.BudgetVsRound(prjList);
                if (result != null && result.Any())
                {
                    LLVsContainer.Add(1, result);
                }
                break;

            case ContainerType.BudgetVsStatus: result = rep.BudgetVsStatus(prjList);
                if (result != null && result.Any())
                {
                    LLVsContainer.Add(1, result);
                }
                break;

            case ContainerType.BudgetVsType: result = rep.BudgetVsType(prjList);
                if (result != null && result.Any())
                {
                    LLVsContainer.Add(1, result);
                }
                break;
            }


            return(LLVsContainer);
        }
Exemple #8
0
        public ActionResult Indicator2(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype,
                                       List <String> compete,
                                       List <String> status, List <String> oblast, List <String> period,
                                       List <String> amount, List <String> indicatorcategory)
        {
            LReportsRepository rep = new LReportsRepository();


            //IndRepHolder inp = new IndRepHolder();
            // inp.Column = "Akmola obl";
            // inp.Row ="ECD";
            // inp.Val = 1;



            AppDropDownsService ServiceDDL = new AppDropDownsService();

            #region drops
            IEnumerable <ProgramAreaList>               ProgramArea           = ServiceDDL.GetProgramAreaList();
            IEnumerable <ProposalStatusList>            ProposalStatus        = ServiceDDL.GetProposalStatusList();
            IEnumerable <GrantTypeList>                 GrantType             = ServiceDDL.GetGrantTypeList();
            IEnumerable <CompetitionCodeList>           CompletionCode        = ServiceDDL.GetCompetitionCodeList();
            IEnumerable <ProposalStatusList>            Status                = ServiceDDL.GetProposalStatusList();
            IEnumerable <RegionList>                    Region                = ServiceDDL.GetRegionList();
            IEnumerable <IndicatorLabelContentCategory> IndicatorCategoryList =
                ServiceDDL.IndicatorLabelContentCategoryList();


            ViewData["ProgramArea"] = ProgramArea;
            //take only ECD and Youth.
            IEnumerable <ProgramAreaList> ProgramArea2 = ProgramArea.Where(s => s.ProgramAreaText == "ECD" || s.ProgramAreaText == "Youth");
            ViewData["ProgramArea2"]          = ProgramArea2;
            ViewData["ProposalStatus"]        = ProposalStatus;
            ViewData["GrantType"]             = GrantType;
            ViewData["CompletionCode"]        = CompletionCode;
            ViewData["Status"]                = Status;
            ViewData["Region"]                = Region;
            ViewData["IndicatorCategoryList"] = IndicatorCategoryList;
            #endregion
            //if (frepf != null)
            //{


            IQueryable <Project> prj = rep.GetResults3(frepf, ID, Area, gtype, compete, status, period, oblast, amount);
            //1. gets resulting project list after filtering.


            List <Project> prjList = prj.ToList();
            ViewData["prj"] = prj;


            //  List<IndRepHolder> zz = rep.IndicatorsByRoundArea(prj);
            List <IndRepHolder> zz  = rep.IndicatorsByCompetitionContentCategory(prj);
            List <IndRepHolder> zz2 = rep.IndicatorsByRegionContentCategory(prj);


            ViewData["LIndRep"]  = zz;
            ViewData["LIndRep2"] = zz2;

            if (prjList != null)
            {
                //2. generates/calculates VS amounts.
                Dictionary <IndicatorContainerType, Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> > > results = IndicatorReportCore(
                    prj, frepf, Area, gtype, compete, status, oblast, period, amount, indicatorcategory);

                ViewData["results2"] = results;
            }



            //add List Filters.  //enable Report View enabled if not null.

            if (frepf.isIndicator != null && frepf.isIndicator.Value == true)
            {
                frepf.isIndicator = true;
            }
            else
            {
                frepf.isIndicator = false;
            }

            if (Area != null)
            {
                frepf.IsArea = true;
            }
            if (gtype != null)
            {
                frepf.IsGrantType = true;
            }
            if (compete != null)
            {
                frepf.IsCompetitionCode = true;
            }
            if (status != null)
            {
                frepf.IsStatus = true;
            }
            if (period != null)
            {
                frepf.IsPeriod = true;
            }
            //=====

            return(View(frepf));
        }
Exemple #9
0
        // private static Dictionary<IndicatorContainerType, Dictionary<IndicatorLabelContentCategory, List<IndicatorRepContainer>>>
        private static Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> > FillContainer(
            IQueryable <Project> prjList, FinReportFilter frepf, IndicatorContainerType ct, List <IndicatorLabelContentCategory> IndContCats, List <RegionList> regions,
            List <ProgramAreaList> areas, List <GrantTypeList> gtypeList, List <CompetitionCodeList> competeList)
        //Dictionary<ContainerType, List<VsContainer>> LLVsContainer)
        {
            bool areaVsType = false;
            // List<List<VsContainer>> LLVsContainer = new List<List<VsContainer>>();  //container to hold List Results.



            var grandDictionary = new Dictionary <IndicatorContainerType, Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> > >();
            var dictResult      = new Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> >();
            var rep             = new LReportsRepository();
            List <IndicatorRepContainer> result2 = null;

            //doAreaVsType  //I order list By Field1, needed to create table. The next comes Grouper SUMMER->Counter! Just does math.
            switch (ct)
            {
            case IndicatorContainerType.OblastVsIndicatorLabelCategory:

                foreach (IndicatorLabelContentCategory indContCat in IndContCats)
                {
                    result2 = rep.OblastVsIndicatorLabelCategory(prjList, indContCat.ID, regions);
                    dictResult.Add(indContCat, result2);
                }
                // grandDictionary.Add(IndicatorContainerType.OblastVsIndicatorLabelCategory, dictResult);
                break;

            case IndicatorContainerType.AreaVsIndicatorLabelCategory:
                foreach (IndicatorLabelContentCategory indContCat in IndContCats)
                {
                    result2 = rep.AreaVsIndicatorLabelCategory(prjList, indContCat.ID, areas);
                    dictResult.Add(indContCat, result2);
                }
                //  grandDictionary.Add(IndicatorContainerType.AreaVsIndicatorLabelCategory, dictResult);
                break;

            case IndicatorContainerType.RoundVsIndicatorLabelCategory:
                foreach (IndicatorLabelContentCategory indContCat in IndContCats)
                {
                    result2 = rep.RoundVsIndicatorLabelCategory(prjList, indContCat.ID, competeList);
                    dictResult.Add(indContCat, result2);
                }
                //  grandDictionary.Add(IndicatorContainerType.RoundVsIndicatorLabelCategory, dictResult);
                break;

            case IndicatorContainerType.TypeVsIndicatorLabelCategory:
                foreach (IndicatorLabelContentCategory indContCat in IndContCats)
                {
                    result2 = rep.TypeVsIndicatorLabelCategory(prjList, indContCat.ID, gtypeList);
                    dictResult.Add(indContCat, result2);
                }
                //  grandDictionary.Add(IndicatorContainerType.TypeVsIndicatorLabelCategory, dictResult);
                break;
            }

            //Dictionary<AmountTypes, List<VsContainer>> resultDictionary =
            //    new Dictionary<AmountTypes, List<VsContainer>>();
            //resultDictionary.Add(AmountTypes.AmountRequested, result);

            //if (LLVsContainer.ContainsKey(ct))
            //{
            //    if (result != null)
            //        LLVsContainer[ct].Add(AmountTypes.AmountRequested, result); //.AddRange(resultDictionary);
            //}
            //else
            //{
            //    LLVsContainer.Add(ct, resultDictionary); //add result to Container List.
            //}

            return(dictResult);
            //return grandDictionary;
        }
        public ActionResult outcome(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype,
                                    List <String> compete,
                                    List <String> status, List <String> oblast, List <String> period,
                                    List <String> amount, List <String> indicatorcategory)
        {
            AppDropDownsService ServiceDDL = new AppDropDownsService();

            #region drops
            IEnumerable <ProgramAreaList>               ProgramArea           = ServiceDDL.GetProgramAreaList();
            IEnumerable <ProposalStatusList>            ProposalStatus        = ServiceDDL.GetProposalStatusList();
            IEnumerable <GrantTypeList>                 GrantType             = ServiceDDL.GetGrantTypeList();
            IEnumerable <CompetitionCodeList>           CompletionCode        = ServiceDDL.GetCompetitionCodeList();
            IEnumerable <ProposalStatusList>            Status                = ServiceDDL.GetProposalStatusList();
            IEnumerable <RegionList>                    Region                = ServiceDDL.GetRegionList();
            IEnumerable <IndicatorLabelContentCategory> IndicatorCategoryList =
                ServiceDDL.IndicatorLabelContentCategoryList();
            ViewData["ProgramArea"]           = ProgramArea;
            ViewData["ProposalStatus"]        = ProposalStatus;
            ViewData["GrantType"]             = GrantType;
            ViewData["CompletionCode"]        = CompletionCode;
            ViewData["Status"]                = Status;
            ViewData["Region"]                = Region;
            ViewData["IndicatorCategoryList"] = IndicatorCategoryList;
            #endregion
            //if (frepf != null)
            //{
            LReportsRepository rep = new LReportsRepository();


            IQueryable <Project> prj = rep.GetResults3(frepf, ID, Area, gtype, compete, status, period, oblast, amount);
            //1. gets resulting project list after filtering.


            List <Project> prjList = prj.ToList();
            ViewData["prj"] = prj;



            //add List Filters.  //enable Report View enabled if not null.
            if (Area != null)
            {
                frepf.IsArea = true;
            }
            if (gtype != null)
            {
                frepf.IsGrantType = true;
            }
            if (compete != null)
            {
                frepf.IsCompetitionCode = true;
            }
            if (status != null)
            {
                frepf.IsStatus = true;
            }
            if (period != null)
            {
                frepf.IsPeriod = true;
            }
            //=====

            return(View(frepf));
        }
        public ActionResult BudgetAnalysis(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype, List <String> compete,
                                           List <String> status, List <String> period, List <String> amount, List <String> oblast)
        {
            AppDropDownsService ServiceDDL = new AppDropDownsService();

            ViewData["CompletionCode"] = ServiceDDL.GetCompetitionCodeList();
            ViewData["ProgramArea"]    = ServiceDDL.GetProgramAreaList();
            ViewData["GrantType"]      = ServiceDDL.GetGrantTypeList();
            ViewData["Status"]         = ServiceDDL.GetProposalStatusList();
            ViewData["Region"]         = ServiceDDL.GetRegionList();
            //if (frepf != null)
            //{
            LReportsRepository   rep = new LReportsRepository();
            IQueryable <Project> prj = rep.GetResults3(frepf, ID, Area, gtype, compete, status, period, oblast, amount); //1. gets resulting project list after filtering.


            List <Project> prjList = prj.ToList();

            ViewData["prj"] = prj;


            if (prjList != null)
            {
                //2. generates/calculates VS amounts.
                if (!frepf.isListOnly.Value)
                {
                    Dictionary <ContainerType, Dictionary <AmountTypes, List <VsContainer> > > results = FinReportCore(prj, frepf, Area, gtype, compete, status, period, oblast);
                    ViewData["results2"] = results;
                }
            }

            //add List Filters.  //enable Report View enabled if not null.
            if (Area != null)
            {
                frepf.IsArea = true;
            }
            if (gtype != null)
            {
                frepf.IsGrantType = true;
            }
            if (compete != null)
            {
                frepf.IsCompetitionCode = true;
            }
            if (status != null)
            {
                frepf.IsStatus = true;
            }
            if (period != null)
            {
                frepf.IsPeriod = true;
            }
            if (oblast != null)
            {
                frepf.isRegion = true;
            }


            //=====

            return(View(frepf));
        }
        private static Dictionary <ContainerType, Dictionary <AmountTypes, List <VsContainer> > > FillContainer(IQueryable <Project> prjList, FinReportFilter frepf, ContainerType ct,
                                                                                                                Dictionary <ContainerType, Dictionary <AmountTypes, List <VsContainer> > > LLVsContainer)
        //Dictionary<ContainerType, List<VsContainer>> LLVsContainer)
        {
            bool areaVsType = false;
            // List<List<VsContainer>> LLVsContainer = new List<List<VsContainer>>();  //container to hold List Results.

            //TODO:
            //this code must be refactored!! ....One manager should be calling service class and
            //service class manager should one by one call other service private methods,
            //send ones results to another and at the end return result to controller.
            //Now: we have Too much of coupling of one method to another! Manager must be responsible for chain calls! also too much of repetitive code !
            //BUT HEY! WORKS!

            LReportsRepository rep = new LReportsRepository();

            if (frepf.isAmountRequested != null && frepf.isAmountRequested.Value)
            {
                List <VsContainer> result = null;
                //doAreaVsType  //I order list By Field1, needed to create table. The next comes Grouper SUMMER->Counter! Just does math.
                result = RepCall(prjList, ct, 1);  //repository call! instead of 1 must use enum type.

                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.AmountRequested, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.AmountRequested, result);                //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary); //add result to Container List.
                }
            }
            if (frepf.IsAwardedAmount != null && frepf.IsAwardedAmount.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 2).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 2).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.AwardedAmount, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.AwardedAmount, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
            }

            //....more coming here.
            if (frepf.IsAllTransfered != null && frepf.IsAllTransfered.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 3).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 3).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.AllTransfered, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.AllTransfered, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }
            if (frepf.IsUsedAmount != null && frepf.IsUsedAmount.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 4).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 4).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.UsedAmount, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.UsedAmount, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }
            if (frepf.IsUnusedAmount != null && frepf.IsUnusedAmount.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 5).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 5).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.UnusedAmount, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.UnusedAmount, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }
            if (frepf.IsCashOnHand != null && frepf.IsCashOnHand.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 6).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 6).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.CashOnHand, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.CashOnHand, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }
            if (frepf.IsRefund != null && frepf.IsRefund.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 7).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 7).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.Refund, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.Refund, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }
            if (frepf.IsCancellation != null && frepf.IsCancellation.Value)
            {
                List <VsContainer> result = null;
                switch (ct)
                {
                case ContainerType.AreaVsType: result = rep.doAreaVsType(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRound: result = rep.DoAreaVsCompetitionCode(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsStatus: result = rep.DoAreaVsStatus(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRound: result = rep.DoGrantTypeVsCompetitionCode(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsStatus: result = rep.DoGrantTypeVsStatus(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsStatus: result = rep.DoCompetitionCodeVsStatus(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.AreaVsRegion: result = rep.DoAreaVsRegion(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.RoundVsRegion: result = rep.DoRoundVsRegion(prjList, 8).OrderBy(k => k.Field2).ToList(); break;

                case ContainerType.TypeVsRegion: result = rep.DoTypeVsRegion(prjList, 8).OrderBy(k => k.Field2).ToList(); break;
                }
                Dictionary <AmountTypes, List <VsContainer> > resultDictionary = new Dictionary <AmountTypes, List <VsContainer> >();
                resultDictionary.Add(AmountTypes.Cancellation, result);

                if (LLVsContainer.ContainsKey(ct))
                {
                    if (result != null)
                    {
                        LLVsContainer[ct].Add(AmountTypes.Cancellation, result);                   //.AddRange(resultDictionary);
                    }
                }
                else
                {
                    LLVsContainer.Add(ct, resultDictionary);    //add result to Container List.
                }
                //if (LLVsContainer.ContainsKey(ct))
                //{
                //    if (result != null) LLVsContainer[ct].AddRange(result);
                //}
                //else
                //{
                //    LLVsContainer.Add(ct, result); //add result to Container List.
                //}
            }

            return(LLVsContainer);
        }
        public ActionResult Index(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype, List <String> compete,
                                  List <String> status, List <String> period, List <String> amount, List <String> oblast, List <String> lfIndicators)
        {
            AppDropDownsService ServiceDDL = new AppDropDownsService();

            ViewData["CompletionCode"]  = ServiceDDL.GetCompetitionCodeList();
            ViewData["ProgramArea"]     = ServiceDDL.GetProgramAreaList();
            ViewData["GrantType"]       = ServiceDDL.GetGrantTypeList();
            ViewData["Status"]          = ServiceDDL.GetProposalStatusList();
            ViewData["Region"]          = ServiceDDL.GetRegionList();
            ViewData["BudgetCatList"]   = ServiceDDL.GetCatList();
            ViewData["LfIndicatorList"] = ServiceDDL.GetLfIndicatorList();

            LReportsRepository   rep = new LReportsRepository();
            IQueryable <Project> prj = rep.GetResults3(frepf, ID, Area, gtype, compete, status, period, oblast, amount, lfIndicators); //1. gets resulting project list after filtering.


            List <Project> prjList = prj.ToList();

            ViewData["prj"] = prj;



            if (prjList != null)
            {
                var query = prjList
                            .GroupBy(g => new //GROUP BY GrantType, ProgramArea Field1, Field2 and SUM AmtRequested.
                {
                    g.LFIndicator.LFIndicatorID,
                })
                            .Select(group => new VsContainer() //Select all Grouped into VersusContainer.
                {
                    ProjId      = group.Select(i => i.ProjectID).ToList(),
                    Field1      = group.Key.LFIndicatorID,
                    iAmount     = prjList.Count(),
                    dAmount     = group.Select(i => i.ProjectID).Count(),
                    Field1Title = "# of grants with " + group.Select(i => i.LFIndicator.LFIndicatorList.CodeText).FirstOrDefault()
                });

                List <VsContainer> vsc = query.ToList();   //test.
                ViewData["vsc"] = vsc;
            }


            //add List Filters.  //enable Report View enabled if not null.
            if (lfIndicators != null)
            {
                frepf.isLFIndicator = true;
            }
            if (Area != null)
            {
                frepf.IsArea = true;
            }
            if (gtype != null)
            {
                frepf.IsGrantType = true;
            }
            if (compete != null)
            {
                frepf.IsCompetitionCode = true;
            }
            if (status != null)
            {
                frepf.IsStatus = true;
            }
            if (period != null)
            {
                frepf.IsPeriod = true;
            }
            if (oblast != null)
            {
                frepf.isRegion = true;
            }
            //=====

            return(View(frepf));
        }
Exemple #14
0
        public ActionResult partial2(FinReportFilter frepf, List <String> Area, List <String> gtype, List <String> compete, int?id)
        {
            //Status is fixed for all Grants.
            List <string> status = new List <string>();

            status.Add("4"); //closed
            status.Add("6"); //terminated.

            LReportsRepository   rep = new LReportsRepository();
            IQueryable <Project> prj = rep.GetResults3(frepf, null, null, null, null, status, null, null, null); //1. gets resulting project list after filtering.

            List <Project> prjList = prj.ToList();

            ViewData["prj"] = prj;

            var dType = new Dictionary <AmountTypes, IEnumerable <DRContainer> >();

            if (id.HasValue && id.Value == 1)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReports(prj, AmountTypes.Refund);
                dType.Add(AmountTypes.Refund, DRModel);
                DRModel = GeneratePartialReports(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                DRModel = GeneratePartialReports(prj, AmountTypes.CashOnHand);
                dType.Add(AmountTypes.CashOnHand, DRModel);
                DRModel = GeneratePartialReports(prj, AmountTypes.UsedAmount);
                dType.Add(AmountTypes.UsedAmount, DRModel);
                DRModel = GeneratePartialReports(prj, AmountTypes.Cancellation);
                dType.Add(AmountTypes.Cancellation, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Awarded";
                ViewData["RepType"] = "Reports By Round";
            }
            if (id.HasValue && id.Value == 2)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReportsByAreaAwrd(prj, AmountTypes.Refund);
                dType.Add(AmountTypes.Refund, DRModel);
                DRModel = GeneratePartialReportsByAreaAwrd(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                DRModel = GeneratePartialReportsByAreaAwrd(prj, AmountTypes.CashOnHand);
                dType.Add(AmountTypes.CashOnHand, DRModel);
                DRModel = GeneratePartialReportsByAreaAwrd(prj, AmountTypes.UsedAmount);
                dType.Add(AmountTypes.UsedAmount, DRModel);
                DRModel = GeneratePartialReportsByAreaAwrd(prj, AmountTypes.Cancellation);
                dType.Add(AmountTypes.Cancellation, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Awarded";
                ViewData["RepType"] = "Reports By Area";
            }
            if (id.HasValue && id.Value == 3)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReportsByTypeAwrd(prj, AmountTypes.Refund);
                dType.Add(AmountTypes.Refund, DRModel);
                DRModel = GeneratePartialReportsByTypeAwrd(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                DRModel = GeneratePartialReportsByTypeAwrd(prj, AmountTypes.CashOnHand);
                dType.Add(AmountTypes.CashOnHand, DRModel);
                DRModel = GeneratePartialReportsByTypeAwrd(prj, AmountTypes.UsedAmount);
                dType.Add(AmountTypes.UsedAmount, DRModel);
                DRModel = GeneratePartialReportsByTypeAwrd(prj, AmountTypes.Cancellation);
                dType.Add(AmountTypes.Cancellation, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Awarded";
                ViewData["RepType"] = "Reports By Type";
            }
            if (id.HasValue && id.Value == 4)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReportsByRoundUsed(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Used";
                ViewData["RepType"] = "Reports By Round(Transfered/Used)";
            }
            if (id.HasValue && id.Value == 5)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReportsByAreaUsed(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Used";
                ViewData["RepType"] = "Reports By Area(Transfered/Used)";
            }
            if (id.HasValue && id.Value == 6)
            {
                IEnumerable <DRContainer> DRModel = GeneratePartialReportsByTypeUsed(prj, AmountTypes.AllTransfered);
                dType.Add(AmountTypes.AllTransfered, DRModel);
                ViewData["dType"]   = dType;
                ViewData["Base"]    = "Used";
                ViewData["RepType"] = "Reports By Type(Transfered/Used)";
            }
            return(PartialView());
        }