/// <summary> /// 获取程序题答案 /// </summary> /// <param name="pro">所要获取答案的程序题</param> /// <returns></returns> private static ProgramProblem getPAnswer(IdScoreType pro) { ProgramProblem programProblem = new ProgramProblem(); switch (pro.pt) { case ProblemType.CProgramCompletion: case ProblemType.CProgramModification: case ProblemType.CProgramFun: programProblem.language = PLanguage.C; break; case ProblemType.CppProgramCompletion: case ProblemType.CppProgramModification: case ProblemType.CppProgramFun: programProblem.language = PLanguage.CPP; break; case ProblemType.VbProgramCompletion: case ProblemType.VbProgramModification: case ProblemType.VbProgramFun: programProblem.language = PLanguage.VB; break; } switch (pro.pt) { case ProblemType.CProgramCompletion: case ProblemType.CppProgramCompletion: case ProblemType.VbProgramCompletion: programProblem.Type = ProgramPType.Completion; break; case ProblemType.CppProgramFun: case ProblemType.VbProgramFun: case ProblemType.CProgramFun: programProblem.Type = ProgramPType.Function; break; case ProblemType.CppProgramModification: case ProblemType.CProgramModification: case ProblemType.VbProgramModification: programProblem.Type = ProgramPType.Modify; break; } programProblem.type = pro.pt; programProblem.score = pro.score; programProblem.ansList = ScoreControl.oesData.FindProgramAnswerByPID(pro.id); return programProblem; }
/// <summary> /// 获取客观题答案 /// </summary> /// <param name="pro">所要获取答案的客观题</param> /// <param name="ansList">答案列表</param> /// <returns></returns> private static Answer getAnswer(IdScoreType pro, List<IdAnswerType> ansList) { Answer ans; ans = new Answer(); ans.ID = pro.id; ans.Score = pro.score; ans.Type = pro.pt; foreach (IdAnswerType a in ansList) { if ((a.id == pro.id) && (a.pt == pro.pt)) { ans.Ans = a.answer; break; } } return ans; }
/// <summary> /// 获取office提答案 /// </summary> /// <param name="pro">题目类型及ID</param> /// <param name="path">放置路径</param> /// <returns></returns> private static OfficeAnswer getOfficeAnswer(IdScoreType pro, string path, string ex) { switch (pro.pt) { case ProblemType.Word: scoreNet.LoadWordA(pro.id, -1); scoreNet.LoadWordT(pro.id, -1); break; case ProblemType.Excel: scoreNet.LoadExcelA(pro.id, -1); scoreNet.LoadExcelT(pro.id, -1); break; case ProblemType.PowerPoint: scoreNet.LoadPowerPointA(pro.id, -1); scoreNet.LoadPowerPointT(pro.id, -1); break; } return new OfficeAnswer(path + "a" + pro.id.ToString() + ex, path + "t" + pro.id.ToString() + ".xml",pro.score); }
/// <summary> /// 返回试卷XML的所有内容 /// </summary> /// <returns></returns> public List<IdScoreType> GetPaper() { List<IdScoreType> list = new List<IdScoreType>(); foreach (ProblemType pt in ProblemTypeCollection) { XmlNode xn = Find(xd.ChildNodes.Item(1).ChildNodes.Item(0), pt.ToString()); if (xn != null) { for (int s = 0; s < xn.ChildNodes.Count; ) { IdScoreType ist = new IdScoreType(); ist.id = Convert.ToInt32(xn.ChildNodes.Item(s++).ChildNodes.Item(0).Value); ist.pt = pt; ist.score = Convert.ToInt32(xn.ChildNodes.Item(s++).ChildNodes.Item(0).Value); list.Add(ist); } } } return list; }