private IEnumerable <int> Subspecialty(int proKey) { if (subsByPractice.ContainsKey(proKey)) { return(subsByPractice[proKey].RandomSubset()); } var query = $"Select SubSpecialty from provider.PracticeSubSpecialty s join provider.PracticeLocation p on s.Practice = p.Practice where p.PracticeLocationKey={proKey}"; SqlCommand cmd = new SqlCommand(query, conn, transaction); using (var rs = cmd.ExecuteReader()) { List <int> subs = new List <int>(); while (rs.Read()) { var spe = (int)rs.GetSqlInt32(0); subs.Add(spe); } rs.Close(); ContentIterator c = new ContentIterator(subs); subsByPractice.Add(proKey, c); return(c.RandomSubset()); } }
private IEnumerable <int> PractitionerPayerPlans(string strZip) { int zip = 0; if (!int.TryParse(strZip, out zip)) { throw new InvalidCastException(); } if (plansByZip.ContainsKey(zip)) { return(plansByZip[zip].RandomSubset(33)); } var query = $"Select PayerPlan from geo.ZipCodePayerPlan where ZipCode='{zip}'"; SqlCommand cmd = new SqlCommand(query, conn, transaction); using (var rs = cmd.ExecuteReader()) { List <int> plans = new List <int>(); while (rs.Read()) { var plan = (int)rs.GetSqlInt32(0); plans.Add(plan); } rs.Close(); ContentIterator c = new ContentIterator(plans); plansByZip.Add(zip, c); return(c.RandomSubset(33)); } }