public string ResolveProgramId(CoverageProfession p, Dictionary <string, string> idmap) { if (idmap.ContainsKey(p.Profession)) { return(idmap[p.Profession]); } else { return(p.ProgramId); } }
// // GET: /Coverage/ public ActionResult Undergrad() { //Load coverage file List <CoverageProgramResult> coverage = new List <CoverageProgramResult>(); using (StreamReader sr = new StreamReader(@"c:\chaindate\skillcow\coverage.csv")) { string line = sr.ReadLine(); //Skip header line = sr.ReadLine(); while (line != null) { List <string> tokens = ParseCSV(line); CoverageProgramResult result = new CoverageProgramResult(tokens); if (result.DegreeLevel == "Undergrad") { coverage.Add(result); } line = sr.ReadLine(); } } ViewBag.Coverage = coverage; //Load professions List <CoverageProfession> professions = new List <CoverageProfession>(); using (StreamReader sr = new StreamReader(@"c:\chaindate\Professions.csv")) { string line = sr.ReadLine(); //Skip header line = sr.ReadLine(); while (line != null) { List <string> tokens = ParseCSV(line); CoverageProfession p = new CoverageProfession(tokens); /* * CoverageProgramResult oneresult = p.OriginalProgramResults.FirstOrDefault(); * * if (oneresult != null) * { * p.OriginalProgramSuggestions = new List<CoverageProgramResult>(coverage.Where(x => x.ParentId==oneresult.ParentId && x.ProgramId != p.ProgramId)); * } * */ //p.NewProgramResults = new List<CoverageProgramResult>(coverage.Where(x => x.ProgramId == p.NewProgramId)); /* * oneresult = p.NewProgramResults.FirstOrDefault(); * if (oneresult != null) * { * p.NewProgramSuggestions = new List<CoverageProgramResult>(coverage.Where(x => x.ParentId == oneresult.ParentId && x.ProgramId != p.NewProgramId)); * } */ professions.Add(p); line = sr.ReadLine(); } } ViewBag.Controller = this; return(View(professions)); }