示例#1
0
        /// <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;
        }
示例#2
0
        /// <summary>
        /// 获取正确答案
        /// </summary>
        /// <param name="ID">试卷ID</param>
        /// <param name="path">试卷路径</param>
        /// <returns></returns>
        public static StaAns SetStandardAnswer(string ID)
        {
            StaAns newAnswer;
            List<IdScoreType> proList;
            List<IdAnswerType> ansList;
            proList = new List<IdScoreType>();
            ansList = new List<IdAnswerType>();

            ClientEvt.RootPath = ScoreControl.config["AnswerPath"] + ID + "\\";
            if (!Directory.Exists(ClientEvt.RootPath))
            {
                Directory.CreateDirectory(ClientEvt.RootPath);
            }
            //if ((!File.Exists(ScoreControl.config["AnswerPath"] + ID + "\\" + ID + ".xml")) || (!File.Exists(ScoreControl.config["AnswerPath"] + ID + "\\A" + ID + ".xml")))
            //{
            //    scoreNet.LoadPaper(Convert.ToInt32(ID), -1);
            //    scoreNet.ReceiveFiles();
            //    while (!ClientEvt.isOver) ;

            //    //return null;
            //}
            if (!ClientEvt.isError)
            {
                proList = XMLControl.ReadPaper(ScoreControl.config["AnswerPath"] + ID + "\\" + ID + ".xml");
                ansList = XMLControl.ReadPaperAns(ScoreControl.config["AnswerPath"] + ID + "\\A" + ID + ".xml");
                newAnswer = new StaAns();
                newAnswer.Ans = new List<Answer>();
                newAnswer.PaperID = ID;
                //ProgramProblem programProblem;
                newAnswer.PCList = new List<ProgramProblem>();
                newAnswer.PFList = new List<ProgramProblem>();
                newAnswer.PMList = new List<ProgramProblem>();
                newAnswer.WordList = new List<OfficeAnswer>();
                newAnswer.PowerPointList = new List<OfficeAnswer>();
                newAnswer.ExcelList = new List<OfficeAnswer>();
                foreach (IdScoreType pro in proList)
                {
                    switch (pro.pt)
                    {
                        case ProblemType.Choice:
                        case ProblemType.Completion:
                        case ProblemType.Judgment:
                            newAnswer.Ans.Add(getAnswer(pro, ansList));
                            break;
                        case ProblemType.CProgramCompletion:
                        case ProblemType.CppProgramCompletion:
                        case ProblemType.VbProgramCompletion:
                            newAnswer.PCList.Add(getPAnswer(pro));
                            break;
                        case ProblemType.CppProgramFun:
                        case ProblemType.VbProgramFun:
                        case ProblemType.CProgramFun:
                            newAnswer.PFList.Add(getPAnswer(pro));
                            break;
                        case ProblemType.CppProgramModification:
                        case ProblemType.CProgramModification:
                        case ProblemType.VbProgramModification:
                            newAnswer.PMList.Add(getPAnswer(pro));
                            break;
                        case ProblemType.Word:
                            newAnswer.WordList.Add(getOfficeAnswer(pro, ClientEvt.RootPath, ".doc"));
                            break;
                        case ProblemType.PowerPoint:
                            newAnswer.PowerPointList.Add(getOfficeAnswer(pro, ClientEvt.RootPath, ".ppt"));
                            break;
                        case ProblemType.Excel:
                            newAnswer.ExcelList.Add(getOfficeAnswer(pro, ClientEvt.RootPath, ".xls"));
                            break;
                    }
                }
                scoreNet.ReceiveFiles();
                while (!ClientEvt.isOver) ;
                return newAnswer;
            }
            return null;
        }