コード例 #1
0
        private void PasteNode()
        {
            if (trvDisplay.SelectedNode is CallTreeQuestionNode)
            {
                CallTreeQuestionNode currentNode = (CallTreeQuestionNode)trvDisplay.SelectedNode;

                if (currentNode.Question.type == question.QuestionTypes.Category)
                {
                    trvDisplay.SelectedNode.Nodes.Insert(0, _cutNode);
                    _cutNode.Question.parent = currentNode.Question.id;
                    currentNode.Expand();
                    ForceReorderNodes(_cutNode);
                }
                else
                {
                    trvDisplay.SelectedNode.Parent.Nodes.Insert(0, _cutNode);
                    _cutNode.Question.parent = ((CallTreeQuestionNode)trvDisplay.SelectedNode.Parent).Question.id;

                    ForceReorderNodes(_cutNode);
                }
            }
            else
            {
                trvDisplay.Nodes[0].Nodes.Insert(0, _cutNode);
                _cutNode.Question.parent = 0;

                ForceReorderNodes(_cutNode);
            }
            EnableCut(true);
            _cutNode = null;
        }
コード例 #2
0
        private void InitializeCallTree(CallTreeQuestionNode selectNode)
        {
            claim           c         = new claim();
            List <question> Questions = c.Questions;

            trvDisplay.Nodes.Clear();
            trvDisplay.Nodes.Add("Base");
            trvDisplay.Nodes[0].ImageIndex         = 0;
            trvDisplay.Nodes[0].SelectedImageIndex = 0;
            // Initialize CallTreeView
            foreach (question q in Questions)
            {
                if (String.IsNullOrEmpty(q.required_answer))
                {
                    AddQuestionToTree(q, trvDisplay.Nodes[0]);
                }
            }


            trvDisplay.Nodes[0].Expand();

            if (selectNode != null)
            {
                // Find the old node somehow
                FindNode(selectNode, trvDisplay.Nodes[0]);
            }
        }
コード例 #3
0
 private void cmdCut_Click(object sender, EventArgs e)
 {
     if (trvDisplay.SelectedNode is CallTreeQuestionNode)
     {
         _cutNode = (CallTreeQuestionNode)trvDisplay.SelectedNode;
         trvDisplay.SelectedNode.Remove();
         EnableCut(false);
     }
 }
コード例 #4
0
 public CallManager()
 {
     _IsCallInProgress    = false;
     _IsCallOnHold        = false;
     OnHoldIsDrawn        = false;
     currentChoiceIsDirty = false;
     currentCallNode      = null;
     currentQuestionNode  = null;
     onHoldStarted        = DateTime.MinValue;
     _questions           = new List <question>();
     _pastCalls           = new List <call>();
     InitializeComponent();
     this.tvwCall.LineColor = SystemColors.GrayText;
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
 }
コード例 #5
0
        private void trvDisplay_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("C_DentalClaimTracker.CallTreeQuestionNode", false))
            {
                Point    pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);



                _cutNode = (CallTreeQuestionNode)e.Data.GetData("C_DentalClaimTracker.CallTreeQuestionNode", true);
                trvDisplay.Nodes.Remove(_cutNode);
                trvDisplay.SelectedNode = DestinationNode;
                EnableCut(false);

                PasteNode();
            }
        }
コード例 #6
0
 private void trvDisplay_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (trvDisplay.SelectedNode is CallTreeQuestionNode)
     {
         CallTreeQuestionNode cn = (CallTreeQuestionNode)trvDisplay.SelectedNode;
         _currentQuestion = cn.Question;
         LoadCurrentQuestion();
         pnlDetailsPanel.Enabled = true;
         EnableOptionsPanel(true);
     }
     else
     {
         pnlDetailsPanel.Enabled = false;
         EnableOptionsPanel(false);
     }
     QuestionChanged(false);
 }
コード例 #7
0
        private void MarkParentAnswered(CallTreeQuestionNode node, bool isAnswered)
        {
            CallTreeQuestionNode parentNode = node.Parent as CallTreeQuestionNode;

            if (parentNode != null)
            {
                int categoryIndex;
                int standardIndex;
                if (isAnswered)
                {
                    categoryIndex = 2;
                    standardIndex = 4;
                }
                else
                {
                    categoryIndex = 1;
                    standardIndex = 3;
                }

                if (parentNode.Question.type == question.QuestionTypes.Category)
                {
                    parentNode.ImageIndex         = categoryIndex;
                    parentNode.SelectedImageIndex = categoryIndex;
                }
                else
                {
                    parentNode.ImageIndex         = standardIndex;
                    parentNode.SelectedImageIndex = standardIndex;
                }


                if (parentNode.Parent != null)
                {
                    if (isAnswered)
                    {
                        MarkParentAnswered(parentNode, true);
                    }
                    else
                    {
                        UpdateParentImage(parentNode);
                    }
                }
            }
        }
コード例 #8
0
        private void FindNode(CallTreeQuestionNode selectNode, TreeNode currentSearchNode)
        {
            if (trvDisplay.SelectedNode == null)
            {
                foreach (CallTreeQuestionNode tn in currentSearchNode.Nodes)
                {
                    if (tn.Question.id == selectNode.Question.id)
                    {
                        trvDisplay.SelectedNode = tn;
                        break;
                    }

                    if (tn.Nodes.Count > 0)
                    {
                        FindNode(selectNode, tn);
                    }
                }
            }
        }
コード例 #9
0
        private CallTreeQuestionNode SetQuestionImage(question questionToAdd, CallTreeQuestionNode newNode)
        {
            if (System.Convert.ToBoolean(questionToAdd.is_fork))
            {
                newNode.ImageIndex         = 5;
                newNode.SelectedImageIndex = 5;
            }
            else if (questionToAdd.type == question.QuestionTypes.Category)
            {
                newNode.ImageIndex         = 1;
                newNode.SelectedImageIndex = 1;
            }
            else
            {
                newNode.ImageIndex         = 3;
                newNode.SelectedImageIndex = 3;
            }

            return(newNode);
        }
コード例 #10
0
        private void UpdateParentImage(CallTreeQuestionNode node)
        {
            CallTreeQuestionNode parentNode = node.Parent as CallTreeQuestionNode;

            if (parentNode != null)
            {
                bool hasAnsweredQuestions = false;

                foreach (CallTreeQuestionNode aNode in parentNode.Nodes)
                {
                    if (aNode.Choice != null)
                    {
                        hasAnsweredQuestions = true;
                        break;
                    }
                    else if (aNode.Question.type == question.QuestionTypes.Category)
                    {
                        if (aNode.ImageIndex == 2)
                        {
                            hasAnsweredQuestions = true;
                            break;
                        }
                    }
                }

                if (parentNode.Question.type != question.QuestionTypes.Category)
                {
                    if (parentNode.Choice != null)
                    {
                        hasAnsweredQuestions = true;
                    }
                }

                MarkParentAnswered(node, hasAnsweredQuestions);
            }
        }
コード例 #11
0
        private CallTreeQuestionNode AddQuestionToTree(question questionToAdd, TreeNode parentNode)
        {
            CallTreeQuestionNode newNode = new CallTreeQuestionNode(questionToAdd);

            newNode      = SetQuestionImage(questionToAdd, newNode);
            newNode.Text = questionToAdd.text;
            newNode.Name = questionToAdd.id.ToString();

            if (parentNode == null)
            {
                trvDisplay.Nodes.Add(newNode);
            }
            else
            {
                parentNode.Nodes.Add(newNode);
            }

            foreach (question cq in questionToAdd.SubQuestions)
            {
                AddQuestionToTree(cq, newNode);
            }

            return(newNode);
        }
コード例 #12
0
        private void tvwCall_AfterSelect(object sender, TreeViewEventArgs e)
        {
            CallTreeQuestionNode qNode = tvwCall.SelectedNode as CallTreeQuestionNode;

            currentQuestionNode = null;

            if (qNode != null)
            {
                if (!pnlDataEntry.Visible)
                {
                    pnlDataEntry.Visible = true;
                }

                if (currentChoicePanel != null)
                {
                    currentChoicePanel.Visible = false;
                }

                lblDataDescription.Text = qNode.Question.popup_question_text;

                switch (qNode.Question.type)
                {
                case question.QuestionTypes.Category:
                    currentChoicePanel   = null;
                    pnlDataEntry.Visible = false;
                    break;

                case question.QuestionTypes.Date:
                    currentChoicePanel  = pnlChoiceDate;
                    pnlDataEntry.Height = 66;
                    if (qNode.Choice != null)
                    {
                        DateTime choiceDate;
                        if (DateTime.TryParse(qNode.Choice.answer, out choiceDate))
                        {
                            ctlDate.CurrentDate = choiceDate;
                        }
                        else if (qNode.Choice.answer == "")
                        {
                            ctlDate.CurrentDate = null;
                        }
                        else
                        {
                            ctlDate.CurrentDate = DateTime.Now;
                        }
                    }
                    else
                    {
                        ctlDate.SetDefaultDate(DateTime.Now);
                    }
                    break;

                case question.QuestionTypes.LargeText:
                    currentChoicePanel  = pnlChoiceLargeText;
                    pnlDataEntry.Height = 125;
                    if (qNode.Choice != null)
                    {
                        txtLarge.Text = qNode.Choice.answer;
                    }
                    else
                    {
                        txtLarge.Text = "";
                    }
                    break;

                case question.QuestionTypes.MultipleChoice:
                    currentChoicePanel  = pnlChoiceMultiple;
                    pnlDataEntry.Height = 100;
                    cmbMultipleChoice.Items.Clear();

                    // Use ComboBox
                    foreach (multiple_choice_answer mca in qNode.Question.MultipleChoiceAnswers)
                    {
                        cmbMultipleChoice.Items.Add(mca);
                    }

                    if (qNode.Choice != null)
                    {
                        for (int i = 0; i < cmbMultipleChoice.Items.Count; i++)
                        {
                            if (cmbMultipleChoice.Items[i].ToString() == qNode.Choice.answer)
                            {
                                cmbMultipleChoice.SelectedIndex = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        cmbMultipleChoice.SelectedIndex = -1;
                    }



                    break;

                case question.QuestionTypes.NormalText:
                    currentChoicePanel  = pnlChoiceNormalText;
                    pnlDataEntry.Height = 66;
                    if (qNode.Choice != null)
                    {
                        txtNormal.Text = qNode.Choice.answer;
                    }
                    else
                    {
                        txtNormal.Text = "";
                    }
                    break;

                case question.QuestionTypes.Numeric:
                    currentChoicePanel  = pnlChoiceNumeric;
                    pnlDataEntry.Height = 66;
                    if (qNode.Choice != null)
                    {
                        if (CommonFunctions.IsNumeric(qNode.Choice.answer))
                        {
                            numNumber.Value = Convert.ToDecimal(qNode.Choice.answer);
                        }
                        else
                        {
                            numNumber.Value = 0;
                        }
                    }
                    else
                    {
                        numNumber.Value = 0;
                    }
                    break;

                case question.QuestionTypes.SmallText:
                    currentChoicePanel  = pnlChoiceSmallText;
                    pnlDataEntry.Height = 100;
                    if (qNode.Choice != null)
                    {
                        txtSmall.Text = qNode.Choice.answer;
                    }
                    else
                    {
                        txtSmall.Text = "";
                    }
                    break;

                case question.QuestionTypes.YesNo:
                    currentChoicePanel  = pnlChoiceYesNo;
                    pnlDataEntry.Height = 84;
                    if (qNode.Choice != null)
                    {
                        bool YesNo = CommonFunctions.FromYesNo(qNode.Choice.answer);
                        if (YesNo)
                        {
                            radYes.Checked = true;
                        }
                        else
                        {
                            radNo.Checked = true;
                        }
                    }
                    else
                    {
                        radYes.Checked = false;
                        radNo.Checked  = false;
                    }
                    break;

                default:
                    if (pnlDataEntry.Visible)
                    {
                        pnlDataEntry.Visible = false;
                    }
                    currentChoicePanel = null;
                    break;
                }

                if (qNode.Choice == null)
                {
                    cmdClearAnswer.Visible = false;
                }
                else
                {
                    cmdClearAnswer.Visible = false;
                }

                if (currentChoicePanel != null)
                {
                    currentChoicePanel.Visible = true;
                    currentQuestionNode        = qNode;
                }
            }
            else
            {
                pnlDataEntry.Visible = false;
                currentQuestionNode  = null;
            }
            tvwCall.SelectedNode.EnsureVisible();
        }
コード例 #13
0
        private void AddQuestionToTree(CallQuestion callQuestion, TreeNode parentNode)
        {
            CallTreeQuestionNode newNode = new CallTreeQuestionNode(callQuestion.Question);

            if (callQuestion.IsAnswered)
            {
                if (callQuestion.Question.type == question.QuestionTypes.Category)
                {
                    newNode.ImageIndex         = 2;
                    newNode.SelectedImageIndex = 2;
                }
                else
                {
                    newNode.ImageIndex         = 4;
                    newNode.SelectedImageIndex = 4;
                }

                if (callQuestion.Choice != null)
                {
                    newNode.Choice = callQuestion.Choice;
                }
                else if (callQuestion.Question.type != question.QuestionTypes.Category)
                {
                }
            }
            else
            {
                if (callQuestion.Question.type == question.QuestionTypes.Category)
                {
                    newNode.ImageIndex         = 1;
                    newNode.SelectedImageIndex = 1;
                }
                else
                {
                    newNode.ImageIndex         = 3;
                    newNode.SelectedImageIndex = 3;
                }
            }

            newNode.Text = callQuestion.Question.text;

            if (newNode.Choice != null)
            {
                if (newNode.Question.type == question.QuestionTypes.YesNo)
                {
                    if (newNode.Choice.answer == true.ToString())
                    {
                        newNode.Text += ": Yes";
                    }
                    else if (newNode.Choice.answer == false.ToString())
                    {
                        newNode.Text += ": No";
                    }
                }
                else
                {
                    newNode.Text += ": " + newNode.Choice.answer;
                }
            }

            newNode.Name = callQuestion.Question.id.ToString();

            if (parentNode == null)
            {
                tvwCall.Nodes.Add(newNode);
            }
            else
            {
                parentNode.Nodes.Add(newNode);
            }

            foreach (CallQuestion cq in callQuestion.SubQuestions)
            {
                if (!String.IsNullOrEmpty(cq.Question.required_answer))
                {
                    if (!IsCallInProgress)
                    {
                        if (cq.IsAnswered)
                        {
                            AddQuestionToTree(cq, newNode);
                        }
                    }
                    else
                    {
                        if ((callQuestion.Choice != null) && (callQuestion.Choice.answer == cq.Question.required_answer))
                        {
                            AddQuestionToTree(cq, newNode);
                        }
                    }
                }
                else
                {
                    if (!IsCallInProgress)
                    {
                        if (cq.IsAnswered == true)
                        {
                            // If the parent question is answered then subquestions must be also
                            // This means a new call will load all questions, but existing calls
                            // will only load questions that have been answered

                            AddQuestionToTree(cq, newNode);
                        }
                    }
                    else
                    {
                        AddQuestionToTree(cq, newNode);
                    }
                }
            }
        }