/// <summary> /// 获取考生答案 /// /// </summary> /// <param name="path">考生答案文件的路径</param> /// <returns>考生答案</returns> public static StaAns GetStuAns(string path) { StaAns stuAns = new StaAns(); stuAns.Ans = new List<Answer>(); stuAns.ProAns = new List<List<Answer>>(); Answer ans; List<IdAnswerType> ansList = new List<IdAnswerType>(); ansList = XMLControl.ReadPaperAns(path + "\\studentAns.xml"); foreach (IdAnswerType pro in ansList) { ans = new Answer(); ans.ID = pro.id; ans.Type = pro.pt; ans.Ans = pro.answer; stuAns.Ans.Add(ans); } return stuAns; }
/// <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; }