Пример #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);
        }
    }
Пример #2
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;
        }
        }
    }
Пример #3
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;
        }
        }
    }