/// <summary> /// /// </summary> /// <param name="surveyId"></param> private void BindScoringResults(int surveyId) { DataTable scoresDt = SurveyScoringUtil.FillScores(surveyId); if (scoresDt.Rows.Count > 0) { ScoresPanel.Visible = true; SurveyScoresRptr.DataSource = scoresDt.DefaultView; SurveyScoresRptr.DataBind(); } }
/// <summary> /// /// </summary> /// <returns></returns> private DataView GetReport() { DateTime startDate = !string.IsNullOrEmpty(StartDateField.Value) ? DateTime.Parse(StartDateField.Value) : DateTime.Today; DateTime endDate = !string.IsNullOrEmpty(EndDateField.Value) ? DateTime.Parse(EndDateField.Value) : DateTime.Today; string surveyType = ddlSurveyType.SelectedValue + "%"; FollowUpDA da = new FollowUpDA(); DataTable dt = da.GetCompletedSurveysByType(startDate.ToShortDateString(), endDate.ToShortDateString(), surveyType); DataTable myTable = new DataTable(); string[] colNames = new string[] { "MRN", "Patient Name", "SurveyId", "Survey", "Month", "Sent Date", "Received Date" }; foreach (string colName in colNames) { myTable.Columns.Add(new DataColumn(colName)); } // get the names of the scoring sections for the column names from the first survey returned if (dt.Rows.Count > 0) { int surveyId = (int)dt.Rows[0][Survey.SurveyId]; DataTable scoreDt1 = SurveyScoringUtil.FillScores(surveyId); foreach (DataRow dr1 in scoreDt1.Rows) { myTable.Columns.Add(new DataColumn(dr1["Section"].ToString())); } } foreach (DataRow dr in dt.Rows) { DataRow newRow = myTable.NewRow(); string ptName = dr[Patient.PtFirstName].ToString() + " " + dr[Patient.PtMiddleName].ToString() + " " + dr[Patient.PtLastName].ToString(); int surveyId = int.Parse(dr[Survey.SurveyId].ToString()); // get table with scores DataTable scoreDt2 = new DataTable(); scoreDt2 = SurveyScoringUtil.FillScores(surveyId); newRow["MRN"] = dr[Patient.PtMRN].ToString(); newRow["Patient Name"] = ptName; newRow["SurveyId"] = dr[Survey.SurveyId].ToString(); newRow["Survey"] = dr[Survey.SurveyType].ToString(); string actionItemStr = dr[Caisis.BOL.Action.ActionItem].ToString(); string surveyMonth = FollowUpUtil.GetSurveyMonthNoFromActionItem(actionItemStr); newRow["Month"] = surveyMonth; newRow["Sent Date"] = DateTime.Parse(dr[Caisis.BOL.Action.ActionDate].ToString()).ToShortDateString(); newRow["Received Date"] = DateTime.Parse(dr[Survey.SurveyDate].ToString()).ToShortDateString(); // translate the scores that are in rows to columns in this patients record for (int i = 0; i < scoreDt2.Rows.Count; i++) { int columnIndex = i + 7; newRow[columnIndex] = scoreDt2.Rows[i]["AverageStandardized"].ToString(); } myTable.Rows.Add(newRow); } return(myTable.DefaultView); }