protected void getLastSurvey()
        {
            DataTable dt = da.GetMostRecentSurveyWithItemsByType(this.patientID, "%Kidney QOL%");

            if (dt.Rows.Count > 0)
            {
                DataView dv = dt.DefaultView;
                dv.Sort = SurveyItem.SurveyItemId;
                SurveyResponsesRepeater.DataSource = dv;
                SurveyResponsesRepeater.DataBind();

                LastSurveyTitle.Text = "Most Recent Survey: " + dv[0][BOL.Survey.SurveyDateText].ToString();


                if (!string.IsNullOrEmpty(dv[0][BOL.Survey.SurveyDate].ToString()))
                {
                    DateTime d = (DateTime)dv[0][BOL.Survey.SurveyDate];
                    string   t = TimeSpanLongString(d, DateTime.Now);
                    if (t.Length > 0)
                    {
                        LastSurveyTitle.Text += " (" + t + " ago)";
                    }
                }

                NoSurveyMsg.Visible = false;
            }
        }
Example #2
0
        void DisplayLatestSurveyResponses(DataTable surveys)
        {
            IDictionary <KeyValuePair <string, string>, string> map = SurveyDa.GetSurveyItemResponseMap(ActiveSurveillanceSurvey.ShortName);

            Func <string, string, string, string> getResponse =
                (text, num, result) =>
            {
                KeyValuePair <string, string> kvp =
                    new KeyValuePair <string, string>(text, result);

                KeyValuePair <string, string> numKVP =
                    new KeyValuePair <string, string>(num, result);

                if (map.ContainsKey(kvp))
                {
                    return(map[kvp]);
                }
                else if (map.ContainsKey(numKVP))
                {
                    return(map[numKVP]);
                }
                else
                {
                    return(result);
                }
            };

            DataView sv = surveys.DefaultView;

            sv.Sort = "SurveyDate DESC, SurveyId DESC";

            if (sv.Count == 0)
            {
                return;
            }

            int latestSurveyId = (int)sv[0]["SurveyId"];

            var ds =
                from row in surveys.AsEnumerable()
                let surveyId = (int)row["SurveyId"]
                               let itemNum                       = row["SurveyItemNum"].ToString()
                                                        let text = row["SurveyItem"].ToString()
                                                                   where surveyId == latestSurveyId &&
                                                                   !text.StartsWith("Total", StringComparison.CurrentCultureIgnoreCase) &&
                                                                   !text.StartsWith("Patient reported", StringComparison.CurrentCultureIgnoreCase)
                                                                   select new
            {
                QuestionNum    = itemNum,
                QuestionText   = text,
                QuestionResult = getResponse(text, itemNum, row["SurveyItemResult"].ToString())
            };

            SurveyResponsesRepeater.DataSource = ds;
            SurveyResponsesRepeater.DataBind();
        }
Example #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (patientHadRP)
            {
                AlertRepeater.DataBind();

                if (showErectileChart)
                {
                    EFChart.DataBind();
                }
                else
                {
                    EFChart.Visible = false;
                }

                if (showUrinaryChart)
                {
                    UFChart.DataBind();
                }
                else
                {
                    UFChart.Visible = false;
                }

                if (showSurveyResponses)
                {
                    SurveyResponsesRepeater.DataBind();
                }

                // suppress 2nd page via query string
                if (DisplayPageNumbers.Length > 0 && !DisplayPageNumbers.Contains(2))
                {
                    LastPageInForm.Visible = false;
                }
            }
            else
            {
                if (this.Parent.ClientID.ToUpper().Contains("QOLREPORTHOLDER"))
                {
                    this.Visible = false;  // just hide this whole form if it's included in a packet via a placeholder called QOLReportHolder
                }
                else
                {
                    FirstPage.Visible          = false;
                    reportTable2.Visible       = false;
                    NoRPErrorContainer.Visible = true;

                    ErrorPatientName.Text = PatientDisplayName;
                    ErrorPatientMRN.Text  = PatientMRN;
                    ErrorTodaysDate.Text  = DateTime.Now.ToLongDateString();
                }
            }
        }