Ejemplo n.º 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Form.Attributes["onsubmit"] = "return(DoSubmitConsentsBySubject(event));";
            oDBLookup = new DBLookup();

            int           nSubjID;
            int           nStudyID;
            SqlCommand    oCmd = new SqlCommand();
            SqlDataReader oReader;
            HtmlTableRow  oTr;
            HtmlTableCell oTd;
            HtmlTableCell tdConsentItems = new HtmlTableCell();
            bool          bDoDark        = false;
            string        sCFVID         = "";
            int           nCount         = 0;
            DateTime      itemdate       = new DateTime();
            string        n = "";

            if (IsPostBack)
            {
                nSubjID = Convert.ToInt32(oDBLookup.GetSubjIDFromID(Request["txtID"].ToString(), Convert.ToInt32(Request["selStudyID"].ToString())));
            }
            else
            {
                nSubjID = Convert.ToInt32(Request["SubjectID"].ToString());
            }

            nStudyID          = oDBLookup.GetStudyIDBySubjID(nSubjID);
            hidSubjID.Value   = nSubjID.ToString();
            hidStudyID.Value  = nStudyID.ToString();
            tdTitle.InnerHtml = "Consent Forms for " + oDBLookup.GetIDBySubjID(nSubjID, true);

            #region Get Info From db
            oCmd.Connection     = Master.SqlConn;
            oCmd.CommandTimeout = 90;
            oCmd.CommandType    = CommandType.StoredProcedure;
            oCmd.CommandText    = "spGetConsentFormsBySubjID2";

            oCmd.Parameters.Add(new SqlParameter("@SubjID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Default, nSubjID));

            oReader = oCmd.ExecuteReader();
            #endregion

            while (oReader.Read())
            {
                #region Display Data Items
                if (sCFVID != oReader["ConsentFormVersionID"].ToString())
                {
                    oTr = new HtmlTableRow();
                    oTr.Attributes["onclick"] = "HighlightRow(this); HighlightRow(document.getElementById('tr" + oReader["SubjConsentID"].ToString() + "'));";
                    if (bDoDark)
                    {
                        oTr.Attributes["class"] = "trDark";
                    }

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = "<input type=\"checkbox\" name=\"chkConsentToEdit\" id=\"chkConsentToEdit" + oReader["SubjConsentID"].ToString() + "\" value=\"" + oReader["SubjConsentID"].ToString() + "\" />";
                    oTr.Cells.Add(oTd);

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = "<a href=\"" + Request.ApplicationPath + "/Measures/EditConsentForm.aspx?SubjConsentID=" + oReader["SubjConsentID"].ToString() + "\">" + oFormat.FormatDBOutput(oReader["ConsentFormName"].ToString()) + "</a>";
                    if (oReader["Notes"].ToString() != "")
                    {
                        oTd.InnerHtml += " <a href=\"javascript:ShowTableRow('tr" + oReader["SubjConsentID"].ToString() + "');\" class=\"smalltext\">(Notes)</a>";
                    }
                    oTr.Cells.Add(oTd);

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = oFormat.FormatDBOutput(oReader["Version"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = oFormat.FormatDBOutput(oReader["ConsentApproved"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = oFormat.FormatDBOutput(oReader["DateSigned"].ToString()) + " " + oFormat.FormatDBOutput(oReader["TimeSigned"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd = new HtmlTableCell();
                    oTd.EnableViewState = false;
                    oTd.InnerHtml       = oFormat.FormatDBOutput(oReader["ConsentStatusShort"].ToString());
                    oTr.Cells.Add(oTd);

                    tdConsentItems = new HtmlTableCell();
                    tdConsentItems.EnableViewState = false;

                    //if (oReader["IsConsented"].ToString() == "1")
                    //    tdConsentItems.InnerHtml = "<span style=\"color: #008800;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";
                    //else
                    //    tdConsentItems.InnerHtml = "<span style=\"color: #ff0000;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";

                    string s = oReader["ConsentItemText"].ToString() + " " + oReader["optiontext"].ToString() + " ";
                    if (DateTime.TryParse(oReader["ItemDateSigned"].ToString(), out itemdate))
                    {
                        s = s + itemdate.ToString("MM/dd/yyyy");
                    }
                    s = s + " " + oReader["ItemTimeSigned"].ToString();
                    n = oReader["SubjConsentItemNotes"].ToString();
                    if (n.Trim() != "")
                    {
                        s = s + "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + n;
                    }
                    if (s.Trim() == "")
                    {
                        s = "&nbsp;";                 //hack to fix missing border around empty table cell
                    }
                    tdConsentItems.InnerHtml = s;

                    oTr.Cells.Add(tdConsentItems);

                    tblMaster.Rows.Insert(tblMaster.Rows.Count - 2, oTr);

                    if (oReader["Notes"].ToString() != "")
                    {
                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.EnableViewState = false;
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }
                        oTr.Style["display"] = "none";
                        oTr.Attributes["id"] = "tr" + oReader["SubjConsentID"].ToString();
                        oTd.ColSpan          = 7;
                        oTd.InnerHtml        = oReader["Notes"].ToString();
                        oTr.Cells.Add(oTd);
                        tblMaster.Rows.Insert(tblMaster.Rows.Count - 2, oTr);
                    }

                    bDoDark = !bDoDark;
                    nCount++;
                    sCFVID = oReader["ConsentFormVersionID"].ToString();
                }
                else
                {
                    tdConsentItems.InnerHtml += "<br/>" + oReader["ConsentItemText"].ToString() + " " + oReader["optiontext"].ToString() + " ";
                    if (DateTime.TryParse(oReader["ItemDateSigned"].ToString(), out itemdate))
                    {
                        tdConsentItems.InnerHtml += itemdate.ToString("MM/dd/yyyy");
                    }
                    tdConsentItems.InnerHtml += " " + oReader["ItemTimeSigned"].ToString();
                    n = oReader["SubjConsentItemNotes"].ToString();
                    if (n.Trim() != "")
                    {
                        tdConsentItems.InnerHtml += "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + n;
                    }
                }
                #endregion
            }

            oReader.Close();

            tdTitle.InnerHtml += "<br/><div class=\"DoNotPrint\" style=\"font-size: 8pt;\">";
            tdTitle.InnerHtml += "<a href=\"" + Request.ApplicationPath + "/Measures/ActionsBySubject.aspx?SubjectID=" + nSubjID.ToString() + "\">View Actions</a>";
            tdTitle.InnerHtml += " | <a href=\"" + Request.ApplicationPath + "/Measures/MeasuresBySubject.aspx?SubjectID=" + nSubjID.ToString() + "\">View Measures</a>";
            tdTitle.InnerHtml += " | <a href=\"" + Request.ApplicationPath + "/Household/ViewHousehold.aspx?HouseholdID=" + oDBLookup.GetHouseholdIDBySubjID(nSubjID) + "\">View Household</a><br/>";
            tdTitle.InnerHtml += oDBLookup.BindDropDownList("selStudyID", "EXEC spGetActiveStudies", "StudyName", "StudyID", oDBLookup.GetStudyIDBySubjID(nSubjID).ToString(), "--Study--", "font-size: 7pt;");
            tdTitle.InnerHtml += "<input type=\"text\" name=\"txtID\" value=\"" + oDBLookup.GetIDBySubjID(nSubjID) + "\" style=\"font-size: 7pt; width: 50px;\" />";
            tdTitle.InnerHtml += "<input type=\"submit\" name=\"btnSubmit\" value=\"Update\" style=\"font-size: 7pt;\" />";
            tdTitle.InnerHtml += "</div>";

            tdTitle.InnerHtml += "<span class=\"verysmalltext\">" + DateTime.Now.ToString("MM/dd/yyyy hh:mm tt") + " - " + nCount.ToString() + " Records</span>";
        }
Ejemplo n.º 2
0
		private void DisplayHousehold(int nHouseholdID)
		{
			oDBLookup = new DBLookup();
		
			HtmlTableRow oTr;
			HtmlTableCell oTd;

			SqlCommand oCmd = new SqlCommand();
			oCmd.Connection = Master.SqlConn;
			oCmd.CommandTimeout = 90;
			oCmd.CommandType = CommandType.StoredProcedure;
			oCmd.CommandText = "spGetPedigreeByHouseholdID";
			oCmd.Parameters.AddWithValue("@HouseholdID", nHouseholdID);

			SqlDataReader oReader = oCmd.ExecuteReader();

			if (oReader.HasRows)
			{
				while (oReader.Read())
				{
					oTr = new HtmlTableRow();

					oTd = new HtmlTableCell();
					oTd.Style["border-bottom"] = "solid 1px #26044a";
					oTd.InnerHtml = oFormat.FormatDBOutput(oReader["FullName"].ToString());
					oTd.InnerHtml += " (" + oFormat.FormatDBOutput(oReader["ID"].ToString());
					if (oReader["PersonRole"].ToString() != "") {oTd.InnerHtml += "/" + oFormat.FormatDBOutput(oReader["PersonRole"].ToString());}
					oTd.InnerHtml += ")";
					oTr.Cells.Add(oTd);

					oTd = new HtmlTableCell();
					oTd.Style["border-bottom"] = "solid 1px #26044a";
					oTd.InnerHtml += "<input type=\"text\" name=\"txtBloodID\" id=\"txtBloodID" + oReader["BloodID"].ToString() + "\" value=\"" + oReader["BloodID"].ToString() + "\" />";
					oTr.Cells.Add(oTd);

					oTd = new HtmlTableCell();
					oTd.Style["border-bottom"] = "solid 1px #26044a";
					oTd.InnerHtml += "<input type=\"text\" name=\"txtPedigree\" id=\"txtPedigree" + oReader["PersonID"].ToString() + "\" value=\"" + oReader["Pedigree"].ToString() + "\" />";
					oTr.Cells.Add(oTd);

					oTd = new HtmlTableCell();
					oTd.Style["border-bottom"] = "solid 1px #26044a";
					oTd.InnerHtml += oDBLookup.BindDropDownList("selBloodSourceID", Convert.ToInt32(oReader["PersonID"]), "EXEC spGetBloodSources", "BloodSource", "BloodSourceID", oReader["BloodSourceID"].ToString(), "--Select Blood Source--", "width: 200px;");
					oTd.InnerHtml += "<input type=\"hidden\" name=\"hidPersonID\" value=\"" + oReader["PersonID"].ToString() + "\" />";
					oTr.Cells.Add(oTd);

					tblMaster.Rows.Insert(tblMaster.Rows.Count-1, oTr);
				}
			}
			else
			{
				oTr = new HtmlTableRow();
				oTd = new HtmlTableCell();
				oTd.InnerHtml = "No one in this household is not enrolled in the Family Study of Autism. ";
				oTd.InnerHtml += "This page is only intended for subjects with at least one family member enrolled in that study.";
				oTr.Cells.Add(oTd);
				tblMaster.Rows.Insert(tblMaster.Rows.Count-1, oTr);

				btnReturn.Style["display"] = "none";
				btnSaveChanges.Style["display"] = "none";
			}

			oReader.Close();
		}
Ejemplo n.º 3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int           nHouseholdID = Convert.ToInt32(Request["HouseholdID"].ToString());
            int           nStudyID     = -1;
            string        sPersonID    = "0";
            string        sStudyID     = "0";
            SqlDataReader oReader;
            HtmlTableRow  oTr;
            HtmlTableCell oTd;
            bool          bDoDark = false;

            if (Request["StudyID"] != null)
            {
                nStudyID = Convert.ToInt32(Request["StudyID"].ToString());
            }

            oReader = GetActionsByHousehold(nHouseholdID, nStudyID);

            if (oReader.HasRows)
            {
                while (oReader.Read())
                {
                    if (sPersonID != oReader["PersonID"].ToString())
                    {
                        #region Display a Header for Each Person
                        sPersonID = oReader["PersonID"].ToString();
                        sStudyID  = "";

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTr.Attributes["class"] = "trHeader";
                        oTd.ColSpan             = 7;
                        oTd.Style["font-size"]  = "14pt";
                        oTd.InnerHtml           = oReader["FullName"].ToString();
                        oTr.Cells.Add(oTd);
                        tblMaster.Rows.Add(oTr);
                        #endregion
                    }

                    if (sStudyID != oReader["StudyID"].ToString())
                    {
                        #region Display a Header for Each Study the Person is in
                        sStudyID = oReader["StudyID"].ToString();

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTr.Attributes["class"] = "trHeaderAlt";
                        oTd.ColSpan             = 7;
                        oTd.Style["text-align"] = "center";
                        oTd.InnerHtml           = oReader["StudyName"].ToString() + " - " + oReader["ID"].ToString() + " (" + oReader["GroupName"].ToString() + " - " + oReader["SubjStatus"].ToString() + ")";
                        oTr.Cells.Add(oTd);
                        tblMaster.Rows.Add(oTr);
                        #endregion

                        #region Display a Header for Each Column
                        oTr = new HtmlTableRow();

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.InnerHtml = "&nbsp;";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Action";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Action Type";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Status";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Lab";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Date Done";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["background-color"] = "#e6ecf5";
                        oTd.Style["font-weight"]      = "bold";
                        oTd.InnerHtml = "Staff";
                        oTr.Cells.Add(oTd);

                        tblMaster.Rows.Add(oTr);
                        #endregion

                        bDoDark = false;
                    }

                    #region Display the Actions
                    oTr = new HtmlTableRow();
                    if (bDoDark)
                    {
                        oTr.Attributes["class"] = "trDark";
                    }
                    oTr.Attributes["onclick"] = "HighlightRow(this);";

                    oTd = new HtmlTableCell();
                    oTd.Style["text-align"] = "center";

                    if (Convert.ToBoolean(oReader["CanEditMultiple"]))
                    {
                        oTd.InnerHtml = "<input type=\"checkbox\" name=\"chkActionIDs\" value=\"" + oReader["ActionID"].ToString() + "\" id=\"chkActionID" + oReader["ActionID"].ToString() + "\" />";
                    }
                    else
                    {
                        oTd.InnerHtml = "&nbsp;";
                    }

                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "<a href=\"" + Request.ApplicationPath + "/Measures/EditAction.aspx?ActionID=" + oReader["ActionID"].ToString() + "\">" + oFormatter.FormatDBOutput(oReader["ActionText"].ToString()) + "</a>";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormatter.FormatDBOutput(oReader["ActionType"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormatter.FormatDBOutput(oReader["ActionStatus"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormatter.FormatDBOutput(oReader["LabName"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormatter.FormatDBOutput(oReader["DateDone"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormatter.FormatDBOutput(oReader["Staff"].ToString());
                    oTr.Cells.Add(oTd);

                    tblMaster.Rows.Add(oTr);
                    #endregion

                    bDoDark = !bDoDark;
                }
            }
            else
            {
                tblMaster.Attributes["class"]   = "";
                btnCompleteAll.Style["display"] = "none";

                oTr           = new HtmlTableRow();
                oTd           = new HtmlTableCell();
                oTd.InnerHtml = "There are no Actions for this Household. <a href=\"" + Request.ApplicationPath + "/Household/ViewHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\">Return to View Household page.</a>";
                oTr.Cells.Add(oTd);
                tblMaster.Rows.Add(oTr);
            }
        }
Ejemplo n.º 4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            oDBLookup = new DBLookup(Master.SqlConn);

            int           nConsentFormID = Convert.ToInt32(Request["ConsentFormID"].ToString());
            SqlCommand    oCmd           = new SqlCommand();
            SqlDataReader oReader;
            HtmlTableRow  oTr;
            HtmlTableCell oTd;
            HtmlTableCell tdConsentItems = new HtmlTableCell();
            bool          bDoDark        = false;
            string        sSubjID        = "";
            string        sCFVID         = "";

            tdTitle.InnerHtml = oDBLookup.GetConsentFormNameByConsentFormID(nConsentFormID);

            #region Get Info From db
            oCmd.Connection     = Master.SqlConn;
            oCmd.CommandTimeout = 90;
            oCmd.CommandType    = CommandType.StoredProcedure;
            oCmd.CommandText    = "spGetSubjConsentsByConsentFormID2";

            oCmd.Parameters.Add(new SqlParameter("@ConsentFormID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Default, nConsentFormID));
            #endregion

            oReader = oCmd.ExecuteReader();

            while (oReader.Read())
            {
                #region Display Data Items
                if (sSubjID != oReader["SubjID"].ToString() || sCFVID != oReader["ConsentFormVersionID"].ToString())
                {
                    oTr = new HtmlTableRow();
                    oTr.Attributes["onclick"] = "HighlightRow(this);";
                    if (bDoDark)
                    {
                        oTr.Attributes["class"] = "trDark";
                    }

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "<a href=\"" + Request.ApplicationPath + "/Measures/EditConsentForm.aspx?SubjConsentID=" + oReader["SubjConsentID"].ToString() + "\">" + oFormat.FormatDBOutput(oReader["ID"].ToString()) + "</a>";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormat.FormatDBOutput(oReader["Version"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormat.FormatDBOutput(oReader["Status"].ToString());
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = oFormat.FormatDBOutput(oReader["DateSigned"].ToString());
                    oTr.Cells.Add(oTd);

                    tdConsentItems = new HtmlTableCell();
                    //if (oReader["IsConsented"].ToString() == "1")
                    //    tdConsentItems.InnerHtml = "<span style=\"color: #008800;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";
                    //else
                    //    tdConsentItems.InnerHtml = "<span style=\"color: #ff0000;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";
                    string s = oReader["ConsentItemText"].ToString() + " " + oReader["optiontext"].ToString();
                    if (s.Trim() == "")
                    {
                        s = "&nbsp;";                 //hack to fix missing border around empty table cell
                    }
                    tdConsentItems.InnerHtml = s;

                    oTr.Cells.Add(tdConsentItems);

                    tblMaster.Rows.Add(oTr);

                    bDoDark = !bDoDark;
                    sSubjID = oReader["SubjID"].ToString();
                    sCFVID  = oReader["ConsentFormVersionID"].ToString();
                }
                else
                {
                    //if (oReader["IsConsented"].ToString() == "1")
                    //    tdConsentItems.InnerHtml += "<br/>\n<span style=\"color: #008800;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";
                    //else
                    //    tdConsentItems.InnerHtml += "<br/>\n<span style=\"color: #ff0000;\">" + oFormat.FormatDBOutput(oReader["ConsentItemText"].ToString()) + "</span>";
                    tdConsentItems.InnerHtml += "<br/>" + oReader["ConsentItemText"].ToString() + " " + oReader["optiontext"].ToString();
                }
                #endregion
            }

            oReader.Close();
        }
Ejemplo n.º 5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string ap = Request.ApplicationPath;

            bool          bDisplayedHeader = false;
            bool          bDoDark          = false;
            string        sSortField;
            string        sDOB;
            HtmlAnchor    aLink;
            HtmlTableRow  oTr;
            HtmlTableCell oTd;

            nStudyID = Convert.ToInt32(Request["StudyID"]);

            if (Request["SubjStatusID"] == null)
            {
                Response.Redirect(ap + "/measures/SubjectsByStudy.aspx?StudyID=" + nStudyID.ToString(), true);
            }

            nSubjStatusID = Convert.ToInt32(Request["SubjStatusID"]);
            sSortField    = Request["hidSortField"];
            if (Request["SubjStatusDetailID"] != "")
            {
                nSubjStatusDetailID = Convert.ToInt32(Request["SubjStatusDetailID"]);
            }

            oConn.ConnectionString = ConfigurationManager.ConnectionStrings["TRACKING_CONN_STRING"].ToString();
            oConn.Open();

            SqlDataReader oReader = GetSubjectsByStatus(oConn, nStudyID, nSubjStatusID, nSubjStatusDetailID, sSortField);

            while (oReader.Read())
            {
                if (!bDisplayedHeader)
                {
                    #region Display Header Title
                    oTr = new HtmlTableRow();
                    oTr.Attributes["class"] = "trTitle";

                    oTd         = new HtmlTableCell();
                    oTd.ColSpan = 8;

                    if (nSubjStatusDetailID != 0)
                    {
                        oTd.InnerHtml = oReader["StudyName"].ToString() + " - " + oReader["SubjStatus"].ToString() + "/" + oReader["SubjStatusDetail"].ToString() + " Subjects";
                    }
                    else
                    {
                        oTd.InnerHtml = oReader["StudyName"].ToString() + " - " + oReader["SubjStatus"].ToString() + " Subjects";
                    }

                    oTr.Cells.Add(oTd);

                    tblMaster.Rows.Insert(0, oTr);

                    bDisplayedHeader = true;
                    #endregion
                }

                #region Display Data Items
                oTr   = new HtmlTableRow();
                aLink = new HtmlAnchor();

                oTr.Attributes.Add("onclick", "HighlightRow(this);");
                if (bDoDark)
                {
                    oTr.Attributes.Add("class", "trDark");
                }

                aLink.HRef      = ap + "/measures/EditSubject.aspx?SubjID=" + oReader["SubjID"].ToString();
                aLink.InnerHtml = oReader["ID"].ToString();

                oTd = new HtmlTableCell();
                oTd.Controls.Add(aLink);
                oTr.Cells.Add(oTd);

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = oFormat.FormatDBOutput(oReader["LastName"].ToString()) + ", " + oFormat.FormatDBOutput(oReader["FirstName"].ToString());
                oTr.Cells.Add(oTd);

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = oFormat.FormatDBOutput(oReader["GroupName"].ToString());
                oTr.Cells.Add(oTd);

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = oFormat.FormatDBOutput(oReader["SubjStatusAndDetail"].ToString());
                oTr.Cells.Add(oTd);

                oTd  = new HtmlTableCell();
                sDOB = oReader["DOB"].ToString();

                if (sDOB != "")
                {
                    oTd.InnerHtml = oFormat.AgeInYearsAndMonths(Convert.ToDateTime(sDOB));
                }
                else
                {
                    oTd.InnerHtml = "&nbsp;";
                }

                oTr.Cells.Add(oTd);

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = oFormat.FormatDBOutput(oReader["DOB"].ToString());
                oTr.Cells.Add(oTd);

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = oFormat.FormatDBOutput(oReader["Sex"].ToString());
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["white-space"] = " normal";
                oTd.InnerHtml            = oFormat.FormatDBOutput(oReader["Notes"].ToString());
                oTr.Cells.Add(oTd);

                tblMaster.Rows.Add(oTr);

                bDoDark = !bDoDark;
                #endregion
            }

            oConn.Close();
        }
Ejemplo n.º 6
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string ap = Request.ApplicationPath;

            oDBLookup = new DBLookup(Master.SqlConn);

            int           nHouseholdID         = Convert.ToInt32(Request["HouseholdID"].ToString());
            DataSet       oDataSet             = GetHouseholdInfo(nHouseholdID);
            DataTable     tblPhoneNumbers      = oDataSet.Tables["tblPhoneNumbers"];
            DataTable     tblEmailAddresses    = oDataSet.Tables["tblEmailAddresses"];
            DataTable     tblSubjects          = oDataSet.Tables["tblSubjects"];
            DataTable     tblSecondaryContacts = oDataSet.Tables["tblSecondaryContact"];
            DataTable     tblInfoLog           = oDataSet.Tables["tblInfoLog"];
            DataTable     tblContactLog        = oDataSet.Tables["tblContactLog"];
            DataTable     tblScreening         = oDataSet.Tables["tblScreeningResults"];
            string        sHouseholdName       = oDBLookup.GetHouseholdName(nHouseholdID);
            bool          bDoDark = false;
            HtmlTableRow  oTr;
            HtmlTableCell oTd;

            if (tblSubjects.Rows.Count > 0)
            {
                tdTitle.Style["text-align"] = "right";

                //DF: add app path to href and img tags
                tdTitle.InnerHtml += "<span style=\"text-align: center; width: 90%;\">" + sHouseholdName.ToString() + " Household Information</span>";
                tdTitle.InnerHtml += "<a href=\"" + ap + "/Household/EditPedigree.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/pedigree.gif\" alt=\"Edit Pedigree for Household\" style=\"align: right;\" /></a>&nbsp;";
                tdTitle.InnerHtml += "<a href=\"" + ap + "/Measures/ActionsByHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/task.gif\" alt=\"View All Actions for Household\" style=\"align: right;\" /></a>&nbsp;";
                tdTitle.InnerHtml += "<a href=\"" + ap + "/WebCal/FutureHouseholdActions.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/dlcalendar_2.gif\" alt=\"View Upcoming Appointments\" style=\"align: right;\" /></a>&nbsp;";
                tdTitle.InnerHtml += "<a href=\"" + ap + "/Household/EditHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Edit Household Info\" style=\"align: right;\" /></a>";

                #region Display Person/Subject Information
                HtmlTableCell tdAddress = new HtmlTableCell();
                HtmlTable     tblPerson = new HtmlTable();
                tblPerson.Attributes["class"]  = "tblPersons";
                tblPerson.CellSpacing          = 0;
                tblPerson.Style["width"]       = " 100%";
                tblPerson.Style["margin-left"] = " 0px";
                string sPersonID             = "0";
                bool   bDisplayedAddress     = false;
                int    nRowSpan              = 0;
                string sMainContactAddressID = "";

                #region Display Table Headers
                oTr = new HtmlTableRow();
                oTr.Attributes["class"] = "trTitle";

                oTd = new HtmlTableCell();
                oTd.Style["width"] = " 30%";
                oTd.InnerHtml      = "Name";
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["width"] = "20%";
                oTd.InnerHtml      = "DOB";
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["width"] = "15%";
                oTd.InnerHtml      = "Age";
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["width"] = "5%";
                oTd.InnerHtml      = "Sex";
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["width"] = "15%";
                oTd.InnerHtml      = "Role";
                oTr.Cells.Add(oTd);

                oTd = new HtmlTableCell();
                oTd.Style["width"] = "15%";
                oTd.InnerHtml      = "Race/Eth.";
                oTr.Cells.Add(oTd);

                tblPerson.Rows.Add(oTr);
                #endregion

                for (int i = 0; i < tblSubjects.Rows.Count; i++)
                {
                    if (sMainContactAddressID == "" && tblSubjects.Rows[i]["MainContact"].ToString() == "-1")
                    {
                        sMainContactAddressID = tblSubjects.Rows[i]["AddressID"].ToString();
                    }

                    if (sPersonID != tblSubjects.Rows[i]["PersonID"].ToString())
                    {
                        sPersonID         = tblSubjects.Rows[i]["PersonID"].ToString();
                        bDisplayedAddress = false;
                        bDoDark           = !bDoDark;

                        if (i > 0 && nRowSpan > 1)
                        {
                            tdAddress.RowSpan = nRowSpan;
                        }
                        nRowSpan = 0;

                        #region Display First, Visible Row
                        oTr = new HtmlTableRow();
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = " 30%";
                        if (tblSubjects.Rows[i]["MainContact"].ToString() == "-1" || tblSubjects.Rows[i]["MainContact"].ToString() == "1")
                        {
                            oTd.Style["font-weight"] = "bold";
                        }
                        oTd.InnerHtml += "<a href=\"" + ap + "/Household/CreateSubject.aspx?PersonID=" + sPersonID + "\"><img src=\"" + ap + "/images/book.gif\" alt=\"Enroll in New Study\" /></a>\n";
                        oTd.InnerHtml += "<a href=\"javascript:ExpandRow('tr" + tblSubjects.Rows[i]["PersonID"].ToString() + "');\">" + oFormatter.FormatDBOutput(tblSubjects.Rows[i]["FullName"].ToString()) + "</a>";
                        if (Convert.ToBoolean(tblSubjects.Rows[i]["IsDeceased"]))
                        {
                            oTd.InnerHtml += "<br/><span style=\"padding-left: 20px; color: #ff0000; font-weight: bold;\">THIS PERSON IS DECEASED</span>";
                        }
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "20%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["DOB"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "15%";
                        if (tblSubjects.Rows[i]["DOB"].ToString() != "")
                        {
                            oTd.InnerHtml += oFormatter.AgeInYearsAndMonths(Convert.ToDateTime(tblSubjects.Rows[i]["DOB"].ToString()));
                        }
                        else
                        {
                            oTd.InnerHtml += "&nbsp;";
                        }
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "5%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["Sex"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "15%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["PersonRole"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "15%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["EthnicityDesc"].ToString());
                        oTr.Cells.Add(oTd);

                        tblPerson.Rows.Add(oTr);
                        #endregion
                    }

                    #region Add Items to Hidden Inner Table
                    if (!bDisplayedAddress)
                    {
                        if (tblSubjects.Rows[i]["PersonNotes"].ToString().Trim() != "")
                        {
                            oTr = new HtmlTableRow();
                            if (bDoDark)
                            {
                                oTr.Attributes["class"] = "trDark";
                            }

                            oTd = new HtmlTableCell();
                            oTr.Attributes["name"] = "tr" + tblSubjects.Rows[i]["PersonID"].ToString();
                            oTd.ColSpan            = 6;
                            oTd.InnerHtml          = "<b>Notes:</b> " + tblSubjects.Rows[i]["PersonNotes"].ToString();

                            oTr.Cells.Add(oTd);
                            tblPerson.Rows.Add(oTr);
                        }

                        oTr = new HtmlTableRow();
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }
                        oTr.Attributes["id"] = "tr" + tblSubjects.Rows[i]["PersonID"].ToString();

                        tdAddress = new HtmlTableCell();

                        if (tblSubjects.Rows[i]["MainContact"].ToString() == "-1" || tblSubjects.Rows[i]["AddressID"].ToString() != sMainContactAddressID && tblSubjects.Rows[i]["AddressID"].ToString() != "")
                        {
                            tdAddress.InnerHtml += tblSubjects.Rows[i]["Address1"].ToString() + "<br/>";
                            if (tblSubjects.Rows[i]["Address2"].ToString() != "")
                            {
                                tdAddress.InnerHtml += tblSubjects.Rows[i]["Address2"].ToString() + "<br/>";
                            }
                            tdAddress.InnerHtml += tblSubjects.Rows[i]["City"].ToString();
                            if (tblSubjects.Rows[i]["State"].ToString() != "")
                            {
                                tdAddress.InnerHtml += ", " + tblSubjects.Rows[i]["State"].ToString() + " ";
                            }
                            if (tblSubjects.Rows[i]["Region"].ToString() != "")
                            {
                                tdAddress.InnerHtml += tblSubjects.Rows[i]["Region"].ToString() + " ";
                            }
                            if (tblSubjects.Rows[i]["Zip"].ToString() != "")
                            {
                                tdAddress.InnerHtml += tblSubjects.Rows[i]["Zip"].ToString();
                            }
                            if (tblSubjects.Rows[i]["Country"].ToString() != "")
                            {
                                tdAddress.InnerHtml += "<br/>" + tblSubjects.Rows[i]["Country"].ToString();
                            }
                            tdAddress.InnerHtml += "<br/><a href=\"" + ap + "/Household/EditAddress.aspx?HouseholdID=" + nHouseholdID.ToString() + "\" class=\"smalltext\">Edit Address</a>";
                        }
                        else
                        {
                            tdAddress.InnerHtml = "&nbsp;";
                        }

                        oTr.Cells.Add(tdAddress);

                        tblPerson.Rows.Add(oTr);

                        bDisplayedAddress = true;

                        oTd = new HtmlTableCell();

                        if (tblSubjects.Rows[i]["ID"].ToString() != "")
                        {
                            oTd.InnerHtml = "<a href=\"" + ap + "/measures/ActionsBySubject.aspx?SubjectID=" + tblSubjects.Rows[i]["SubjID"].ToString() + "\">" + tblSubjects.Rows[i]["StudyName"].ToString() + " - " + tblSubjects.Rows[i]["ID"].ToString() + "</a>";
                            if (tblSubjects.Rows[i]["StudyName"].ToString() == "PTP")
                            {
                                oTd.InnerHtml += " <a href=\"" + ap + "/dataentryforms/common/UW_PTP_screen/UW_PTP_screen.aspx?studymeasID=1331&ID=" + tblSubjects.Rows[i]["ID"].ToString() + "&IndexNum=1\">(Screen Form)</a>";
                            }

                            /* Data Entry form for TSI_UW doesn't exist yet.
                             * if (tblSubjects.Rows[i]["StudyName"].ToString() == "IBIS Network")
                             *  oTd.InnerHtml += " <a href=\"" + ap + "/dataentryforms/common/TSI_UW/TSI_UW.aspx?studymeasID=1386&ID=" + tblSubjects.Rows[i]["ID"].ToString() + "&IndexNum=1\">(Screen Form)</a>";
                             * if (tblSubjects.Rows[i]["StudyName"].ToString() == "EarlyConnections")
                             *  oTd.InnerHtml += " <a href=\"" + ap + "/dataentryforms/common/TSI_UW/TSI_UW.aspx?studymeasID=1400&ID=" + tblSubjects.Rows[i]["ID"].ToString() + "&IndexNum=1\">(Screen Form)</a>";
                             ****/
                        }
                        else
                        {
                            oTd.InnerHtml = "&nbsp;";
                        }

                        oTr.Cells.Add(oTd);

                        oTd         = new HtmlTableCell();
                        oTd.ColSpan = 2;

                        if (tblSubjects.Rows[i]["ID"].ToString() != "")
                        {
                            oTd.InnerHtml = "<a href=\"" + ap + "/Measures/EditSubject.aspx?SubjID=" + tblSubjects.Rows[i]["SubjID"].ToString() + "\">" + tblSubjects.Rows[i]["SubjStatus"].ToString() + "</a>";
                        }
                        else
                        {
                            oTd.InnerHtml = "&nbsp;";
                        }

                        oTr.Cells.Add(oTd);

                        oTd           = new HtmlTableCell();
                        oTd.ColSpan   = 2;
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["GroupName"].ToString());
                        oTr.Cells.Add(oTd);

                        tblPerson.Rows.Add(oTr);
                    }
                    else
                    {
                        oTr = new HtmlTableRow();
                        oTr.Attributes["name"] = "tr" + tblSubjects.Rows[i]["PersonID"].ToString();
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }

                        oTd = new HtmlTableCell();

                        if (tblSubjects.Rows[i]["ID"].ToString() != "")
                        {
                            oTd.InnerHtml = "<a href=\"" + ap + "/measures/ActionsBySubject.aspx?SubjectID=" + tblSubjects.Rows[i]["SubjID"].ToString() + "\">" + tblSubjects.Rows[i]["StudyName"].ToString() + " - " + tblSubjects.Rows[i]["ID"].ToString() + "</a>";
                            if (tblSubjects.Rows[i]["StudyName"].ToString() == "PTP")
                            {
                                oTd.InnerHtml += " <a href=\"" + ap + "/dataentryforms/common/UW_PTP_screen/UW_PTP_screen.aspx?studymeasID=1331&ID=" + tblSubjects.Rows[i]["ID"].ToString() + "&IndexNum=1\">(Screen Form)</a>";
                            }
                        }
                        else
                        {
                            oTd.InnerHtml = "&nbsp;";
                        }

                        oTr.Cells.Add(oTd);

                        oTd         = new HtmlTableCell();
                        oTd.ColSpan = 2;

                        if (tblSubjects.Rows[i]["ID"].ToString() != "")
                        {
                            oTd.InnerHtml = "<a href=\"" + ap + "/Measures/EditSubject.aspx?SubjID=" + tblSubjects.Rows[i]["SubjID"].ToString() + "\">" + tblSubjects.Rows[i]["SubjStatus"].ToString() + "</a>";
                        }
                        else
                        {
                            oTd.InnerHtml = "&nbsp;";
                        }

                        oTr.Cells.Add(oTd);

                        oTd           = new HtmlTableCell();
                        oTd.ColSpan   = 2;
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSubjects.Rows[i]["GroupName"].ToString());
                        oTr.Cells.Add(oTd);

                        tblPerson.Rows.Add(oTr);
                    }

                    nRowSpan = nRowSpan + 1;
                    #endregion
                }

                tdAddress.RowSpan = nRowSpan;

                tdPersonInfo.Controls.Add(tblPerson);
                bDoDark = false;
                #endregion

                #region Display Phone Numbers
                HtmlTable tblPhone = new HtmlTable();
                tblPhone.CellSpacing         = 0;
                tblPhone.Attributes["class"] = "tblPersons";
                tblPhone.Style["width"]      = " 100%";

                oTr = new HtmlTableRow();
                oTd = new HtmlTableCell();
                oTr.Attributes["class"] = "trTitle";
                oTd.ColSpan             = 3;
                oTd.Style["text-align"] = "right";
                oTd.InnerHtml           = "<span style=\"width: 90%; text-align: center;\">Household Phone Info.</span>";
                oTd.InnerHtml          += "<a href=\"" + ap + "/Household/EditHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Edit Household Info\" style=\"align: right;\" /></a>";
                oTr.Cells.Add(oTd);
                tblPhone.Rows.Add(oTr);
                string sPhoneType;

                if (tblPhoneNumbers.Rows.Count > 0)
                {
                    for (int i = 0; i < tblPhoneNumbers.Rows.Count; i++)
                    {
                        if (tblPhoneNumbers.Rows[i]["PhoneType"].ToString().Trim() == "")
                        {
                            sPhoneType = "Unknown";
                        }
                        else
                        {
                            sPhoneType = oFormatter.FormatDBOutput(tblPhoneNumbers.Rows[i]["PhoneType"].ToString());
                        }

                        oTr = new HtmlTableRow();

                        oTd = new HtmlTableCell();
                        oTd.Attributes["style"] = "white-space: nowrap; font-weight: bold; text-align: right;";
                        oTd.InnerHtml           = sPhoneType;
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Attributes["style"] = "white-space: nowrap;";
                        oTd.InnerHtml           = oFormatter.FormatDBOutput(tblPhoneNumbers.Rows[i]["PhoneNumber"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblPhoneNumbers.Rows[i]["PhoneNotes"].ToString());
                        oTr.Cells.Add(oTd);

                        tblPhone.Rows.Add(oTr);
                    }
                }
                else
                {
                    oTr           = new HtmlTableRow();
                    oTd           = new HtmlTableCell();
                    oTd.ColSpan   = 2;
                    oTd.InnerHtml = "No recorded Phone Numbers.";
                    oTr.Cells.Add(oTd);
                    tblPhone.Rows.Add(oTr);
                }

                tdPhoneInfo.Controls.Add(tblPhone);
                #endregion

                #region Display Email Addresses
                HtmlTable tblEmail = new HtmlTable();
                tblEmail.CellSpacing         = 0;
                tblEmail.Attributes["class"] = "tblPersons";
                tblEmail.Style["width"]      = " 100%";

                oTr = new HtmlTableRow();
                oTd = new HtmlTableCell();
                oTr.Attributes["class"] = "trTitle";
                oTd.ColSpan             = 3;
                oTd.Style["text-align"] = "right";
                oTd.InnerHtml           = "<span style=\"width: 90%; text-align: center;\">Household Email Info.</span>";
                oTd.InnerHtml          += "<a href=\"" + ap + "/Household/EditHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Edit Household Info\" style=\"align: right;\" /></a>";
                oTr.Cells.Add(oTd);
                tblEmail.Rows.Add(oTr);
                string sEmailType;

                if (tblEmailAddresses.Rows.Count > 0)
                {
                    for (int i = 0; i < tblEmailAddresses.Rows.Count; i++)
                    {
                        if (tblEmailAddresses.Rows[i]["EmailType"].ToString().Trim() == "")
                        {
                            sEmailType = "Unknown";
                        }
                        else
                        {
                            sEmailType = oFormatter.FormatDBOutput(tblEmailAddresses.Rows[i]["EmailType"].ToString());
                        }

                        oTr = new HtmlTableRow();

                        oTd = new HtmlTableCell();
                        oTd.Attributes["style"] = "white-space: nowrap; font-weight: bold; text-align: right;";
                        oTd.InnerHtml           = sEmailType;
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Attributes["style"] = "white-space: nowrap;";
                        oTd.InnerHtml           = "<a href=\"" + tblEmailAddresses.Rows[i]["EmailAddress"].ToString() + "\">" + oFormatter.FormatDBOutput(tblEmailAddresses.Rows[i]["EmailAddress"].ToString()) + "</a>";
                        oTr.Cells.Add(oTd);

                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblEmailAddresses.Rows[i]["EmailNotes"].ToString());
                        oTr.Cells.Add(oTd);

                        tblEmail.Rows.Add(oTr);
                    }
                }
                else
                {
                    oTr           = new HtmlTableRow();
                    oTd           = new HtmlTableCell();
                    oTd.ColSpan   = 2;
                    oTd.InnerHtml = "No recorded Email Addresses.";
                    oTr.Cells.Add(oTd);
                    tblEmail.Rows.Add(oTr);
                }

                tdEmailInfo.Controls.Add(tblEmail);
                tdEmailInfo.Style["page-break-after"] = "always";
                #endregion

                #region Display Info Log
                if (tblInfoLog.Rows.Count > 0)
                {
                    #region Display Header Info.
                    HtmlTable tblLogInfo = new HtmlTable();
                    tblLogInfo.Attributes["class"] = "tblPersons";
                    tblLogInfo.Style["width"]      = " 100%";
                    tblLogInfo.Attributes["name"]  = "tblLogInfo";
                    tblLogInfo.Attributes["id"]    = "tblLogInfo";
                    tblLogInfo.CellSpacing         = 0;

                    oTr = new HtmlTableRow();
                    oTd = new HtmlTableCell();
                    oTr.Attributes["class"] = "trTitle";
                    oTd.ColSpan             = 5;
                    oTd.Style["text-align"] = "right";
                    oTd.InnerHtml          += "<span style=\"text-align: center; width: 90%;\">" + sHouseholdName + " Household Info. Log</span>";
                    oTd.InnerHtml          += "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Append Log\" style=\"align: right;\" /></a>";
                    oTr.Cells.Add(oTd);
                    tblLogInfo.Rows.Add(oTr);

                    oTr = new HtmlTableRow();
                    oTr.Attributes["class"] = "trHeader";

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Date";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Priority";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Category";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Staff";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "&nbsp;";
                    oTr.Cells.Add(oTd);

                    tblLogInfo.Rows.Add(oTr);
                    #endregion

                    for (int i = 0; i < tblInfoLog.Rows.Count; i++)
                    {
                        oTr = new HtmlTableRow();
                        oTr.Attributes["onclick"] = "HighlightRow(this); HighlightRow(document.getElementById('trInfo" + oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoID"].ToString()) + "'));";
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";
                        oTd.InnerHtml      = "<a href=\"javascript:ExpandRow('trInfo" + oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoID"].ToString()) + "');\">" + oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoDate"].ToString()) + "</a>";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";

                        if (tblInfoLog.Rows[i]["LogPriority"].ToString().ToLower() == "urgent")
                        {
                            oTd.Style["color"]       = "#ff0000";
                            oTd.Style["font-weight"] = "bold";
                        }

                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogPriority"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoCat"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "20%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["StaffShortName"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "5%";
                        oTd.InnerHtml      = "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "&amp;LogInfoID=" + oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoID"].ToString()) + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Edit this Log Entry\" /></a>";
                        oTr.Cells.Add(oTd);

                        tblLogInfo.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTr.Style["display"] = "none";
                        oTr.Attributes["id"] = "trInfo" + oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoID"].ToString());
                        if (bDoDark)
                        {
                            oTr.Style["background-color"] = "#efefef";
                        }

                        oTd           = new HtmlTableCell();
                        oTd.ColSpan   = 5;
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblInfoLog.Rows[i]["LogInfoNotes"].ToString());
                        oTr.Cells.Add(oTd);

                        tblLogInfo.Rows.Add(oTr);

                        bDoDark = !bDoDark;
                    }

                    tdInfoLog.Controls.Add(tblLogInfo);
                }
                else
                {
                    tdInfoLog.InnerHtml = "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "\" class=\"DoNotPrint\">Add Household Log Entry</a>";
                }

                bDoDark = false;
                #endregion

                #region Display Contact Log
                if (tblContactLog.Rows.Count > 0)
                {
                    HtmlTable tblLogContact = new HtmlTable();
                    tblLogContact.Attributes["class"] = "tblPersons";
                    tblLogContact.Style["width"]      = " 100%";
                    tblLogContact.Attributes["name"]  = "tblLogContact";
                    tblLogContact.Attributes["id"]    = "tblLogInfo";
                    tblLogContact.CellSpacing         = 0;

                    oTr = new HtmlTableRow();
                    oTd = new HtmlTableCell();
                    oTr.Attributes["class"] = "trTitle";
                    oTd.ColSpan             = 5;
                    oTd.Style["text-align"] = "right";
                    oTd.InnerHtml          += "<span style=\"text-align: center; width: 90%;\">" + sHouseholdName + " Household Contact Log</span>";
                    oTd.InnerHtml          += "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Append Log\" style=\"align: right;\" /></a>";
                    oTr.Cells.Add(oTd);
                    tblLogContact.Rows.Add(oTr);

                    oTr = new HtmlTableRow();
                    oTr.Attributes["class"] = "trHeader";

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Date";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Priority";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Contact Type";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "Staff";
                    oTr.Cells.Add(oTd);

                    oTd           = new HtmlTableCell();
                    oTd.InnerHtml = "&nbsp;";
                    oTr.Cells.Add(oTd);

                    tblLogContact.Rows.Add(oTr);

                    for (int i = 0; i < tblContactLog.Rows.Count; i++)
                    {
                        oTr = new HtmlTableRow();
                        oTr.Attributes["onclick"] = "HighlightRow(this); HighlightRow(document.getElementById('trContact" + oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogContactID"].ToString()) + "'));";
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }
                        if (bDoDark)
                        {
                            oTr.Attributes["class"] = "trDark";
                        }

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";
                        oTd.InnerHtml      = "<a href=\"javascript:ExpandRow('trContact" + oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogContactID"].ToString()) + "');\">" + oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogDate"].ToString()) + "</a>";
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";

                        if (tblContactLog.Rows[i]["LogPriority"].ToString().ToLower() == "urgent")
                        {
                            oTd.Style["color"]       = "#ff0000";
                            oTd.Style["font-weight"] = "bold";
                        }

                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogPriority"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "25%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogContactType"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "20%";
                        oTd.InnerHtml      = oFormatter.FormatDBOutput(tblContactLog.Rows[i]["StaffShortName"].ToString());
                        oTr.Cells.Add(oTd);

                        oTd = new HtmlTableCell();
                        oTd.Style["width"] = "5%";
                        oTd.InnerHtml      = "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "&amp;LogContactID=" + oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogContactID"].ToString()) + "\"><img src=\"" + ap + "/images/edit.gif\" alt=\"Edit this Log Entry\" /></a>";
                        oTr.Cells.Add(oTd);

                        tblLogContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTr.Style["display"] = "none";
                        oTr.Attributes["id"] = "trContact" + oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogContactID"].ToString());
                        if (bDoDark)
                        {
                            oTr.Style["background-color"] = "#efefef";
                        }

                        oTd           = new HtmlTableCell();
                        oTd.ColSpan   = 5;
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblContactLog.Rows[i]["LogNotes"].ToString());
                        oTr.Cells.Add(oTd);

                        tblLogContact.Rows.Add(oTr);

                        bDoDark = !bDoDark;
                    }

                    tdContactLog.Controls.Add(tblLogContact);
                }
                else
                {
                    tdContactLog.InnerHtml = "<a href=\"" + ap + "/Household/AppendLog.aspx?HouseholdID=" + nHouseholdID.ToString() + "\" class=\"DoNotPrint\">Add Contact Log Entry</a>";
                }

                bDoDark = false;
                #endregion

                #region Display Secondary Contact Info
                if (tblSecondaryContacts.Rows.Count > 0)
                {
                    HtmlTable tblSecondaryContact = new HtmlTable();
                    tblSecondaryContact.Attributes["class"] = "tblPersons";
                    tblSecondaryContact.Style["width"]      = " 100%";
                    tblSecondaryContact.Attributes["name"]  = "tblAddress";
                    tblSecondaryContact.Attributes["id"]    = "tblSecondaryContact";
                    tblSecondaryContact.CellSpacing         = 0;

                    oTr = new HtmlTableRow();
                    oTd = new HtmlTableCell();
                    oTr.Attributes["class"] = "trTitle";
                    oTd.ColSpan             = 2;
                    oTd.InnerHtml           = "Secondary Contact Info.";
                    oTr.Cells.Add(oTd);
                    tblSecondaryContact.Rows.Add(oTr);

                    if (tblSecondaryContacts.Rows.Count > 0)
                    {
                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "First Name";
                        oTr.Cells.Add(oTd);
                        oTd            = new HtmlTableCell();
                        oTd.InnerHtml += oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["FirstName"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Last Name";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["LastName"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Relationship";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["EmerContactType"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Phone 1";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["Phone1"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Phone 2";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["Phone2"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Address";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["Address"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "City";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["City"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "State";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["StateName"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Postal Code";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["Zip"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);

                        oTr = new HtmlTableRow();
                        oTd = new HtmlTableCell();
                        oTd.Style["text-align"]  = " right";
                        oTd.Style["font-weight"] = " bold";
                        oTd.Style["width"]       = " 35%";
                        oTd.InnerHtml            = "Notes";
                        oTr.Cells.Add(oTd);
                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = oFormatter.FormatDBOutput(tblSecondaryContacts.Rows[0]["Notes"].ToString());
                        oTr.Cells.Add(oTd);
                        tblSecondaryContact.Rows.Add(oTr);
                    }

                    tdSecondaryContact.Controls.Add(tblSecondaryContact);
                }
                else
                {
                    tdSecondaryContact.InnerHtml = "&nbsp;";
                }
                #endregion

                #region Display Screening Information
                if (tblScreening.Rows.Count > 0)
                {
                    HtmlTable tblScreeningInfo = new HtmlTable();
                    tblScreeningInfo.Attributes["class"] = "tblPersons";
                    tblScreeningInfo.Style["width"]      = " 100%";
                    tblScreeningInfo.Attributes["name"]  = "tblScreeningInfo";
                    tblScreeningInfo.Attributes["id"]    = "tblScreeningInfo";
                    tblScreeningInfo.CellSpacing         = 0;

                    oTr = new HtmlTableRow();
                    oTd = new HtmlTableCell();
                    oTr.Attributes["class"] = "trTitle";
                    oTd.ColSpan             = 2;
                    oTd.InnerHtml           = "Screening Information";
                    oTr.Cells.Add(oTd);
                    tblScreeningInfo.Rows.Add(oTr);

                    for (int i = 0; i < tblScreening.Rows.Count; i++)
                    {
                        oTr = new HtmlTableRow();

                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = tblScreening.Rows[i]["FullName"].ToString();
                        oTr.Cells.Add(oTd);

                        oTd           = new HtmlTableCell();
                        oTd.InnerHtml = "<a href=\"" + ap + "/screening/results/individual_results.asp?selSurveyID=" + tblScreening.Rows[i]["SurveyID"].ToString() + "&amp;selPersonID=" + tblScreening.Rows[i]["PersonID"].ToString() + "\">" + tblScreening.Rows[i]["SurveyName"].ToString() + "</a>";
                        oTr.Cells.Add(oTd);

                        tblScreeningInfo.Rows.Add(oTr);
                    }

                    tdScreening.Controls.Add(tblScreeningInfo);
                }
                else
                {
                    tdScreening.InnerHtml = "&nbsp;";
                }
                #endregion
            }
            else
            {
                tblMaster.Rows.Clear();
                oTr = new HtmlTableRow();

                oTd           = new HtmlTableCell();
                oTd.InnerHtml = "The Household you selected does not exist or there are no persons within the Household.<br/><a href=\"" + ap + "/Household/EditHousehold.aspx?HouseholdID=" + nHouseholdID.ToString() + "\">Click here to try to edit the Household.</a>";
                oTr.Cells.Add(oTd);

                tblMaster.Rows.Add(oTr);
            }
        }