private void LoadPacketDDL() { DataTable dt = new DataTable(); PatientEducationDa da = new PatientEducationDa(); int diseaseId; int visitTypeId; if (int.TryParse(ddlDiseaseType.SelectedValue, out diseaseId) && int.TryParse(ddlVisitType.SelectedValue, out visitTypeId)) { dt = da.GetPacketsByDiseaseAndVisitType(diseaseId, visitTypeId); this.ddlPacketName.DataTextField = PatientEdPacket.PacketName; this.ddlPacketName.DataValueField = PatientEdPacket.PacketId; this.ddlPacketName.DataSource = dt.DefaultView; this.ddlPacketName.DataBind(); if (dt.Rows.Count > 0) { this.ddlPacketName.Items.Insert(1, ADDNEW); txtPacketName.Visible = false; //BtnDeletePacket.Visible = false; } else { this.ddlPacketName.Items.Insert(0, ADDNEW); txtPacketName.Visible = true; //BtnDeletePacket.Visible = false; } } }
//private void GetRootNodes(int vtId, int dId) private void GetRootNodes() { contentTV.Nodes.Clear(); PatientEducationDa da = new PatientEducationDa(); //DataTable dt = da.GetSectionsByVisitTypeAndDiseaseId(vtId, dId); DataTable dt = da.GetAllSections(); foreach (DataRow row in dt.Rows) { TreeNode node = new TreeNode(); string sectionName = row[PatientEdSection.SectionName].ToString(); node.Text = "<span onclick='return false;' style='cursor:default;'>" + sectionName + "</span>"; node.Value = row[PatientEdSection.SectionId].ToString(); node.ToolTip = sectionName; node.ImageToolTip = sectionName; node.Expanded = false; node.PopulateOnDemand = true; node.SelectAction = TreeNodeSelectAction.SelectExpand; node.ShowCheckBox = false; node.Expand(); contentTV.Nodes.Add(node); } }
protected void LoadPacketMenus() { if (!string.IsNullOrEmpty(ddlDiseaseProfile.SelectedValue)) { int dId = int.Parse(ddlDiseaseProfile.SelectedValue); PatientEducationDa peda = new PatientEducationDa(); // initial consult packets DataTable initialConsultDt = new DataTable(); initialConsultDt = peda.GetPacketsByDiseaseAndVisitType(dId, 1); rptInitialConsultPackets.DataSource = initialConsultDt.DefaultView; rptInitialConsultPackets.DataBind(); //rptPostOpVisit packets DataTable postOpVisitDt = new DataTable(); postOpVisitDt = peda.GetPacketsByDiseaseAndVisitType(dId, 2); rptPostOpVisit.DataSource = postOpVisitDt.DefaultView; rptPostOpVisit.DataBind(); // rptDischarge DataTable dischargeDt = new DataTable(); dischargeDt = peda.GetPacketsByDiseaseAndVisitType(dId, 3); rptDischarge.DataSource = dischargeDt.DefaultView; rptDischarge.DataBind(); // DataTable followUpDt = new DataTable(); followUpDt = peda.GetPacketsByDiseaseAndVisitType(dId, 4); rptFollowUp.DataSource = followUpDt.DefaultView; rptFollowUp.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // NOTE: this needs to be modified so it can handle profiles for "No Patient" string subTopicIdString = Request.Form["SubTopicId"]; if (!string.IsNullOrEmpty(subTopicIdString)) { int subTopicId = int.Parse(subTopicIdString); PatientEducationDa da = new PatientEducationDa(); DataRow dr = da.GetSubTopicProfileContent(subTopicId); string subTopicName = PageUtil.EscapeSingleQuotes(dr[PatientEdSubTopic.SubTopicName].ToString()); // Content is literal HTML, so any newlines must be stripped or replaces with <br /> string subTopicContent = PageUtil.EscapeSingleQuotes(dr[PatientEdSubTopic.SubTopicContent].ToString()); subTopicContent = subTopicContent.Replace("\r\n", " "); subTopicContent = subTopicContent.Replace("\n", " "); string topicId = PageUtil.EscapeSingleQuotes(dr[PatientEdTopic.TopicId].ToString()); string topicName = PageUtil.EscapeSingleQuotes(dr[PatientEdTopic.TopicName].ToString()); string topicContent = PageUtil.EscapeSingleQuotes(dr[PatientEdTopic.TopicDescription].ToString()); string sectionId = PageUtil.EscapeSingleQuotes(dr[PatientEdSection.SectionId].ToString()); string sectionName = PageUtil.EscapeSingleQuotes(dr[PatientEdSection.SectionName].ToString()); string sectionContent = PageUtil.EscapeSingleQuotes(dr[PatientEdSection.SectionDescription].ToString()); string jsString = "['" + subTopicName + "','" + subTopicContent + "','" + topicId + "','" + topicName + "','" + topicContent + "','" + sectionId + "','" + sectionName + "','" + sectionContent + "']"; Response.Write(jsString); } }
/// <summary> /// Get list of all profiles for current patient. Bind to gridview in list of profiles tab. /// </summary> /// <param name="ptId"></param> private void LoadListOfProfilesTable(int ptId) { // populate the past profiles repeater PatientEducationDa da = new PatientEducationDa(); DataTable dtList = da.GetAllProfilesForPatient(ptId); rptProfileResults.DataSource = dtList; rptProfileResults.DataBind(); }
protected override void Page_Load(object sender, EventArgs e) { SessionHandler sh = new SessionHandler(Session); int ptId = sh.GetPatientId(); this.LoadPacketMenus(); if (!Page.IsPostBack) { LoadDiseaseDDL(); if (Request.QueryString["usePtInSession"] == "true") { this._usePtInSession.Value = "true"; PatientEducationDa da = new PatientEducationDa(); if (ptId > 0) { DataTable dt = da.GetMostRecentPatientProfile(ptId); if (dt.Rows.Count > 0 && String.IsNullOrEmpty(dt.Rows[0][PatientEdProfile.LastPrintedTime].ToString())) { // will either load most recent profile (only if it hasn't been printed), // or load blank profile (not yet saved to db; no disease filter, no visit-type filter) ProfileId = Int32.Parse(dt.Rows[0][PatientEdProfile.ProfileId].ToString()); LoadExistingProfile(); ShowProfileLog(true); } else { this._visitTypeStage.Value = "0"; ShowProfileLog(false); } LoadListOfProfilesTable(ptId); } ShowPatientInSessionLayout(true); } else { this._usePtInSession.Value = "false"; ShowPatientInSessionLayout(false); ShowProfileLog(false); this._visitTypeStage.Value = "0"; } GetRootNodes(); } else { if (this._callbackType.Value != "print" && this._callbackType.Value != "save") { UpdateTreeAndContent(); //update the tree when changing disease/visit } } }
/// <summary> /// Populate and bind the disease drop down list. /// </summary> private void LoadDiseaseDDL() { ddlDiseaseProfile.DataValueField = PatientEdDisease.DiseaseId; ddlDiseaseProfile.DataTextField = PatientEdDisease.DiseaseName; PatientEducationDa da = new PatientEducationDa(); ddlDiseaseProfile.DataSource = da.GetAllDiseaseTypes(); ddlDiseaseProfile.DataBind(); }
private void GetRootNodes() { contentTV.Nodes.Clear(); PatientEducationDa da = new PatientEducationDa(); DataTable dt = da.GetAllSections(); //will eventually use GetAll() from BusinessObject foreach (DataRow row in dt.Rows) { TreeNode node = new TreeNode(); string sectionId = row[PatientEdSection.SectionId].ToString(); string sectionName = row[PatientEdSection.SectionName].ToString(); node.Value = sectionId; node.ToolTip = sectionName; node.ImageToolTip = sectionName; if (PageMode == PageModes.Single.ToString()) { node.Text = PatientEdUtil.GetFriendlyJavascriptTitle(sectionName, sectionId, sectionName, string.Empty, string.Empty, string.Empty, string.Empty, "Section"); } else { node.Text = "<span onclick='return false;' style='cursor:default;'>" + sectionName + "</span>"; } if (PageMode == PageModes.Single.ToString()) { if (!(topicBiz != null && topicBiz[PatientEdTopic.SectionId].ToString() == sectionId)) { if (sectionBiz != null && sectionBiz[PatientEdSection.SectionId].ToString() == sectionId) { SetContentDetailSrc("1", sectionId, sectionName); } } node.NavigateUrl = "ManageContentDetail.aspx?type=1&id=" + node.Value; } node.PopulateOnDemand = true; node.SelectAction = TreeNodeSelectAction.SelectExpand; node.ShowCheckBox = false; node.Expand(); if (!String.IsNullOrEmpty(PreloadedContentType)) { if (sectionBiz != null && topicBiz == null && subTopicBiz == null && sectionBiz[PatientEdSection.SectionId].ToString() == sectionId) { node.Selected = true; } } contentTV.Nodes.Add(node); } }
private void LoadDDLs() { this.ddlDiseaseType.DataValueField = PatientEdDisease.DiseaseId; this.ddlDiseaseType.DataTextField = PatientEdDisease.DiseaseName; this.ddlVisitType.DataValueField = PatientEdVisitType.VisitTypeId; this.ddlVisitType.DataTextField = PatientEdVisitType.VisitTypeName; PatientEducationDa da = new PatientEducationDa(); this.ddlDiseaseType.DataSource = da.GetAllDiseaseTypes(); this.ddlDiseaseType.DataBind(); this.ddlVisitType.DataSource = da.GetAllVisitTypes(); this.ddlVisitType.DataBind(); // packet names are specific to the combination of disease and visit type }
/// <summary> /// "Loads" the existing profile. Sets values for profile id, visit type id, and disease id that are used when /// building the tree view. Also sets the profile log information. /// </summary> private void LoadExistingProfile() { // Retrieve the profile PatientEdProfile profileBiz = new PatientEdProfile(); profileBiz.Get(ProfileId); //Set values if (!String.IsNullOrEmpty(profileBiz[PatientEdProfile.ProfileVisitTypeId].ToString())) { // Note: Not really necessary to do as shown below, if we have order numbers that are the same // as the Ids. VisitTypeId = Int32.Parse(profileBiz[PatientEdProfile.ProfileVisitTypeId].ToString()); PatientEducationDa da = new PatientEducationDa(); DataRow dr = da.GetVisitTypeById(VisitTypeId); this._visitTypeStage.Value = dr[PatientEdVisitType.OrderNumber].ToString(); } else { this._visitTypeStage.Value = "0"; } if (!String.IsNullOrEmpty(profileBiz[PatientEdProfile.ProfileDiseaseId].ToString())) { DiseaseId = Int32.Parse(profileBiz[PatientEdProfile.ProfileDiseaseId].ToString()); } // update profile log info this.printedDate.InnerHtml = profileBiz[PatientEdProfile.LastPrintedTime].ToString(); this.printedBy.InnerHtml = profileBiz[PatientEdProfile.LastPrintedBy].ToString(); if (!String.IsNullOrEmpty(profileBiz[PatientEdProfile.LastPrintedBy].ToString())) { this.printedBy.InnerHtml = "by " + this.printedBy.InnerHtml; } this.updatedDate.InnerHtml = profileBiz[PatientEdProfile.UpdatedTime].ToString(); this.updatedBy.InnerHtml = profileBiz[PatientEdProfile.UpdatedBy].ToString(); if (!String.IsNullOrEmpty(profileBiz[PatientEdProfile.UpdatedBy].ToString())) { this.updatedBy.InnerHtml = "by " + this.updatedBy.InnerHtml; } }
/// <summary> /// Save the packet; packet requires a disease, visit type and packet name /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SaveDefaultDocument(object sender, ImageClickEventArgs e) { PatientEducationDa da = new PatientEducationDa(); int dId = 0; //= this.ddlDiseaseType.SelectedValue; int vId = 0; //= this.ddlVisitType.SelectedValue; int pId = 0; //= this.ddlPacketName.SelectedValue; if (!String.IsNullOrEmpty(this.ddlDiseaseType.SelectedValue) && !String.IsNullOrEmpty(this.ddlVisitType.SelectedValue)) { dId = Int32.Parse(this.ddlDiseaseType.SelectedValue); vId = Int32.Parse(this.ddlVisitType.SelectedValue); } if (this.ddlPacketName.SelectedValue.Equals(ADDNEW) && !string.IsNullOrEmpty(this.txtPacketName.Value)) { // adding new; insert packet name and get new primary key for insertion into disease_visits_packets table string newPacketName = txtPacketName.Value; PatientEdPacket packet = new PatientEdPacket(); packet[PatientEdPacket.PacketName] = newPacketName; packet.Save(); pId = int.Parse(packet[PatientEdPacket.PacketId].ToString()); // new packet name was used so refresh the drop down list, select the recent addition, and make the delete button available ListItem li = new ListItem(newPacketName, pId.ToString()); ddlPacketName.Items.Insert(1, li); ddlPacketName.SelectedIndex = 1; txtPacketName.Value = ""; txtPacketName.Visible = false; BtnDeletePacket.Visible = true; } else if (!string.IsNullOrEmpty(this.ddlPacketName.SelectedValue)) { pId = int.Parse(this.ddlPacketName.SelectedValue); } if (pId > 0 && dId > 0 && vId > 0) // update or insert default doc { List <string> checkedPartsList = new List <string>(); foreach (TreeNode sectionNode in contentTV.Nodes) { foreach (TreeNode topicNode in sectionNode.ChildNodes) { foreach (TreeNode subTopicNode in topicNode.ChildNodes) { if (subTopicNode.Checked) { checkedPartsList.Add(subTopicNode.Value); } } } } PatientEdDisease_VisitType_SubTopic biz = new PatientEdDisease_VisitType_SubTopic(); DataTable defaultDocPartsDt = da.GetDefaultDocumentByDiseaseVisitPacketIds(dId, vId, pId); // start by deleting nodes that may have been removed foreach (DataRow dr in defaultDocPartsDt.Rows) { string drId = dr[PatientEdDisease_VisitType_SubTopic.DiseaseVisitTypeSubTopicId].ToString(); string stId = dr[PatientEdDisease_VisitType_SubTopic.SubTopicId].ToString(); if (!checkedPartsList.Contains(stId)) { //delete this record biz.Get(Int32.Parse(drId)); biz.Delete(); } else { //remove it from the list of checked parts, as we have confirmed it is already in the db checkedPartsList.Remove(stId); } } //save the new additions foreach (string defaultDocpart in checkedPartsList) { //add new profile doc parts to the db PatientEdDisease_VisitType_SubTopic bizObj = new PatientEdDisease_VisitType_SubTopic(); bizObj[PatientEdDisease_VisitType_SubTopic.SubTopicId] = Int32.Parse(defaultDocpart); bizObj[PatientEdDisease_VisitType_SubTopic.VisitTypeId] = vId.ToString(); bizObj[PatientEdDisease_VisitType_SubTopic.DiseaseId] = dId.ToString(); bizObj[PatientEdDisease_VisitType_SubTopic.PacketId] = pId.ToString(); bizObj.Save(); } GetRootNodes(); this._callbackType.Value = String.Empty; } }
protected void TreeNode_Populate(Object sender, TreeNodeEventArgs e) { int sectionId = Int32.Parse(e.Node.Value); PatientEdSection sectionBiz = new PatientEdSection(); sectionBiz.Get(sectionId); string sectionTitle = sectionBiz[PatientEdSection.SectionName].ToString(); PatientEducationDa da = new PatientEducationDa(); // Wouldn't it be better to do use PatientEdTopic biz and GetByParent sectionId ??? DataTable dt = da.GetTopicsBySection(sectionId); List <string> subTopicIds = new List <string>(); //get topics foreach (DataRow row in dt.Rows) { int topicId = int.Parse(row[PatientEdTopic.TopicId].ToString()); string topicName = row[PatientEdTopic.TopicName].ToString(); string titleText = ""; if (PageMode == PageModes.Single.ToString()) { titleText = PatientEdUtil.GetFriendlyJavascriptTitle(topicName, sectionId.ToString(), sectionTitle, topicId.ToString(), topicName, String.Empty, String.Empty, "Topic"); } else { titleText = "<span onclick='return false;' style='cursor:default;'>" + topicName + "</span>"; } TreeNode topicNode = new TreeNode(titleText, topicId.ToString()); topicNode.ToolTip = topicName; topicNode.ImageToolTip = topicName; if (subTopicBiz != null && subTopicBiz[PatientEdSubTopic.TopicId].ToString() == topicId.ToString()) { topicNode.Expanded = true; } else { if (PageMode == PageModes.Single.ToString()) { if (topicBiz != null && topicBiz[PatientEdTopic.TopicId].ToString() == topicId.ToString()) { string title = sectionBiz[PatientEdSection.SectionName].ToString() + " > " + topicName; SetContentDetailSrc("2", topicId.ToString(), title); } } topicNode.Expanded = false; } if (PageMode == PageModes.Single.ToString()) { topicNode.NavigateUrl = "ManageContentDetail.aspx?type=2&id=" + topicNode.Value; } // get subtopics DataTable dtSubTopic = da.GetSubTopicsByTopic(topicId); foreach (DataRow dr in dtSubTopic.Rows) { string subTopicId = dr[PatientEdSubTopic.SubTopicId].ToString(); string subTopicName = dr[PatientEdSubTopic.SubTopicName].ToString(); string stText = ""; subTopicIds.Add(subTopicId); if (PageMode == PageModes.Single.ToString()) { stText = PatientEdUtil.GetFriendlyJavascriptTitle(subTopicName, sectionId.ToString(), sectionTitle, topicId.ToString(), topicName, subTopicId, subTopicName, "SubTopic"); } else { if (PageMode == PageModes.DefaultDoc.ToString()) { stText = "<span onclick='doNodeCheckboxClick(this);return false;' style='cursor:default;'>" + subTopicName + "</span>"; } else { stText = "<span onclick='return false;' style='cursor:default;'>" + subTopicName + "</span>"; } } TreeNode subTopicNode = new TreeNode(stText, subTopicId); if (PageMode == PageModes.Single.ToString()) { subTopicNode.NavigateUrl = "ManageContentDetail.aspx?type=3&id=" + subTopicNode.Value; } if (PageMode == PageModes.DefaultDoc.ToString()) { subTopicNode.ShowCheckBox = true; // NOTE: try to check off subtopics based on ddls DataTable dST = da.GetDiseaseVisitSubTopicBySubTopic(Int32.Parse(subTopicId)); foreach (DataRow r in dST.Rows) { if (r[PatientEdDisease_VisitType_SubTopic.DiseaseId].ToString() == ddlDiseaseType.SelectedValue && r[PatientEdDisease_VisitType_SubTopic.VisitTypeId].ToString() == ddlVisitType.SelectedValue && r[PatientEdPacket.PacketId].ToString() == ddlPacketName.SelectedValue) { subTopicNode.Checked = true; topicNode.Expand(); break; } } } subTopicNode.ToolTip = subTopicName; subTopicNode.ImageToolTip = subTopicName; if (!String.IsNullOrEmpty(PreloadedContentType)) { if (sectionBiz != null && topicBiz != null && subTopicBiz != null && subTopicBiz[PatientEdSubTopic.SubTopicId].ToString() == subTopicId) { subTopicNode.Selected = true; } } topicNode.ChildNodes.Add(subTopicNode); if (subTopicBiz != null && subTopicBiz[PatientEdSubTopic.SubTopicId].ToString() == subTopicId) { string title = sectionBiz[PatientEdSection.SectionName].ToString() + " > " + topicName + " > " + subTopicName; SetContentDetailSrc("3", subTopicId, title); } } if (!String.IsNullOrEmpty(PreloadedContentType)) { if (sectionBiz != null && topicBiz != null && subTopicBiz == null && topicBiz[PatientEdTopic.TopicId].ToString() == topicId.ToString()) { topicNode.Selected = true; } } topicNode.ShowCheckBox = false; e.Node.ChildNodes.Add(topicNode); } PatientEdUtil.RegisterStartupSubTopicIds(Page, sectionId, subTopicIds); }
/// <summary> /// Saves the current profile, existing or newly created. /// </summary> /// <param name="caller"></param> private void SaveCurrentProfile(string caller) { SecurityController sc = new SecurityController(); string user = sc.GetUserName(); if (!String.IsNullOrEmpty(this._ptProfileId.Value)) { ProfileId = Int32.Parse(this._ptProfileId.Value); } if (this._visitTypeStage.Value != "0") { VisitTypeId = Int32.Parse(this._visitTypeStage.Value); } PatientEducationDa da = new PatientEducationDa(); List <string> checkedPartsList = new List <string>(); foreach (TreeNode sectionNode in contentTV.Nodes) { foreach (TreeNode topicNode in sectionNode.ChildNodes) { foreach (TreeNode subTopicNode in topicNode.ChildNodes) { if (subTopicNode.Checked) { checkedPartsList.Add(subTopicNode.Value); } } } } if (ProfileId > 0) { DataTable dbProfilePartsDt = da.GetProfileDocPartsByProfileId(ProfileId); // Delete existing profile parts that have been deselected, // and update the list of actual new parts to be saved later on. foreach (DataRow dr in dbProfilePartsDt.Rows) { string stId = dr[PatientEdProfileDocPart.SubTopicId].ToString(); if (!checkedPartsList.Contains(stId)) { //delete this profile doc part from the db da.DeleteProfileDocPartByProfileIdAndSubTopicId(ProfileId, Int32.Parse(stId)); } else { //remove it from the list of checked parts, as we have confirmed it is already in the db checkedPartsList.Remove(stId); } } PatientEdProfile profileBiz = new PatientEdProfile(); profileBiz.Get(ProfileId); profileBiz[PatientEdProfile.UpdatedBy] = user; profileBiz[PatientEdProfile.UpdatedTime] = DateTime.Now.ToString(); if (caller == "print") { profileBiz[PatientEdProfile.LastPrintedBy] = user; profileBiz[PatientEdProfile.LastPrintedTime] = DateTime.Now.ToString(); } profileBiz.Save(); } else { // Saving a brand new profile. SessionHandler sh = new SessionHandler(Session); int ptId = sh.GetPatientId(); PatientEdProfile profile = new PatientEdProfile(); profile[PatientEdProfile.PatientId] = ptId.ToString(); if (this._visitTypeStage.Value != "0") { profile[PatientEdProfile.ProfileVisitTypeId] = VisitTypeId; } if (this.ddlDiseaseProfile.SelectedIndex > 0) { profile[PatientEdProfile.ProfileDiseaseId] = DiseaseId; } string profileDate = DateTime.Now.ToString(); profile[PatientEdProfile.ProfileCreateDate] = profileDate; profile[PatientEdProfile.EnteredBy] = user; profile[PatientEdProfile.EnteredTime] = profileDate; profile[PatientEdProfile.UpdatedBy] = user; profile[PatientEdProfile.UpdatedTime] = profileDate; if (caller == "print") { profile[PatientEdProfile.LastPrintedBy] = user; profile[PatientEdProfile.LastPrintedTime] = DateTime.Now.ToString(); } profile.Save(); ProfileId = Int32.Parse(profile[PatientEdProfile.ProfileId].ToString()); LoadListOfProfilesTable(ptId); ShowProfileLog(true); } // Add the new profile parts to this profile document foreach (string profilePart in checkedPartsList) { PatientEdProfileDocPart dp = new PatientEdProfileDocPart(); dp[PatientEdProfileDocPart.ProfileId] = ProfileId.ToString(); dp[PatientEdProfileDocPart.SubTopicId] = Int32.Parse(profilePart); dp[PatientEdProfileDocPart.ProfileDocPartVersionNumber] = "1.0"; dp[PatientEdProfileDocPart.ProfileDocPartOrderNumber] = "1"; dp.Save(); } LoadExistingProfile(); GetRootNodes(); this._callbackType.Value = String.Empty; }
protected void TreeNode_Populate(Object sender, TreeNodeEventArgs e) { int sectionId = Int32.Parse(e.Node.Value); PatientEducationDa da = new PatientEducationDa(); DataTable dt = da.GetTopicsBySection(sectionId); List <string> subTopicIds = new List <string>(); DataTable profilePartsDt = new DataTable(); DataTable subTopicTable = new DataTable(); string loadDocType = ""; // inside the loop we will want to check off boxes based on a profile or default doc if (ProfileId > 0) { profilePartsDt = da.GetProfileDocPartsByProfileId(ProfileId); loadDocType = "UserProfile"; } else if (PageUtil.IsInteger(_packetId.Value)) { // check off subtopics based on active packet subTopicTable = da.GetDiseaseVisitSubTopicByPacket(int.Parse(_packetId.Value)); loadDocType = "DefaultPacket"; PacketName.Text = _packetName.Value; } // get subtopics by topic foreach (DataRow row in dt.Rows) { string topicName = row[PatientEdTopic.TopicName].ToString(); TreeNode topicNode = new TreeNode("<span onclick='return false;' style='cursor:default;'>" + topicName + "</span>", row[PatientEdTopic.TopicId].ToString()); topicNode.Expanded = false; topicNode.ToolTip = topicName; topicNode.ImageToolTip = topicName; int topicId = Int32.Parse(row[PatientEdTopic.TopicId].ToString()); DataTable dtSubTopic = da.GetSubTopicsByTopic(topicId); foreach (DataRow dr in dtSubTopic.Rows) { string subTopicId = dr[PatientEdSubTopic.SubTopicId].ToString(); subTopicIds.Add(subTopicId); string subTopicName = dr[PatientEdSubTopic.SubTopicName].ToString(); TreeNode subTopicNode = new TreeNode("<span onclick='doNodeCheckboxClick(this);return false;' style='cursor:default;'>" + subTopicName + "</span>", dr[PatientEdSubTopic.SubTopicId].ToString()); subTopicNode.ToolTip = subTopicName; subTopicNode.ImageToolTip = subTopicName; subTopicNode.ShowCheckBox = true; //Loading an existing profile, so check off boxes if subtopic is part of the profile doc if (loadDocType.Equals("UserProfile")) { DataRow[] returnedRows = profilePartsDt.Select("SubTopicId = " + subTopicId + ""); if (returnedRows.Length > 0) { subTopicNode.Checked = true; topicNode.Expand(); } /* previous, less efficient way * foreach (DataRow pdr in profilePartsDt.Rows) * { * if (subTopicId == pdr[PatientEdProfileDocPart.SubTopicId].ToString()) * { * subTopicNode.Checked = true; * topicNode.Expand(); * } * } */ } else if (loadDocType.Equals("DefaultPacket")) //not for a particular patient { // if a the subtopic is part of the default packet, check it off DataRow[] foundRows = subTopicTable.Select("SubTopicId = " + subTopicId + ""); if (foundRows.Length > 0) { subTopicNode.Checked = true; topicNode.Expand(); } /*foreach (DataRow packetRow in subTopicTable.Rows) * { * if (subTopicId == packetRow[PatientEdDisease_VisitType_SubTopic.SubTopicId].ToString()) * { * subTopicNode.Checked = true; * topicNode.Expand(); * break; * } * }*/ /* Try to check off subtopics based on disease ddl and visit type * DataTable dST = da.GetDiseaseVisitSubTopicBySubTopic(Int32.Parse(subTopicId)); * foreach (DataRow r in dST.Rows) * { * string sVisitTypeId = ""; * //if (this._visitTypeId != 0) * if (VisitTypeId != 0) * { * sVisitTypeId = this._visitTypeId.ToString(); //this._visitTypeStage.Value * } * * if (r[PatientEdDisease_VisitType_SubTopic.DiseaseId].ToString() == this.ddlDiseaseProfile.SelectedValue * && r[PatientEdDisease_VisitType_SubTopic.VisitTypeId].ToString() == sVisitTypeId) * { * subTopicNode.Checked = true; * topicNode.Expand(); * break; * } * } */ } topicNode.ChildNodes.Add(subTopicNode); } topicNode.ShowCheckBox = false; e.Node.ChildNodes.Add(topicNode); } PatientEdUtil.RegisterStartupSubTopicIds(Page, sectionId, subTopicIds); }