public SurveyResponseItem GetSurvey(int responseId) { SurveyResponseItem item = new SurveyResponseItem(); using (hpsDB db = new hpsDB()) { // get general response var general = db.SingleOrDefault <SurveyResponse_General>(SurveyResponseItemSql, responseId); item.GeneralResponse = general; // get active plans with RxPlan var responseActivePlans = db.Fetch <SurveyResponse_ActivePlan>(SurveyResponse_ActivePlanSql, responseId); foreach (SurveyResponse_ActivePlan plan in responseActivePlans) { // get RxPlan for each active plan var rxPlan = db.SingleOrDefault <SurveyResponse_RxPlan>(SurveyResponse_RxPlanSql, plan.ActivePlanId); var rxTiers = db.Fetch <SurveyResponse_RxPlanTier>(SurveyResponse_RxPlanTierSql, plan.ActivePlanId); var surveyRxPlan = new SurveyRxPlan(rxPlan, rxTiers); // create new SurveyActivePlan(plan, rxPlan) var surveyActivePlan = new SurveyActivePlan(plan, surveyRxPlan); item.ActivePlans.Add(surveyActivePlan); } // get retiree plan var retiree = db.SingleOrDefault <SurveyResponse_RetireePlan>(SurveyResponse_RetireePlanSql, responseId); item.RetireePlan = retiree; // get section125 var section125 = db.SingleOrDefault <SurveyResponse_Section125>(SurveyResponse_Section125Sql, responseId); } return(item); }
//Get the paginated list of surveys for a partner firm. public IEnumerable <SurveySummaryModel> GetSurveyListData() { //TODO //TODO: convert this to use pagination IEnumerable <SurveySummaryModel> t; using (hpsDB db = new hpsDB()) { var result = db.Fetch <SurveySummaryModel>(SurveyListSql); t = result; } return(t); }