/// <summary> /// 查询当前点击的阅读理解-选词填空信息 /// </summary> /// <param name="item">AssessmentItemID</param> /// <returns>当前点击的阅读理解-选词填空信息</returns> ReadingPartCompletion ICedts_AssignRepository.SelectRpc(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 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(); var Expansion = (from m in db.CEDTS_Expansion where m.AssessmentItemID == item 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>(); ReadingPartCompletion Rpc = new ReadingPartCompletion(); info.Knowledge = new List <string>(); info.KnowledgeID = new List <string>(); info.TimeQuestion = new List <double>(); Rpc.WordList = new List <string>(); 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); Rpc.Content = assess.Original; Rpc.ExpansionID = Expansion.ExpansionID; Rpc.WordList.Add(Expansion.ChoiceA); Rpc.WordList.Add(Expansion.ChoiceB); Rpc.WordList.Add(Expansion.ChoiceC); Rpc.WordList.Add(Expansion.ChoiceD); Rpc.WordList.Add(Expansion.ChoiceE); Rpc.WordList.Add(Expansion.ChoiceF); Rpc.WordList.Add(Expansion.ChoiceG); Rpc.WordList.Add(Expansion.ChoiceH); Rpc.WordList.Add(Expansion.ChoiceI); Rpc.WordList.Add(Expansion.ChoiceJ); Rpc.WordList.Add(Expansion.ChoiceK); Rpc.WordList.Add(Expansion.ChoiceL); Rpc.WordList.Add(Expansion.ChoiceM); Rpc.WordList.Add(Expansion.ChoiceN); Rpc.WordList.Add(Expansion.ChoiceO); 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 list in question) { info.QuestionID.Add(list.QuestionID); info.ScoreQuestion.Add(list.Score.Value); info.TimeQuestion.Add(list.Duration.Value); info.DifficultQuestion.Add(list.Difficult.Value); info.AnswerValue.Add(list.Answer); info.Tip.Add(list.Analyze); 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); } Rpc.Info = info; return(Rpc); } }
ReadingPartCompletion ICedts_ItemXMLRepository.GetRpc(string text, string type) { ReadingPartCompletion rpc = new ReadingPartCompletion(); 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 - 2; info.ItemType = type; info.ItemType_CN = "阅读理解选词填空"; info.PartType = "3"; 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>(); rpc.WordList = new List <string>(); info.Score = 0.0; info.ReplyTime = 0.0; info.Diffcult = 0.0; for (int i = 0; i < nodeList.Count; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i];//prompt节点 int a = 0; while (pElem.InnerXml.IndexOf("<tag type=\"choice\" />") > 0) { a++; int index = pElem.InnerXml.IndexOf("<tag type=\"choice\" />"); int length = "<tag type=\"choice\" />".Length; pElem.InnerXml = pElem.InnerXml.Substring(0, index) + "(_" + a + "_)" + pElem.InnerXml.Substring(index + length); } rpc.Content = pElem.InnerXml; continue; } if (i == 1) { XmlElement cElem = (XmlElement)nodeList[i];//Chioce节点 XmlNodeList optionList = nodeList[i].ChildNodes; for (int k = 0; k < optionList.Count; k++) { XmlElement oElem = (XmlElement)optionList[k]; if (oElem.Name == "option") { rpc.WordList.Add(oElem.InnerXml); } } continue; } XmlElement qElem = (XmlElement)nodeList[i];//question节点 string[] answers = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O" }; int tempnum = int.Parse(qElem.FirstChild.InnerXml); info.AnswerValue.Add(answers[tempnum - 1]); info.Tip.Add(""); info.Problem.Add(""); info.ScoreQuestion.Add(1); info.Score += 1; info.TimeQuestion.Add(0.75); info.ReplyTime += 0.75; info.DifficultQuestion.Add(0.4); info.Diffcult += 0.4; } info.Diffcult = info.Diffcult / info.QuestionCount; rpc.Info = info; return(rpc); }
ReadingPartOption ICedts_ItemXMLRepository.GetRpo(string text, string type) { ReadingPartOption rpo = new ReadingPartOption(); 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").ToUpper()); 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 = "3"; 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>(); rpo.Choices = new List <string>(); info.Score = 0.0; info.ReplyTime = 0.0; info.Diffcult = 0.0; for (int i = 0; i < nodeList.Count; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i];//prompt节点 rpo.Content = pElem.InnerXml; continue; } XmlElement qElem = (XmlElement)nodeList[i]; //question节点 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") { rpo.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.5); info.Score += 1.5; info.TimeQuestion.Add(1.5); info.ReplyTime += 1.5; info.DifficultQuestion.Add(0.4); info.Diffcult += 0.4; } info.Diffcult = info.Diffcult / info.QuestionCount; rpo.Info = info; return(rpo); }
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); }
ClozePart ICedts_ItemXMLRepository.GetCp(string text, string type) { ClozePart cp = new ClozePart(); 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 = "4"; 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>(); cp.Choices = new List <string>(); info.Score = 0.0; info.ReplyTime = 0.0; info.Diffcult = 0.0; for (int i = 0; i < nodeList.Count; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i];//prompt节点 int a = 0; while (pElem.InnerXml.IndexOf("<tag type=\"choice\" />") > 0) { a++; int index = pElem.InnerXml.IndexOf("<tag type=\"choice\" />"); int length = "<tag type=\"choice\" />".Length; pElem.InnerXml = pElem.InnerXml.Substring(0, index) + "(_" + a + "_)" + pElem.InnerXml.Substring(index + length); } cp.Content = pElem.InnerXml; continue; } XmlNodeList qList = nodeList[i].ChildNodes;//question下的所有子节点 for (int j = 0; j < qList.Count; j++) { XmlElement pElem = (XmlElement)qList[j]; 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") { cp.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.Problem.Add(""); info.ScoreQuestion.Add(0.5); info.Score += 0.5; info.TimeQuestion.Add(0.75); info.ReplyTime += 0.75; info.DifficultQuestion.Add(0.4); info.Diffcult += 0.4; } info.Diffcult = info.Diffcult / info.QuestionCount; cp.Info = info; return(cp); }
Listen ICedts_ItemXMLRepository.Getlisten(string text, string type) { Listen listen = new Listen(); 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>下的所有子节点 if (type == "2") { info.QuestionCount = nodeList.Count; } else if (type == "5") { info.QuestionCount = nodeList.Count - 2; } else { info.QuestionCount = nodeList.Count - 1; } info.ItemType = type; info.PartType = "2"; 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.questionSound = new List <string>(); info.TimeQuestion = new List <double>(); info.timeInterval = new List <int>(); listen.Choices = new List <string>(); info.Score = 0.0; info.ReplyTime = 0.0; info.Diffcult = 0.0; switch (type) { #region 短对话听力 case "2": { info.ItemType_CN = "短对话听力"; for (int i = 0; i < nodeList.Count; i++) { XmlElement qElem = (XmlElement)nodeList[i]; //question节点 XmlNodeList qList = nodeList[i].ChildNodes; //question下的所有子节点 for (int j = 0; j < qList.Count; j++) { XmlElement pElem = (XmlElement)qList[j]; //question下的一个子节点 //判断节点名为prompt if (pElem.Name == "prompt") { XmlNodeList soundList = qList[j].ChildNodes; //prompt下的所有子节点 for (int k = 0; k < soundList.Count; k++) { XmlElement sElem = (XmlElement)soundList[k]; //prompt下的一个子节点 if (sElem.GetAttribute("src") != "") { info.QustionInterval = sElem.GetAttribute("duration"); string src = sElem.GetAttribute("src"); listen.SoundFile = src.Substring(0, src.LastIndexOf('.')); XmlNodeList scriptList = soundList[k].ChildNodes; //sound下的所有子节点 for (int m = 0; m < scriptList.Count; m++) { XmlElement tElem = (XmlElement)scriptList[m]; if (tElem.Name == "transcript") { listen.Script = tElem.InnerXml; } } } } } //判断节点名为choice 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") { listen.Choices.Add(oElem.InnerXml); } } } //判断节点名为key if (pElem.Name == "key") { string[] answers = { "A", "B", "C", "D" }; int temp = int.Parse(pElem.InnerXml) - 1; info.AnswerValue.Add(answers[temp]); } } info.questionSound.Add(""); info.timeInterval.Add(0); info.Tip.Add(""); info.Problem.Add(""); info.ScoreQuestion.Add(1); info.Score += 1; info.TimeQuestion.Add(1.0); info.ReplyTime += 1.0; info.DifficultQuestion.Add(0.2); info.Diffcult += 0.2; } info.Diffcult = info.Diffcult / info.QuestionCount; listen.Info = info; break; } #endregion #region 长对话听力 case "3": { info.ItemType_CN = "长对话听力"; for (int i = 0; i < nodeList.Count; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i]; //prompt节点 XmlNodeList soundList = nodeList[i].ChildNodes; for (int j = 0; j < soundList.Count; j++) { XmlElement sElem = (XmlElement)soundList[j]; if (sElem.Name == "sound" && sElem.GetAttribute("src") != "") { info.QustionInterval = sElem.GetAttribute("duration"); listen.SoundFile = sElem.GetAttribute("src").Substring(0, sElem.GetAttribute("src").LastIndexOf('.')); listen.Script = sElem.FirstChild.InnerXml; } } continue; } XmlElement qElem = (XmlElement)nodeList[i]; //question节点 XmlNodeList qList = nodeList[i].ChildNodes; //question下的所有子节点 for (int j = 0; j < qList.Count; j++) { XmlElement pElem = (XmlElement)qList[j]; //question下的一个子节点 //判断节点名为prompt if (pElem.Name == "prompt") { XmlNodeList soundList = qList[j].ChildNodes; //prompt下的所有子节点 for (int k = 0; k < soundList.Count; k++) { XmlElement sElem = (XmlElement)soundList[k]; //prompt下的一个子节点 if (sElem.GetAttribute("src") != "") { string src = sElem.GetAttribute("src"); info.questionSound.Add(src.Substring(0, src.LastIndexOf('.'))); info.timeInterval.Add(int.Parse(sElem.GetAttribute("duration"))); XmlNodeList scriptList = soundList[k].ChildNodes; //sound下的所有子节点 for (int m = 0; m < scriptList.Count; m++) { XmlElement tElem = (XmlElement)scriptList[m]; if (tElem.Name == "transcript") { info.Problem.Add(tElem.InnerXml); } } } } } //判断节点名为choice 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") { listen.Choices.Add(oElem.InnerXml); } } } //判断节点名为key 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.0); info.ReplyTime += 1.0; info.DifficultQuestion.Add(0.2); info.Diffcult += 0.2; } info.Diffcult = info.Diffcult / info.QuestionCount; listen.Info = info; break; } #endregion #region 听力短文理解 case "4": { info.ItemType_CN = "听力短文理解"; for (int i = 0; i < nodeList.Count; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i]; //prompt节点 XmlNodeList soundList = nodeList[i].ChildNodes; for (int j = 0; j < soundList.Count; j++) { XmlElement sElem = (XmlElement)soundList[j]; if (sElem.Name == "sound" && sElem.GetAttribute("src") != "") { info.QustionInterval = sElem.GetAttribute("duration"); listen.SoundFile = sElem.GetAttribute("src").Substring(0, sElem.GetAttribute("src").LastIndexOf('.')); listen.Script = sElem.FirstChild.InnerXml; } } continue; } XmlElement qElem = (XmlElement)nodeList[i]; //question节点 XmlNodeList qList = nodeList[i].ChildNodes; //question下的所有子节点 for (int j = 0; j < qList.Count; j++) { XmlElement pElem = (XmlElement)qList[j]; //question下的一个子节点 //判断节点名为prompt if (pElem.Name == "prompt") { XmlNodeList soundList = qList[j].ChildNodes; //prompt下的所有子节点 for (int k = 0; k < soundList.Count; k++) { XmlElement sElem = (XmlElement)soundList[k]; //prompt下的一个子节点 if (sElem.GetAttribute("src") != "") { string src = sElem.GetAttribute("src"); info.questionSound.Add(src.Substring(0, src.LastIndexOf('.'))); info.timeInterval.Add(int.Parse(sElem.GetAttribute("duration"))); XmlNodeList scriptList = soundList[k].ChildNodes; //sound下的所有子节点 for (int m = 0; m < scriptList.Count; m++) { XmlElement tElem = (XmlElement)scriptList[m]; if (tElem.Name == "transcript") { info.Problem.Add(tElem.InnerXml); } } } } } //判断节点名为choice 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") { listen.Choices.Add(oElem.InnerXml); } } } //判断节点名为key 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.0); info.ReplyTime += 1.0; info.DifficultQuestion.Add(0.2); info.Diffcult += 0.2; } info.Diffcult = info.Diffcult / info.QuestionCount; listen.Info = info; break; } #endregion #region 合型听力 default: { info.ItemType_CN = "复合型听力"; for (int i = 0; i < nodeList.Count - 1; i++) { if (i == 0) { XmlElement pElem = (XmlElement)nodeList[i]; //prompt节点 XmlNodeList soundList = nodeList[i].ChildNodes; for (int j = 0; j < soundList.Count; j++) { XmlElement sElem = (XmlElement)soundList[j]; if (sElem.Name == "sound" && sElem.GetAttribute("src") != "") { info.QustionInterval = sElem.GetAttribute("duration"); listen.SoundFile = sElem.GetAttribute("src").Substring(0, sElem.GetAttribute("src").LastIndexOf('.')); } if (sElem.Name == "text") { int a = 0; while (sElem.InnerXml.IndexOf("<tag type=\"text\" />") > 0) { a++; int index = sElem.InnerXml.IndexOf("<tag type=\"text\" />"); int length = "<tag type=\"text\" />".Length; sElem.InnerXml = sElem.InnerXml.Substring(0, index) + "(_" + a + "_)" + sElem.InnerXml.Substring(index + length); } listen.Script = sElem.InnerXml; } } continue; } XmlElement qElem = (XmlElement)nodeList[i]; //question节点 XmlNodeList qList = nodeList[i].ChildNodes; //question下的所有子节点 for (int j = 0; j < qList.Count; j++) { XmlElement pElem = (XmlElement)qList[j]; //question下的一个子节点 //判断节点名为key if (pElem.Name == "key") { info.AnswerValue.Add(pElem.InnerXml); } } info.questionSound.Add(""); info.timeInterval.Add(0); info.Tip.Add(""); info.Problem.Add(""); info.ScoreQuestion.Add(1); info.Score += 1; info.TimeQuestion.Add(1.0); info.ReplyTime += 1.0; info.DifficultQuestion.Add(0.2); info.Diffcult += 0.2; } info.Diffcult = info.Diffcult / info.QuestionCount; listen.Info = info; break; } #endregion } return(listen); }
List <InfoMatchingCompletion> ICedts_TemporaryPaperRepository.SlelectEditInfoMat(Guid id, int UserID) { List <InfoMatchingCompletion> InfoMatList = new List <InfoMatchingCompletion>(); var AssmentIDList = (from m in db.CEDTS_TemporaryPaperAssessment where m.PaperID == id && m.ItemTypeID == 12 orderby m.Weight ascending select m.AssessmentItemID).ToList(); foreach (var AssessID in AssmentIDList) { var question = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssessID orderby m.Order ascending select m).ToList(); var assess = (from m in db.CEDTS_TemporaryAssessmentItem where m.AssessmentItemID == AssessID select m).FirstOrDefault(); var Expansion = (from m in db.CEDTS_TemporaryExpansion where m.AssessmentItemID == AssessID select m).FirstOrDefault(); InfoMatchingCompletion InfoMat = new InfoMatchingCompletion(); 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>(); info.Knowledge = new List <string>(); info.KnowledgeID = new List <string>(); info.TimeQuestion = new List <double>(); InfoMat.WordList = new List <string>(); info.ItemID = AssessID.Value; info.Count = assess.Count.Value; info.ItemType = "12"; info.ItemType_CN = "信息匹配"; info.PartType = "3"; info.QuestionCount = Convert.ToInt32(assess.QuestionCount); info.ReplyTime = Convert.ToInt32(assess.Duration); info.Diffcult = Convert.ToDouble(assess.Difficult); info.Score = Convert.ToInt32(assess.Score); InfoMat.Content = assess.Original; InfoMat.ExpansionID = Expansion.ExpansionID; InfoMat.WordList.Add(Expansion.ChoiceA); InfoMat.WordList.Add(Expansion.ChoiceB); InfoMat.WordList.Add(Expansion.ChoiceC); InfoMat.WordList.Add(Expansion.ChoiceD); InfoMat.WordList.Add(Expansion.ChoiceE); InfoMat.WordList.Add(Expansion.ChoiceF); InfoMat.WordList.Add(Expansion.ChoiceG); InfoMat.WordList.Add(Expansion.ChoiceH); InfoMat.WordList.Add(Expansion.ChoiceI); InfoMat.WordList.Add(Expansion.ChoiceJ); InfoMat.WordList.Add(Expansion.ChoiceK); InfoMat.WordList.Add(Expansion.ChoiceL); InfoMat.WordList.Add(Expansion.ChoiceM); InfoMat.WordList.Add(Expansion.ChoiceN); InfoMat.WordList.Add(Expansion.ChoiceO); 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 list in question) { info.QuestionID.Add(list.QuestionID); info.ScoreQuestion.Add(list.Score.Value); info.TimeQuestion.Add(list.Duration.Value); info.DifficultQuestion.Add(list.Difficult.Value); info.AnswerValue.Add(list.Answer); info.Tip.Add(list.Analyze); if (UserID == 1) { 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).First(); 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); } } InfoMat.Info = info; InfoMatList.Add(InfoMat); } return(InfoMatList); }
List <ReadingPartOption> ICedts_TemporaryPaperRepository.SlelectEditRpo(Guid id, int UserID) { List <ReadingPartOption> RpoList = new List <ReadingPartOption>(); var AssmentIDList = (from m in db.CEDTS_TemporaryPaperAssessment where m.PaperID == id && m.ItemTypeID == 7 orderby m.Weight ascending select m.AssessmentItemID).ToList(); foreach (var AssessID in AssmentIDList) { var question = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssessID orderby m.Order ascending select m).ToList(); var assess = (from m in db.CEDTS_TemporaryAssessmentItem where m.AssessmentItemID == AssessID 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>(); ReadingPartOption Rpo = new ReadingPartOption(); info.Knowledge = new List <string>(); info.KnowledgeID = new List <string>(); Rpo.Choices = new List <string>(); info.TimeQuestion = new List <double>(); info.ItemID = AssessID.Value; info.Count = assess.Count.Value; info.ItemType = "7"; info.ItemType_CN = "阅读选择题型"; info.PartType = "4"; info.QuestionCount = Convert.ToInt32(assess.QuestionCount); info.ReplyTime = Convert.ToInt32(assess.Duration); info.Diffcult = Convert.ToDouble(assess.Difficult); info.Score = Convert.ToInt32(assess.Score); Rpo.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 list in question) { info.QuestionID.Add(list.QuestionID); info.Problem.Add(list.QuestionContent); info.ScoreQuestion.Add(list.Score.Value); info.TimeQuestion.Add(list.Duration.Value); info.DifficultQuestion.Add(list.Difficult.Value); Rpo.Choices.Add(list.ChooseA); Rpo.Choices.Add(list.ChooseB); Rpo.Choices.Add(list.ChooseC); Rpo.Choices.Add(list.ChooseD); info.AnswerValue.Add(list.Answer); info.Tip.Add(list.Analyze); if (UserID == 1) { 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).First(); 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); } } Rpo.Info = info; RpoList.Add(Rpo); } return(RpoList); }
List <Listen> ICedts_TemporaryPaperRepository.SelectEditLpc(Guid id, int UserID) { List <Listen> LpcList = new List <Listen>(); var AssmentIDList = (from m in db.CEDTS_TemporaryPaperAssessment where m.PaperID == id && m.ItemTypeID == 5 orderby m.Weight ascending select m.AssessmentItemID).ToList(); foreach (var AssessID in AssmentIDList) { var question = (from m in db.CEDTS_TemporaryQuestion where m.AssessmentItemID == AssessID orderby m.Order ascending select m).ToList(); var Assess = (from m in db.CEDTS_TemporaryAssessmentItem where m.AssessmentItemID == AssessID select m).FirstOrDefault(); Listen Lpc = new Listen(); 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>(); info.Knowledge = new List <string>(); info.KnowledgeID = new List <string>(); info.TimeQuestion = new List <double>(); info.questionSound = new List <string>(); info.timeInterval = new List <int>(); info.QustionInterval = Assess.Interval.ToString(); info.ItemID = AssessID.Value; info.Count = Assess.Count.Value; info.ItemType = "5"; info.ItemType_CN = "复合型听力"; info.PartType = "2"; info.QuestionCount = Assess.QuestionCount.Value; info.ReplyTime = Assess.Duration.Value; info.Diffcult = Assess.Difficult.Value; info.Score = Assess.Score.Value; Lpc.Script = Assess.Original; Lpc.SoundFile = AssessID.ToString(); 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 list in question) { info.QuestionID.Add(list.QuestionID); info.Problem.Add(list.QuestionContent); info.ScoreQuestion.Add(list.Score.Value); info.TimeQuestion.Add(list.Duration.Value); info.DifficultQuestion.Add(list.Difficult.Value); info.AnswerValue.Add(list.Answer); info.questionSound.Add(list.Sound); info.timeInterval.Add(list.Interval.Value); info.Tip.Add(list.Analyze); if (UserID == 1) { 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).First(); 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); } } Lpc.Info = info; LpcList.Add(Lpc); } return(LpcList); }
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); }