示例#1
0
        /// <summary>
        /// Creates a fixedlistfillinanswer from an item record in TE
        /// </summary>
        /// <remarks>
        /// Mapping info:
        /// answerid = ChecklistTemplateItemCkey
        /// title = VisibleText
        /// </remarks>
        /// <param name="dr">item record with information for a fillin answer (item type of 20)</param>
        /// <returns>a fixedlistfillinanswer class for the specific item</returns>
        private fixedlistfillinanswer MapAnswerFillin(DataRow dr)
        {
            fixedlistfillinanswer a = _srTmpTreeBuilder.MapAnswerFillin(
                //!Base item metadata
                (String)(dr["type"]),         //need standard type lists for Q, H, A, AF, Note, etc
                (String)(dr["styleClass"]),   //
                (String)(dr["ShortName"]),    //@name

                //!All Displayed Items
                (Decimal)(dr["ChecklistTemplateItemCkey"]),
                (String)(dr["VisibleText"]),  //@title or @val
                (String)(dr["longText"]),     //@alt-TextElementEnumerator in eCC, OtherText in SDC
                (String)(dr["ReportText"]),   //OtherText element in SDC

                (Boolean)(dr["enabled"]),
                !(Boolean)(dr["Hidden"]),     //may conflict with styleClass, and may not be used; may be usefu for reporting notes/coments
                (String)(dr["ControlTip"]),   //@toolTip
                (String)(dr["popupText"]),    //@popupText
                (String)(dr["linkText"]),
                (String)(dr["linkText2"]),
                (String)(dr["AuthorityID"]),      //@AuthorityID
                (Boolean)(dr["showInReport"]),    //values are true, false, conditional
                (Boolean)(dr["mustImplement"]),
                (Int32)(dr["SortOrder"]),

                //!List Items (A, AF)
                (Boolean)(dr["SelectionDisablesChildren"]),  //sdc
                (Boolean)(dr["SelectionDeselectsSiblings"]), //sds
                (Boolean)(dr["omitWhenSelected"]),

                //!Response items QF and AF
                (String)(dr["DataType"]),
                (String)(dr["AnswerUnits"]),      //@answer-units
                (String)(dr["TextAfterConcept"]), //@textAfterResponse

                //!AF only
                (Boolean)dr["responseRequired"]
                );

            return(a);
        }
示例#2
0
        /// <summary>
        /// Gets (creates) template xml by version ckey
        /// </summary>
        /// <param name="templateVersion">template version data</param>
        /// <param name="templateItems">template item data</param>
        /// <param name="templateProcedures">template procedure data</param>
        /// <returns>template for version ckey</returns>
        private template BuildTemplateObjectTree(DataTable templateVersion, DataTable templateItems, DataTable templateProcedures)
        {
            template aTemplate = null;
            Dictionary <Decimal, object> objectList = new Dictionary <Decimal, object>();

            if (templateVersion.Rows.Count == 0)
            {
                return(null);
            }
            aTemplate = MapTemplate(templateVersion.Rows[0]);
            // unmapped procedure until clarifications are completed
            //if (templateProcedures != null)
            //{
            //    foreach (DataRow dr in templateProcedures.Rows)
            //    {
            //        aTemplate.templateheader.procedures = aTemplate.templateheader.procedures.AddItem(MapProcedure(dr));
            //    }
            //}
            ////if (!objectList.ContainsKey(aTemplate.templateid))
            objectList.Add(aTemplate.templateid, aTemplate);
            if (templateItems.Rows.Count == 0)
            {
                return(aTemplate);
            }

            foreach (DataRow dr in templateItems.Rows)
            {
                object   o;
                ItemType?rowTypePrevious = null;
                var      rowType         = ItemMapper.MapItemType(Convert.ToInt32(dr["ItemTypeKey"]));
                // fixed to make all notes under question fixed list notes, rlm: in case TE modeler uses a Note instead of ComboNote
                // this is required to fix issues with ordering of all items under a question such as the WilmsTmrResx.xml template
                if (rowType == ItemType.NOTE && Convert.ToInt32(dr["IsParentQuestion"]) == 1)
                {
                    //if (rowTypePrevious==ItemType.ANSWER || rowTypePrevious == ItemType.ANSWERFILLIN || rowTypePrevious == ItemType.FIXEDLISTNOTE || rowTypePrevious==null)
                    rowType = ItemType.FIXEDLISTNOTE;
                }
                switch (rowType)
                {
                case ItemType.HEADER:
                    headergroup h = MapHeaderGroup(dr);
                    //// if (!objectList.ContainsKey(h.headergroupid))
                    objectList.Add(h.headergroupid, h);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddHeaderToItem(o, h);
                    }
                    break;

                case ItemType.NOTE:
                    note n = MapNote(dr);
                    //rlm: If the note is not already in the objectList, then add it
                    //if (!objectList.ContainsKey(n.noteid))
                    objectList.Add(n.noteid, n);
                    if (n.noteid == 36816.1000043M)
                    {
                    }
                    //rlm: If the Note's Parent item is already in the objectList, then connect the note to its Parent item
                    //rlm: If the Parent item is not present, then the note is not attached to the Parent
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddNoteToItem(o, n);
                    }
                    break;

                case ItemType.FIXEDLISTNOTE:
                    fixedlistnote note = MapFixedListNote(dr);
                    //if (!objectList.ContainsKey(note.noteid))
                    objectList.Add(note.noteid, note);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddFixedListNoteToItem(o, note);
                    }
                    break;

                case ItemType.QUESTIONSINGLE:
                    question q = MapQuestion(dr, ItemType.QUESTIONSINGLE);
                    //if (!objectList.ContainsKey(q.questionid))
                    objectList.Add(q.questionid, q);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddQuestionToItem(o, q);
                    }
                    break;

                case ItemType.QUESTIONMULTIPLE:
                    question q2 = MapQuestion(dr, ItemType.QUESTIONMULTIPLE);
                    //if (!objectList.ContainsKey(q2.questionid))
                    objectList.Add(q2.questionid, q2);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddQuestionToItem(o, q2);
                    }
                    break;

                case ItemType.QUESTIONFILLIN:
                    question q3 = MapQuestion(dr, ItemType.QUESTIONFILLIN);
                    //if (!objectList.ContainsKey(q3.questionid))
                    objectList.Add(q3.questionid, q3);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddQuestionToItem(o, q3);
                    }
                    break;

                case ItemType.ANSWER:
                    fixedlistitem item = MapAnswer(dr);
                    //if (!objectList.ContainsKey(item.answerid))
                    objectList.Add(item.answerid, item);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddAnswerToItem(o, item);
                    }
                    break;

                case ItemType.ANSWERFILLIN:
                    fixedlistfillinanswer a = MapAnswerFillin(dr);
                    //if (!objectList.ContainsKey(a.answerid))
                    objectList.Add(a.answerid, a);
                    if (objectList.ContainsKey(Convert.ToDecimal(dr["ParentItemCkey"])))
                    {
                        o = objectList[Convert.ToDecimal(dr["ParentItemCkey"])];
                        _srTmpTreeBuilder.AddAnswerToItem(o, a);
                    }
                    break;
                }
                //rowTypePrevious = rowType;
            }
            return(aTemplate);
        }