Beispiel #1
0
        protected void btnGetPaper_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "缺少参数!";
                return;
            }

            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(strId));

            if (!PrjPub.IsServerCenter)
            {
                int nowVersion = objBll.GetExamServer(Convert.ToInt32(strId)).Version;
                if (nowVersion != objExam.Version)
                {
                    SessionSet.PageMessage = "当前考试版本与路局不匹配,请重新同步基础数据!";
                    return;
                }
            }

            if (objExam.EndTime < DateTime.Today)
            {
                SessionSet.PageMessage = "当前考试已过期,不能生成考试试卷!";
                return;
            }

            RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
            RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objExam.RandomExamId,
                                                                                          PrjPub.ServerNo);

            if (server.HasPaper)
            {
                SessionSet.PageMessage = "当前考试已生成试卷!";
                return;
            }

            //获取当前考试的考生信息
            RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
            IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));
            string strChooseID = "";

            if (ExamArranges.Count > 0)
            {
                strChooseID = ExamArranges[0].UserIds;
            }
            else
            {
                strChooseID = "";
            }
            string[] str = strChooseID.Split(',');
            if (str[0] == "")
            {
                SessionSet.PageMessage = "请为该考试添加考生!";
                return;
            }

            ClientScript.RegisterStartupScript(GetType(),
                                               "jsSelectFirstNode",
                                               @"GetPaper();",
                                               true);
        }