Exemple #1
0
        /// <summary>
        /// Build list of statuses
        /// </summary>
        private void BindStatus()
        {
            if (ptProtocol != null)
            {
                int      patProtocolId       = (int)ptProtocol[PatientProtocol.PatientProtocolId];
                bool?    isEligible          = PatientProtocolController.IsPatientEligible(patProtocolId);
                string   ptEligibilityStatus = PatientProtocolController.PatientEligiblityString(isEligible);
                string[] eligibilityStatuses = new string[] { PatientProtocolController.Eligible, PatientProtocolController.Ineligible };
                // get all statuses for patient
                IEnumerable <PatientProtocolStatus> patientStatuses = BusinessObject.GetByParent <PatientProtocolStatus>(patProtocolId);
                // explicitly sort statuses by date then weight, (get status weight by location in list)
                string[] statusSequence        = PatientProtocolController.PatientStatusSequence;
                var      sortedPatientStatuses = from biz in patientStatuses
                                                 let status = biz[PatientProtocolStatus.PtProtocolStatus].ToString()
                                                              let weight                       = Array.IndexOf(statusSequence, status)
                                                                                      let date = biz.IsNull(PatientProtocolStatus.PtProtocolStatusDate) ? DateTime.MinValue : (DateTime)biz[PatientProtocolStatus.PtProtocolStatusDate]
                                                                                                 orderby weight ascending, date ascending
                let ptProtocolStatus = string.Format("{0}", biz[PatientProtocolStatus.PtProtocolStatus])
                                       select new
                {
                    PatientProtocolStatusId = string.Format("{0}", biz[PatientProtocolStatus.PatientProtocolStatusId]),
                    PtProtocolStatusDate    = string.Format("{0:d}", biz[PatientProtocolStatus.PtProtocolStatusDate]),
                    PtProtocolStatus        = eligibilityStatuses.Contains(ptProtocolStatus) ? ptProtocolStatus + " (" + ptEligibilityStatus + ")" : ptProtocolStatus,
                    PtProtocolStatusReason  = string.Format("{0}", biz[PatientProtocolStatus.PtProtocolStatusReason])
                };

                // build list
                PatientProtocolStatusRptr.DataSource = sortedPatientStatuses;
                PatientProtocolStatusRptr.DataBind();
            }
        }
        /// <summary>
        /// Builds the patient questionnaire
        /// </summary>
        private void BuildPatientEligibility()
        {
            int  ptProtocolId = int.Parse(PatientProtocolId);
            bool canEnterData = true;

            if (registrationId.HasValue)
            {
                if (!metaSurveyId.HasValue && !registrationId.HasValue)
                {
                    canEnterData = false;
                }
                else
                {
                    DataView questionsView = ProtocolMgmtDa.GetPatientQuestionnaire(metaSurveyId, registrationId).DefaultView;
                    PatientEligibilityGrid.DataSource = questionsView;
                    PatientEligibilityGrid.DataBind();

                    canEnterData = questionsView.Count > 0;
                }
            }

            // Update UI elements based on user being able to enter data
            CoverLayer.Visible = !canEnterData;
            UpdateBtn.Visible  = canEnterData;

            // display Eligibility status
            EligibilityStatus.Visible = true;

            // determine eligibility
            if (metaSurveyId.HasValue && registrationId.HasValue)
            {
                bool?  eligible       = PatientProtocolController.IsPatientEligible(ptProtocolId, metaSurveyId.Value, registrationId.Value);
                string eligibleString = PatientProtocolController.PatientEligiblityString(eligible);
                EligibilityStatus.Text = eligibleString;
            }
            else
            {
                EligibilityStatus.Text = "Not Completed";
            }
        }