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()); } }
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)); }
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()); } }
public static IQueryable <Project> GetResults2(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) { IQueryable <Project> matches = db.Projects; // var inner_predicate = PredicateBuilder.False<Project>(); //this is for ORs. that is wahy .False selected. ==== var outer_predicate = PredicateBuilder.True <Project>(); //this is for AND ===== //check Amount Requested. if (frepf.isAmountRequested.Value) { if (frepf.RequestedDateStart.HasValue && frepf.RequestedDateEnd.HasValue) { matches = matches.Where(a => a.ProposalInfo.RequestDate >= frepf.RequestedDateStart && a.ProposalInfo.RequestDate <= frepf.RequestedDateEnd); } } //check if Organization Name if (frepf.isOrganizationName.Value) { //join the project with organization where organization has projectID. matches.Join(matches, project => project, organization => organization, (project, organization) => new { ProjectID = project.ProjectID, OrgPrjectID = organization.ProjectID }); } //1.Area Append. if (Area != null && Area.Count > 0 && !Area.Contains("All")) { try { var inner_predicate_area = PredicateBuilder.False <Project>(); foreach (string item in Area) { int val = Convert.ToInt32(item); inner_predicate_area = inner_predicate_area.Or(a => a.ProgramArea.ProgramAreaCodeID == val); } matches = matches.Where(inner_predicate_area); } catch {; } } //2. GrantType Append ...? if (gtype != null && gtype.Count > 0 && !gtype.Contains("All")) { try { var inner_predicate_gtype = PredicateBuilder.False <Project>(); foreach (string item in gtype) { int val = Convert.ToInt32(item); inner_predicate_gtype = inner_predicate_gtype.Or(a => a.GrantType.GrantTypeCodeID == val); } matches = matches.Where(inner_predicate_gtype); } catch {; } } //3. Competition Code: compete if (compete != null && compete.Count > 0 && !compete.Contains("All")) { try { var inner_predicate_compete = PredicateBuilder.False <Project>(); foreach (string item in compete) { int val = Convert.ToInt32(item); inner_predicate_compete = inner_predicate_compete.Or(a => a.CompetitionCode.CompetCodeID == val); } matches = matches.Where(inner_predicate_compete); } catch {; } } //4. GrantStatus status //if (status != null && status.Count > 0 && !status.Contains("All")) //{ // int Code = -1; // var inner_predicate_status = PredicateBuilder.False<Project>(); // int[] CodeArray = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0,0}; // for (int i = 0; i < status.Count; i++) // { // try { CodeArray[i] = Convert.ToInt32(status[i].ToString()); } // catch { ;} // if (CodeArray[i] > -1) // { // inner_predicate_status = inner_predicate_status.Or(a => a.ProposalStatus.PropStatusID == CodeArray[i]); // } // } if (status != null && status.Count > 0 && !status.Contains("All")) { var inner_predicate_status = PredicateBuilder.False <Project>(); foreach (string item in status) { int val = Convert.ToInt32(item); inner_predicate_status = inner_predicate_status.Or(a => a.ProposalStatus.PropStatusID == val); } matches = matches.Where(inner_predicate_status); //This Ands All Ors. // outer_predicate = outer_predicate.And(inner_predicate_status); //accumulate this inner. } //5. List<String> oblast if (oblast != null && oblast.Count > 0 && !oblast.Contains("All")) { try { var inner_predicate_oblast = PredicateBuilder.False <Project>(); foreach (string item in oblast) { int val = Convert.ToInt32(item); inner_predicate_oblast = inner_predicate_oblast.Or(a => a.Organization.Addresses.FirstOrDefault().DDIDRegion == val); } matches = matches.Where(inner_predicate_oblast); } catch {; } //int Code = -1; //var inner_predicate = PredicateBuilder.False<Project>(); //create a new empty one . //for (int i = 0; i < oblast.Count; i++) //{ // try { Code = Convert.ToInt32(oblast[i].ToString()); } // catch { ;} // if (Code > -1) // { // inner_predicate = inner_predicate.Or(a => a.Organization.Addresses.FirstOrDefault().DDIDRegion == Code); // } //} //matches = matches.Where(inner_predicate); //This Ands All Ors. //outer_predicate = outer_predicate.And(inner_predicate); //accumulate this inner. } //6. List<String> amount < 290000 <3625000 >7250000 if (amount != null && amount.Count > 0 && !amount.Contains("All")) { int Code = -1; var inner_predicate_amount = PredicateBuilder.False <Project>(); //create a new empty one . for (int i = 0; i < amount.Count; i++) { try { Code = Convert.ToInt32(amount[i].ToString()); } catch {; } if (Code > -1) { if (Code == 290000 || Code == 3625000) { inner_predicate_amount = inner_predicate_amount.Or(a => a.ProjectInfo.AwardedAmt < Code); } else { inner_predicate_amount = inner_predicate_amount.Or(a => a.ProjectInfo.AwardedAmt > Code); } } } matches = matches.Where(inner_predicate_amount); //This Ands All Ors. //outer_predicate = outer_predicate.And(inner_predicate); //accumulate this inner. } //remove the Deleted Project From Reports: matches = matches.Where(a => a.isDeleted.Value.Equals(null)); //return db.Projects.Where(predicate); // matches = matches.Where(outer_predicate); // List<Project> pr = matches.ToList(); return(matches); }
public static IQueryable <Project> GetResults4(FinReportFilter frepf, int?ID, List <String> Area, List <String> gtype, List <String> compete, List <String> status, List <String> period, List <String> indicatorCategory, List <String> oblast) { IQueryable <Project> matches = db.Projects; // var inner_predicate = PredicateBuilder.False<Project>(); //this is for ORs. that is wahy .False selected. ==== var outer_predicate = PredicateBuilder.True <Project>(); //this is for AND ===== //check if Organization Name if (frepf.isOrganizationName.Value) { //join the project with organization where organization has projectID. matches.Join(matches, project => project, organization => organization, (project, organization) => new { ProjectID = project.ProjectID, OrgPrjectID = organization.ProjectID }); } //5. List<String> oblast if (oblast != null && oblast.Count > 0 && !oblast.Contains("All")) { try { var inner_predicate_oblast = PredicateBuilder.False <Project>(); foreach (string item in oblast) { int val = Convert.ToInt32(item); inner_predicate_oblast = inner_predicate_oblast.Or(a => a.Organization.Addresses.FirstOrDefault().DDIDRegion == val); } matches = matches.Where(inner_predicate_oblast); } catch { ; } } ////1.Indicator Append.??? IndicatorCategory is not a type of Project! One Project May have many Categories of Indicators. //if (indicatorCategory != null && indicatorCategory.Count > 0) //{ // try // { // var inner_predicate_indicator = PredicateBuilder.False<Project>(); // foreach (string item in indicatorCategory) // { // if (item != "All") //we don't wanna convert All into Int. // { // int val = Convert.ToInt32(item); // inner_predicate_indicator = inner_predicate_indicator.Or(a => a.Indicator..LabelContentCategory == val); // } // } // matches = matches.Where(inner_predicate_indicator); // } // catch { ; } //} //1.Area Append. if (Area != null && Area.Count > 0) { try { var inner_predicate_area = PredicateBuilder.False <Project>(); foreach (string item in Area) { if (item != "All") //we don't wanna convert All into Int. { int val = Convert.ToInt32(item); inner_predicate_area = inner_predicate_area.Or(a => a.ProgramArea.ProgramAreaCodeID == val); } } matches = matches.Where(inner_predicate_area); } catch {; } } //1.Area Append. if (period != null && period.Count > 0) { try { var inner_predicate_period = PredicateBuilder.False <Project>(); foreach (string item in period) { if (item != "All") //we don't wanna convert All into Int. { int val = Convert.ToInt32(item); inner_predicate_period = inner_predicate_period.Or(a => a.ProjectInfo.ClosedDate != null && a.ProjectInfo.ClosedDate.Value.Year == val); } } matches = matches.Where(inner_predicate_period); } catch {; } } //2. GrantType Append ...? if (gtype != null && gtype.Count > 0 && !gtype.Contains("All")) { try { var inner_predicate_gtype = PredicateBuilder.False <Project>(); foreach (string item in gtype) { int val = Convert.ToInt32(item); inner_predicate_gtype = inner_predicate_gtype.Or(a => a.GrantType.GrantTypeCodeID == val); } matches = matches.Where(inner_predicate_gtype); } catch {; } } //3. Competition Code: compete if (compete != null && compete.Count > 0 && !compete.Contains("All")) { try { var inner_predicate_compete = PredicateBuilder.False <Project>(); foreach (string item in compete) { int val = Convert.ToInt32(item); inner_predicate_compete = inner_predicate_compete.Or(a => a.CompetitionCode.CompetCodeID == val); } matches = matches.Where(inner_predicate_compete); } catch {; } } if (status != null && status.Count > 0 && !status.Contains("All")) { var inner_predicate_status = PredicateBuilder.False <Project>(); foreach (string item in status) { int val = Convert.ToInt32(item); inner_predicate_status = inner_predicate_status.Or(a => a.ProposalStatus.PropStatusID == val); } matches = matches.Where(inner_predicate_status); //This Ands All Ors. // outer_predicate = outer_predicate.And(inner_predicate_status); //accumulate this inner. } //remove the Deleted Project From Reports: matches = matches.Where(a => a.isDeleted.Value.Equals(null)); //return db.Projects.Where(predicate); // matches = matches.Where(outer_predicate); // List<Project> pr = matches.ToList(); return(matches); }
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)); }
// 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 Dictionary <IndicatorContainerType, Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> > > IndicatorReportCore( IQueryable <Project> prjList, FinReportFilter frepf, 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(); List <IndicatorLabelContentCategory> IndContCats = new List <IndicatorLabelContentCategory>(); var regions = new List <RegionList>(); var areas = new List <ProgramAreaList>(); var statusList = new List <ProposalStatusList>(); var gtypeList = new List <GrantTypeList>(); var competeList = new List <CompetitionCodeList>(); //create IndicatorContentCategory List to be passed. if (indicatorcategory != null) { foreach (string s in indicatorcategory) { IndContCats.Add(ServiceDDL.GetIndicatorLabelContentCategory(Convert.ToInt32(s))); } } var LLVsContainer = new Dictionary <IndicatorContainerType, Dictionary <IndicatorLabelContentCategory, List <IndicatorRepContainer> > >(); // Dictionary<ContainerType, List<VsContainer>> LLVsContainer = null; if (oblast != null && oblast.Count > 0 && indicatorcategory != null && indicatorcategory.Count > 0) { //create RegionsList List to be passed. foreach (string s in oblast) { if (!s.Contains("All")) //skip ALL. { regions.Add(ServiceDDL.GetRegionList().FirstOrDefault(w => w.DDID == Convert.ToInt32(s))); } } var result = FillContainer(prjList, frepf, IndicatorContainerType.OblastVsIndicatorLabelCategory, IndContCats, regions, null, null, null); LLVsContainer.Add(IndicatorContainerType.OblastVsIndicatorLabelCategory, result); } if (Area != null && Area.Count > 0 && indicatorcategory != null && indicatorcategory.Count > 0) { foreach (string s in Area) { if (!s.Contains("All")) //skip ALL. { areas.Add(ServiceDDL.GetProgramAreaList().FirstOrDefault(w => w.ProgramAreaCodeID == Convert.ToInt32(s))); } } var result = FillContainer(prjList, frepf, IndicatorContainerType.AreaVsIndicatorLabelCategory, IndContCats, null, areas, null, null); LLVsContainer.Add(IndicatorContainerType.AreaVsIndicatorLabelCategory, result); } if (gtype != null && gtype.Count > 0 && indicatorcategory != null && indicatorcategory.Count > 0) { foreach (string s in gtype) { if (!s.Contains("All")) //skip ALL. { gtypeList.Add(ServiceDDL.GetGrantTypeList().FirstOrDefault(w => w.GrantTypeCodeID == Convert.ToInt32(s))); } } var result = FillContainer(prjList, frepf, IndicatorContainerType.TypeVsIndicatorLabelCategory, IndContCats, null, null, gtypeList, null); LLVsContainer.Add(IndicatorContainerType.TypeVsIndicatorLabelCategory, result); } if (compete != null && compete.Count > 0 && indicatorcategory != null && indicatorcategory.Count > 0) { foreach (string s in compete) { if (!s.Contains("All")) //skip ALL. { competeList.Add(ServiceDDL.GetCompetitionCodeList().FirstOrDefault(w => w.CompetitionCodeID == Convert.ToInt32(s))); } } var result = FillContainer(prjList, frepf, IndicatorContainerType.RoundVsIndicatorLabelCategory, IndContCats, null, null, null, competeList); LLVsContainer.Add(IndicatorContainerType.RoundVsIndicatorLabelCategory, result); } bool areaVsRound = false; //more coming here. return(LLVsContainer); }
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); }
////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, Dictionary <AmountTypes, List <VsContainer> > > FinReportCore(IQueryable <Project> prjList, FinReportFilter frepf, List <String> Area, List <String> gtype, List <String> compete, List <String> status, List <String> period, List <String> region) { //we have 7 Type of Amounts: from frepf. //InitialRequestedAmount =1 //AwardedAmount =2 //AllTransfered =3 //UsedAmount =4 //UnUsedAmount =5 //CashOnHand = 6 //Refund = 7 //Cancellation = 8 //Check if result has values found for every requested FIELD1, FIELD2 combination, //if it does not then then insert into List ghost project with 0 values. //Updated list will be called result2!! //WHY???? Because my stupid table view generation is getting messed up if one of the fields don't present. //I think this must be done before doAreaVsType called. Must be static function that populates existing result list with ghost projects. // IQueryable<Project> prjFullList = FullFillList(prjList); //to identify 6 cases, defaulting false. we use above controls. Not prjList. Dictionary <string, List <Rc> > RepCollection = new Dictionary <string, List <Rc> >(); var LLVsContainer = new Dictionary <ContainerType, Dictionary <AmountTypes, List <VsContainer> > >(); // Dictionary<ContainerType, List<VsContainer>> LLVsContainer = null; if (Area != null && Area.Count > 0 && gtype != null && gtype.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.AreaVsType, LLVsContainer); } if (Area != null && Area.Count > 0 && compete != null && compete.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.AreaVsRound, LLVsContainer); } if (Area != null && Area.Count > 0 && status != null && status.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.AreaVsStatus, LLVsContainer); } if (gtype != null && gtype.Count > 0 && compete != null && compete.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.TypeVsRound, LLVsContainer); } if (gtype != null && gtype.Count > 0 && status != null && status.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.TypeVsStatus, LLVsContainer); } if (compete != null && compete.Count > 0 && status != null && status.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.RoundVsStatus, LLVsContainer); } if (compete != null && compete.Count > 0 && region != null && region.Count > 0) { LLVsContainer = FillContainer(prjList, frepf, ContainerType.RoundVsRegion, LLVsContainer); } if (gtype != null && gtype.Count > 0 && region != null && region.Count > 0) //TypeVsRegion { LLVsContainer = FillContainer(prjList, frepf, ContainerType.TypeVsRegion, LLVsContainer); } if (Area != null && Area.Count > 0 && region != null && region.Count > 0) //AreaVsRegion { LLVsContainer = FillContainer(prjList, frepf, ContainerType.AreaVsRegion, LLVsContainer); } // bool areaVsRound = false; //more coming here. 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)); }
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); }
////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); }
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()); }