SkimmingScanningPartCompletion ICedts_ItemXMLRepository.GetSspc(string text, string type)
        {
            SkimmingScanningPartCompletion sspc = new SkimmingScanningPartCompletion();
            ItemBassInfo info = new ItemBassInfo();

            doc = new XmlDocument();
            doc.LoadXml(text);
            node        = doc.SelectSingleNode("assessmentItem");//查找<assessmentItem>节点
            elem        = (XmlElement)node;
            info.ItemID = Guid.Parse(elem.GetAttribute("identifier"));
            info.Course = elem.GetAttribute("course");
            info.Unit   = elem.GetAttribute("unit");
            XmlNodeList nodeList = node.ChildNodes;//<assessmentItem>下的所有子节点

            info.QuestionCount     = nodeList.Count - 1;
            info.ItemType          = type;
            info.ItemType_CN       = "快速阅读";
            info.PartType          = "1";
            info.AnswerResposn     = "_";
            info.QustionInterval   = "";
            info.QuestionID        = new List <Guid>();
            info.AnswerValue       = new List <string>();
            info.Tip               = new List <string>();
            info.Problem           = new List <string>();
            info.DifficultQuestion = new List <double>();
            info.ScoreQuestion     = new List <double>();
            info.TimeQuestion      = new List <double>();

            sspc.Choices = new List <string>();

            info.Score     = 0.0;
            info.ReplyTime = 0.0;
            info.Diffcult  = 0.0;
            int tempnum = 0;

            for (int i = 0; i < nodeList.Count; i++)
            {
                if (i == 0)
                {
                    XmlElement pElem = (XmlElement)nodeList[i];//prompt节点

                    sspc.Content = pElem.InnerXml;

                    continue;
                }

                XmlElement qElem = (XmlElement)nodeList[i];//question节点
                if (qElem.GetAttribute("type") == "choice")
                {
                    tempnum++;
                    XmlNodeList qList = nodeList[i].ChildNodes;//question下的所有子节点

                    for (int j = 0; j < qList.Count; j++)
                    {
                        XmlElement pElem = (XmlElement)qList[j];

                        if (pElem.Name == "prompt")
                        {
                            info.Problem.Add(pElem.InnerXml);
                        }

                        if (pElem.Name == "choice")
                        {
                            XmlNodeList optionList = qList[j].ChildNodes;
                            for (int k = 0; k < optionList.Count; k++)
                            {
                                XmlElement oElem = (XmlElement)optionList[k];
                                if (oElem.Name == "option")
                                {
                                    sspc.Choices.Add(oElem.InnerXml);
                                }
                            }
                        }

                        if (pElem.Name == "key")
                        {
                            string[] answers = { "A", "B", "C", "D" };
                            int      temp    = int.Parse(pElem.InnerXml) - 1;
                            info.AnswerValue.Add(answers[temp]);
                        }
                    }

                    info.Tip.Add("");
                    info.ScoreQuestion.Add(1);
                    info.Score += 1;
                    info.TimeQuestion.Add(1.5);
                    info.ReplyTime += 1.5;
                    info.DifficultQuestion.Add(0.2);
                    info.Diffcult += 0.2;
                }
                else
                {
                    XmlNodeList qList = nodeList[i].ChildNodes;//question下的所有子节点

                    for (int j = 0; j < qList.Count; j++)
                    {
                        XmlElement pElem = (XmlElement)qList[j];

                        if (pElem.Name == "prompt")
                        {
                            while (pElem.InnerXml.IndexOf("<tag type=\"text\" />") > 0)
                            {
                                int index  = pElem.InnerXml.IndexOf("<tag type=\"text\" />");
                                int length = "<tag type=\"text\" />".Length;
                                pElem.InnerXml = pElem.InnerXml.Substring(0, index) + "____" + pElem.InnerXml.Substring(index + length);
                            }
                            info.Problem.Add(pElem.InnerXml);
                        }

                        if (pElem.Name == "key")
                        {
                            info.AnswerValue.Add(pElem.InnerXml);
                        }
                    }

                    info.Tip.Add("");
                    info.ScoreQuestion.Add(1);
                    info.Score += 1;
                    info.TimeQuestion.Add(1.5);
                    info.ReplyTime += 1.5;
                    info.DifficultQuestion.Add(0.4);
                    info.Diffcult += 0.4;
                }
            }

            info.Diffcult  = info.Diffcult / info.QuestionCount;
            sspc.Info      = info;
            sspc.ChoiceNum = tempnum;
            sspc.TermNum   = info.QuestionCount - tempnum;

            return(sspc);
        }
Example #2
0
        /// <summary>
        /// 查询当前点击的快速阅读信息
        /// </summary>
        /// <param name="item">AssessmentItemID</param>
        /// <returns>当前点击的快速阅读信息</returns>
        SkimmingScanningPartCompletion ICedts_AssignRepository.SelectSspc(Guid item)
        {
            var Assigns = (from As in db.CEDTS_Assign where As.AssessmentItemID == item orderby As.Time descending select As.QuestionID).FirstOrDefault();

            if (Assigns == null)
            {
                return(null);
            }
            else
            {
                string[]    Assign    = Assigns.Split(',');
                var         question1 = (from m in db.CEDTS_Question where m.AssessmentItemID == item orderby m.Order ascending select m).ToList();
                var         question  = (from m in db.CEDTS_Question where m.AssessmentItemID == item orderby m.Order ascending select m).ToList();
                var         assess    = (from m in db.CEDTS_AssessmentItem where m.AssessmentItemID == item select m).First();
                List <Guid> QID       = new List <Guid>();
                int         Count     = 0;
                for (int s = 0; s < Assign.Length; s++)
                {
                    QID.Add(Guid.Parse(Assign[s]));
                }

                foreach (var q in question1)
                {
                    if (!QID.Contains(q.QuestionID))
                    {
                        question.Remove(q);
                        if (Count == 0)
                        {
                            Count = assess.QuestionCount.Value - 1;
                        }
                        else
                        {
                            Count = Count - 1;
                        }
                    }
                }
                if (Count == 0)
                {
                    Count = assess.QuestionCount.Value;
                }
                var ChoiceNum  = (from m in db.CEDTS_Question where m.AssessmentItemID == item && m.ChooseA != "" orderby m.Order select m).ToList();
                var ChoiceNum1 = (from m in db.CEDTS_Question where m.AssessmentItemID == item && m.ChooseA != "" orderby m.Order select m).ToList();
                foreach (var c in ChoiceNum1)
                {
                    if (!QID.Contains(c.QuestionID))
                    {
                        ChoiceNum.Remove(c);
                    }
                }
                var TermNum  = (from m in db.CEDTS_Question where m.AssessmentItemID == item && m.ChooseA == "" orderby m.Order select m).ToList();
                var TermNum1 = (from m in db.CEDTS_Question where m.AssessmentItemID == item && m.ChooseA == "" orderby m.Order select m).ToList();
                foreach (var t in TermNum1)
                {
                    if (!QID.Contains(t.QuestionID))
                    {
                        TermNum.Remove(t);
                    }
                }
                var Itemtype = (from m in db.CEDTS_ItemType where m.ItemTypeID == assess.ItemTypeID select m).First();
                var PartType = (from m in db.CEDTS_PartType where m.PartTypeID == Itemtype.PartTypeID select m).First();


                ItemBassInfo info = new ItemBassInfo();
                info.AnswerValue       = new List <string>();
                info.Problem           = new List <string>();
                info.Tip               = new List <string>();
                info.QuestionID        = new List <Guid>();
                info.DifficultQuestion = new List <double>();
                info.ScoreQuestion     = new List <double>();
                SkimmingScanningPartCompletion Sspc = new SkimmingScanningPartCompletion();
                info.Knowledge     = new List <string>();
                info.KnowledgeID   = new List <string>();
                Sspc.Choices       = new List <string>();
                info.TimeQuestion  = new List <double>();
                info.ItemID        = item;
                info.Count         = Convert.ToInt32(assess.Count);
                info.ItemType      = Itemtype.TypeName;
                info.ItemType_CN   = Itemtype.TypeName_CN;
                info.PartType      = PartType.TypeName;
                info.QuestionCount = Convert.ToInt32(question.Count);
                info.ReplyTime     = Convert.ToInt32(assess.Duration);
                info.Diffcult      = Convert.ToDouble(assess.Difficult);
                info.Score         = Convert.ToInt32(assess.Score);
                Sspc.ChoiceNum     = ChoiceNum.Count;
                Sspc.TermNum       = TermNum.Count;
                Sspc.Content       = assess.Original;

                string QkID = null;
                foreach (var qu in question)
                {
                    var QkList = (from m in db.CEDTS_QuestionKnowledge where m.QuestionID == qu.QuestionID orderby m.Weight ascending select m.QuestionKnowledgeID).ToList();
                    foreach (var q in QkList)
                    {
                        QkID += q + ",";
                    }
                }
                QkID = QkID.Substring(0, QkID.LastIndexOf(","));
                info.QuestionKnowledgeID = QkID;

                foreach (var choic in ChoiceNum)
                {
                    info.QuestionID.Add(choic.QuestionID);
                    info.Problem.Add(choic.QuestionContent);
                    info.ScoreQuestion.Add(choic.Score.Value);
                    info.TimeQuestion.Add(choic.Duration.Value);
                    info.DifficultQuestion.Add(choic.Difficult.Value);
                    Sspc.Choices.Add(choic.ChooseA);
                    Sspc.Choices.Add(choic.ChooseB);
                    Sspc.Choices.Add(choic.ChooseC);
                    Sspc.Choices.Add(choic.ChooseD);
                    info.AnswerValue.Add(choic.Answer);
                    info.Tip.Add(choic.Analyze);
                }

                foreach (var term in TermNum)
                {
                    info.QuestionID.Add(term.QuestionID);
                    info.Problem.Add(term.QuestionContent);
                    info.ScoreQuestion.Add(term.Score.Value);
                    info.TimeQuestion.Add(term.Duration.Value);
                    info.DifficultQuestion.Add(term.Difficult.Value);
                    info.AnswerValue.Add(term.Answer);
                    info.Tip.Add(term.Analyze);
                }

                foreach (var list in question)
                {
                    string name = string.Empty;
                    string id   = string.Empty;

                    var KnowledgeList = (from m in db.CEDTS_QuestionKnowledge where m.QuestionID == list.QuestionID orderby m.Weight ascending select m.KnowledgePointID).ToList();
                    foreach (var Knowledge in KnowledgeList)
                    {
                        var KnowledgeName = (from m in db.CEDTS_KnowledgePoints where m.KnowledgePointID == Knowledge select m).First();
                        id   += KnowledgeName.KnowledgePointID + ",";
                        name += KnowledgeName.Title + ",";
                    }
                    name = name.Substring(0, name.LastIndexOf(","));
                    id   = id.Substring(0, id.LastIndexOf(','));
                    info.KnowledgeID.Add(id);
                    info.Knowledge.Add(name);
                }
                Sspc.Info = info;
                return(Sspc);
            }
        }
Example #3
0
        List <SkimmingScanningPartCompletion> ICedts_TemporaryPaperRepository.SelectEditSspc(Guid id, int UserID)
        {
            List <SkimmingScanningPartCompletion> SspcList = new List <SkimmingScanningPartCompletion>();

            var AssmentIDList = (from m in db.CEDTS_TemporaryPaperAssessment where m.PaperID == id && m.ItemTypeID == 1 orderby m.Weight ascending select m.AssessmentItemID).ToList();

            foreach (var AssmentID in AssmentIDList)
            {
                var question  = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssmentID orderby m.Order ascending select m).ToList();
                var ChoiceNum = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssmentID && m.ChooseA != "" && m.QuestionContent != null orderby m.Order select m).ToList();
                var TermNum   = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssmentID && m.ChooseA == "" orderby m.Order select m).ToList();
                var Assess    = (from m in db.CEDTS_TemporaryAssessmentItem where m.AssessmentItemID == AssmentID select m).FirstOrDefault();
                SkimmingScanningPartCompletion Sspc = new SkimmingScanningPartCompletion();
                ItemBassInfo info = new ItemBassInfo();
                info.ItemID            = AssmentID.Value;
                Sspc.Choices           = new List <string>();
                info.ScoreQuestion     = new List <double>();
                info.TimeQuestion      = new List <double>();
                info.DifficultQuestion = new List <double>();
                info.Problem           = new List <string>();
                info.KnowledgeID       = new List <string>();
                info.AnswerValue       = new List <string>();
                info.Tip        = new List <string>();
                info.QuestionID = new List <Guid>();
                info.Knowledge  = new List <string>();


                info.Count         = Assess.Count.Value;
                info.ItemType      = "1";
                info.ItemType_CN   = "快速阅读";
                info.PartType      = "1";
                info.QuestionCount = Assess.QuestionCount.Value;
                info.ReplyTime     = Assess.Duration.Value;
                info.Diffcult      = Assess.Difficult.Value;
                info.Score         = Assess.Score.Value;
                Sspc.ChoiceNum     = ChoiceNum.Count;
                Sspc.TermNum       = TermNum.Count;
                Sspc.Content       = Assess.Original;

                string QkID = null;
                if (UserID == 1)
                {
                    foreach (var qu in question)
                    {
                        var QkList = (from m in db.CEDTS_TemporaryQuestionKnowledge where m.QuestionID == qu.QuestionID orderby m.Weight ascending select m.QuestionKnowledgeID).ToList();
                        foreach (var q in QkList)
                        {
                            QkID += q + ",";
                        }
                    }
                    QkID = QkID.Substring(0, QkID.LastIndexOf(","));
                }
                info.QuestionKnowledgeID = QkID;

                foreach (var choic in ChoiceNum)
                {
                    info.QuestionID.Add(choic.QuestionID);
                    info.Problem.Add(choic.QuestionContent);
                    info.ScoreQuestion.Add(choic.Score.Value);
                    info.TimeQuestion.Add(choic.Duration.Value);
                    info.DifficultQuestion.Add(choic.Difficult.Value);
                    Sspc.Choices.Add(choic.ChooseA);
                    Sspc.Choices.Add(choic.ChooseB);
                    Sspc.Choices.Add(choic.ChooseC);
                    Sspc.Choices.Add(choic.ChooseD);
                    info.AnswerValue.Add(choic.Answer);
                    info.Tip.Add(choic.Analyze);
                }

                foreach (var term in TermNum)
                {
                    info.QuestionID.Add(term.QuestionID);
                    info.Problem.Add(term.QuestionContent);
                    info.ScoreQuestion.Add(term.Score.Value);
                    info.TimeQuestion.Add(term.Duration.Value);
                    info.DifficultQuestion.Add(term.Difficult.Value);
                    info.AnswerValue.Add(term.Answer);
                    info.Tip.Add(term.Analyze);
                }

                if (UserID == 1)
                {
                    foreach (var list in question)
                    {
                        string name = string.Empty;
                        string Qkid = string.Empty;

                        var KnowledgeList = (from m in db.CEDTS_TemporaryQuestionKnowledge where m.QuestionID == list.QuestionID orderby m.Weight ascending select m.KnowledgePointID).ToList();
                        foreach (var Knowledge in KnowledgeList)
                        {
                            var KnowledgeName = (from m in db.CEDTS_KnowledgePoints where m.KnowledgePointID == Knowledge select m).FirstOrDefault();
                            Qkid += KnowledgeName.KnowledgePointID + ",";
                            name += KnowledgeName.Title + ",";
                        }
                        name = name.Substring(0, name.LastIndexOf(","));
                        Qkid = Qkid.Substring(0, Qkid.LastIndexOf(','));
                        info.KnowledgeID.Add(Qkid);
                        info.Knowledge.Add(name);
                    }
                }
                Sspc.Info = info;
                SspcList.Add(Sspc);
            }
            return(SspcList);
        }