Esempio n. 1
0
    private void DeleteSelectedNodeFromTreeView()
    {
        int id       = Int32.Parse(this.contentTV.SelectedNode.Value);
        int nodeType = this.contentTV.SelectedNode.Depth;

        if (nodeType == 0)         //deleting section
        {
            PatientEdSection bizObj = new PatientEdSection();
            bizObj.Delete(id);
        }
        else if (nodeType == 1)         //deleting topic
        {
            PatientEdTopic bizObj = new PatientEdTopic();
            bizObj.Delete(id);
        }
        else if (nodeType == 2)         //deleting subtopic
        {
            PatientEdSubTopic bizObj = new PatientEdSubTopic();
            bizObj.Delete(id);
        }
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    private void LoadContent()
    {
        int id = Id;

        HideAllEditDivs();

        switch (Type)
        {
        case 1:                 //section
        {
            sectionEditDiv.Visible = true;
            sectionEditDiv.Style.Add("display", "block");

            if (id > 0)
            {
                PatientEdSection section = new PatientEdSection();
                section.Get(id);
                SectionTitleTxtBox.Text = section[PatientEdSection.SectionName].ToString();
                SectionDesc.Text        = section[PatientEdSection.SectionDescription].ToString();
            }
            break;
        }

        case 2:                 //topic
        {
            if (id > 0)
            {
                topicEditDiv.Visible = true;
                topicEditDiv.Style.Add("display", "block");

                PatientEdTopic topic = new PatientEdTopic();
                topic.Get(id);
                TopicTitleTxtBox.Text = topic[PatientEdTopic.TopicName].ToString();
                TopicDesc.Text        = topic[PatientEdTopic.TopicDescription].ToString();

                //PatientEdSection section = new PatientEdSection();
                //section.Get(Int32.Parse(topic[PatientEdTopic.SectionId].ToString()));
                //SectionTitle.Text = section[PatientEdSection.SectionName].ToString();
            }
            else
            {
                topicEditDiv.Visible = true;
                topicEditDiv.Style.Add("display", "block");

                //PatientEdSection section = new PatientEdSection();
                //section.Get(Int32.Parse(Request.QueryString["sectionId"]));
                //SectionTitle.Text = section[PatientEdSection.SectionName].ToString();
            }
            break;
        }

        case 3:                 //subtopic
        {
            if (id > 0)
            {
                subTopicEditDiv.Visible = true;
                subTopicEditDiv.Style.Add("display", "block");

                PatientEdSubTopic subtopicBO = new PatientEdSubTopic();
                subtopicBO.Get(id);
                SubTopicTitleTxtBox.Text = subtopicBO[PatientEdSubTopic.SubTopicName].ToString();
                SubTopicContentRTE.Text  = subtopicBO[PatientEdSubTopic.SubTopicContent].ToString();

                //PatientEdTopic topic = new PatientEdTopic();
                //topic.Get(Int32.Parse(subtopicBO[PatientEdSubTopic.TopicId].ToString()));
                //StTopicTitle.Text = topic[PatientEdTopic.TopicName].ToString();

                //PatientEdSection section = new PatientEdSection();
                //section.Get(Int32.Parse(topic[PatientEdTopic.SectionId].ToString()));
                //StSectionTitle.Text = section[PatientEdSection.SectionName].ToString();
            }
            else
            {
                subTopicEditDiv.Visible = true;
                subTopicEditDiv.Style.Add("display", "block");

                //PatientEdTopic topic = new PatientEdTopic();
                //topic.Get(Int32.Parse(Request.QueryString["topicId"]));
                //StTopicTitle.Text = topic[PatientEdTopic.TopicName].ToString();

                //PatientEdSection section = new PatientEdSection();
                //section.Get(Int32.Parse(Request.QueryString["sectionId"]));
                //StSectionTitle.Text = section[PatientEdSection.SectionName].ToString();
            }
            break;
        }
        }
    }
Esempio n. 4
0
    protected void SaveContent()
    {
        int id = Id;

        switch (Type)
        {
        case 1:
        {
            if (id > 0)
            {
                PatientEdSection sec = new PatientEdSection();
                sec.Get(Id);
                sec[PatientEdSection.SectionName]        = SectionTitleTxtBox.Text;
                sec[PatientEdSection.SectionDescription] = SectionDesc.Text;
                sec.Save();
                RegisterParentFormTitleUpdate("Section", id.ToString(), SectionTitleTxtBox.Text);
            }
            else
            {
                PatientEdSection sec = new PatientEdSection();
                sec[PatientEdSection.SectionName]        = SectionTitleTxtBox.Text;
                sec[PatientEdSection.SectionDescription] = SectionDesc.Text;
                sec.Save();
                string contentType = "Section";
                string contentId   = sec[PatientEdSection.SectionId].ToString();
                RegisterParentFormRefresh("Section", contentId);
            }

            break;
        }

        case 2:
        {
            PatientEdTopic topic = new PatientEdTopic();
            if (id > 0)
            {
                topic.Get(Id);
                RegisterParentFormTitleUpdate("Topic", id.ToString(), TopicTitleTxtBox.Text);
            }
            else
            {
                string sectionId = Request.QueryString["sectionId"];
                if (!string.IsNullOrEmpty(sectionId))
                {
                    topic[PatientEdTopic.SectionId] = sectionId;
                }
                else
                {
                    break;
                }
            }
            topic[PatientEdTopic.TopicName]        = TopicTitleTxtBox.Text;
            topic[PatientEdTopic.TopicDescription] = TopicDesc.Text;
            topic.Save();

            if (id == 0)
            {
                string contentType = "Topic";
                string contentId   = topic[PatientEdTopic.TopicId].ToString();
                RegisterParentFormRefresh(contentType, contentId);
            }
            break;
        }

        case 3:
        {
            PatientEdSubTopic subtopic = new PatientEdSubTopic();
            if (id > 0)
            {
                subtopic.Get(Id);
                RegisterParentFormTitleUpdate("SubTopic", id.ToString(), SubTopicTitleTxtBox.Text);
            }
            else
            {
                string topicId = Request.QueryString["topicId"];
                if (!string.IsNullOrEmpty(topicId))
                {
                    subtopic[PatientEdSubTopic.TopicId] = topicId;
                }
                else
                {
                    break;
                }
            }
            subtopic[PatientEdSubTopic.SubTopicName]    = SubTopicTitleTxtBox.Text;
            subtopic[PatientEdSubTopic.SubTopicContent] = SubTopicContentRTE.Text;
            subtopic.Save();

            if (id == 0)
            {
                string contentType = "SubTopic";
                string contentId   = subtopic[PatientEdSubTopic.SubTopicId].ToString();
                RegisterParentFormRefresh(contentType, contentId);
            }
            break;
        }
        }
    }