コード例 #1
0
        private void DeleteExam(string strId)
        {
            RandomExamResultCurrentBLL objBll  = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    current = objBll.GetRandomExamResult(Convert.ToInt32(strId));

            #region 屏蔽

            /*
             * try
             * {
             *  string strSql;
             *  OracleAccess db =
             *      new OracleAccess(ConfigurationManager.ConnectionStrings["OracleCenter"].ConnectionString);
             *
             *  strSql = "select * from Random_Exam_Arrange_Detail where Random_Exam_ID=" + current.RandomExamId +
             *           " and Employee_ID=" + current.ExamineeId +
             *           " and Random_Exam_Result_ID=" + strId +
             *           " and Is_Remove=0";
             *  DataSet dsOther = db.RunSqlDataSet(strSql);
             *
             *  //查询微机教室
             *  string computerId = dsOther.Tables[0].Rows[0]["Computer_Room_ID"].ToString();
             *
             *  //将存在该考生的安排表和安排明细进行修改去除该考生
             *  string strReplace = "," + current.ExamineeId + ",";
             *
             *  strSql = "update Random_Exam_Arrange_Detail "
             + "set User_ids = substr(Replace(','||User_ids||',','" + strReplace +
             +           "',','),2,length(Replace(','||User_ids||',','" + strReplace + "',','))-2) "
             + "where  ','|| User_ids || ',' like '%" + strReplace + "%' and Random_Exam_ID=" +
             +           current.RandomExamId +
             +           " and Computer_Room_ID=" + computerId;
             +  db.ExecuteNonQuery(strSql);
             +
             +  //最后删除User_ids为空的考生安排明细信息
             +  strSql = "delete from Random_Exam_Arrange_Detail where User_ids is null  and Random_Exam_ID=" +
             +           current.RandomExamId;
             +  db.ExecuteNonQuery(strSql);
             +
             +  strSql = "update Random_Exam_Arrange "
             + "set User_ids = substr(Replace(','||User_ids||',','" + strReplace +
             +           "',','),2,length(Replace(','||User_ids||',','" + strReplace + "',','))-2) "
             + "where  ','|| User_ids || ',' like '%" + strReplace + "%' and Random_Exam_ID=" +
             +           current.RandomExamId;
             +  db.ExecuteNonQuery(strSql);
             + }
             + catch
             + {
             +  return;
             + }*/
            #endregion

            objBll.DelRandomExamResultCurrentByResultID(current.ExamineeId, Convert.ToInt32(strId));
            examsGrid.DataSource = objBll.GetRandomExamResultInfoByExamID(current.RandomExamId, GetSql());
            examsGrid.DataBind();
        }
コード例 #2
0
        protected void FillHeading(string strId, string orgid)
        {
            RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    randomExamResult    = new RandomExamResultCurrent();

            randomExamResult = randomExamResultBLL.GetRandomExamResult(int.Parse(strId));

            string strOrgName     = randomExamResult.OrganizationName;
            string strStationName = "";
            string strOrgName1    = "";
            int    n = strOrgName.IndexOf("-");

            if (n != -1)
            {
                strStationName = strOrgName.Substring(0, n);
                strOrgName1    = strOrgName.Substring(n + 1);
            }
            else
            {
                strStationName = strOrgName;
                strOrgName1    = "";
            }

            lblOrg.Text      = strStationName;
            lblWorkShop.Text = strOrgName1;
            lblPost.Text     = randomExamResult.PostName;
            lblName.Text     = randomExamResult.ExamineeName;
            lblTime.Text     = randomExamResult.BeginDateTime.ToString("yyyy-MM-dd HH:mm");
            lblScore.Text    = System.String.Format("{0:0.##}", randomExamResult.Score);

            int           RandomExamId  = randomExamResult.RandomExamId;
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(RandomExamId);

            if (randomExam != null)
            {
                lblTitle.Text = randomExam.ExamName;
            }

            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);

            int     nItemCount  = 0;
            decimal nTotalScore = 0;

            for (int i = 0; i < RandomExamSubjects.Count; i++)
            {
                nItemCount  += RandomExamSubjects[i].ItemCount;
                nTotalScore += RandomExamSubjects[i].ItemCount * RandomExamSubjects[i].UnitScore;
            }

            lblTitleRight.Text = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分";
        }
コード例 #3
0
        public int AddRandomExamResultCurrent(RandomExamResultCurrent examResult)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("USP_Random_EXAM_RESULT_Cur_I");

            db.AddOutParameter(dbCommand, "p_Random_exam_result_id", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "p_org_id", DbType.Int32, examResult.OrganizationId);
            db.AddInParameter(dbCommand, "p_random_exam_id", DbType.Int32, examResult.RandomExamId);
            db.AddInParameter(dbCommand, "p_examinee_id", DbType.Int32, examResult.ExamineeId);
            db.AddInParameter(dbCommand, "p_begin_time", DbType.DateTime, examResult.BeginDateTime);
            db.AddInParameter(dbCommand, "p_current_time", DbType.DateTime, examResult.CurrentDateTime);
            db.AddInParameter(dbCommand, "p_end_time", DbType.DateTime, examResult.EndDateTime);
            db.AddInParameter(dbCommand, "p_exam_time", DbType.Int32, examResult.ExamTime);
            db.AddInParameter(dbCommand, "p_auto_score", DbType.Decimal, examResult.AutoScore);
            db.AddInParameter(dbCommand, "p_score", DbType.Decimal, examResult.Score);
            db.AddInParameter(dbCommand, "p_correct_rate", DbType.Decimal, examResult.CorrectRate);
            db.AddInParameter(dbCommand, "p_is_pass", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "p_status_id", DbType.Int32, examResult.StatusId);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, examResult.Memo);
            db.AddInParameter(dbCommand, "p_exam_seq_no", DbType.Int32, examResult.ExamSeqNo);
            int id = 0;

            DbConnection connection = db.CreateConnection();

            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                db.ExecuteNonQuery(dbCommand, transaction);
                id = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_Random_exam_result_id"));

                transaction.Commit();
            }
            catch (System.SystemException ex)
            {
                transaction.Rollback();
                throw ex;
            }
            connection.Close();

            return(id);
        }
コード例 #4
0
        public int UpdateRandomExamResultCurrent(RandomExamResultCurrent examResult)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("USP_Random_EXAM_RESULT_Cur_U");

            db.AddInParameter(dbCommand, "p_Random_exam_result_id", DbType.Int32, examResult.RandomExamResultId);
            db.AddInParameter(dbCommand, "p_org_id", DbType.Int32, examResult.OrganizationId);
            db.AddInParameter(dbCommand, "p_random_exam_id", DbType.Int32, examResult.RandomExamId);
            db.AddInParameter(dbCommand, "p_examinee_id", DbType.Int32, examResult.ExamineeId);
            db.AddInParameter(dbCommand, "p_begin_time", DbType.DateTime, examResult.BeginDateTime);
            db.AddInParameter(dbCommand, "p_current_time", DbType.DateTime, examResult.CurrentDateTime);
            db.AddInParameter(dbCommand, "p_end_time", DbType.DateTime, examResult.EndDateTime);
            db.AddInParameter(dbCommand, "p_exam_time", DbType.Int32, examResult.ExamTime);
            db.AddInParameter(dbCommand, "p_auto_score", DbType.Decimal, examResult.AutoScore);
            db.AddInParameter(dbCommand, "p_score", DbType.Decimal, examResult.Score);
            db.AddInParameter(dbCommand, "p_correct_rate", DbType.Decimal, examResult.CorrectRate);
            db.AddOutParameter(dbCommand, "p_is_pass", DbType.Int32, 4);
            db.AddInParameter(dbCommand, "p_status_id", DbType.Int32, examResult.StatusId);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, examResult.Memo);
            db.AddInParameter(dbCommand, "p_exam_seq_no", DbType.Int32, examResult.ExamSeqNo);
            return(db.ExecuteNonQuery(dbCommand));
        }
コード例 #5
0
        public RandomExamResultCurrent GetNowRandomExamResultInfo(int employeeid, int examid)
        {
            RandomExamResultCurrent RandomExamResult = new RandomExamResultCurrent();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_Random_EXAM_RESULT_Cur_N";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_employee_id", DbType.Int32, employeeid);
            db.AddInParameter(dbCommand, "p_Random_exam_id", DbType.Int32, examid);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    RandomExamResult = CreateModelObject(dataReader);
                }
            }

            return(RandomExamResult);
        }
コード例 #6
0
        public RandomExamResultCurrent GetRandomExamResult(int examResultID)
        {
            RandomExamResultCurrent RandomExamResult = new RandomExamResultCurrent();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_Random_EXAM_RESULT_Cur_G";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_Random_exam_result_id", DbType.Int32, examResultID);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    RandomExamResult          = CreateModelObject(dataReader);
                    RandomExamResult.WorkNo   = DataConvert.ToString(dataReader[GetMappingFieldName("WorkNo")]);
                    RandomExamResult.PostName = DataConvert.ToString(dataReader[GetMappingFieldName("PostName")]);
                }
            }

            return(RandomExamResult);
        }
コード例 #7
0
        public IList <RandomExamResultCurrent> GetRandomExamResultInfoByExamID(int examID, string sql)
        {
            IList <RandomExamResultCurrent> examResults = new List <RandomExamResultCurrent>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_Random_EXAM_RESULT_Cur_Q1";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_Random_exam_id", DbType.Int32, examID);
            db.AddInParameter(dbCommand, "p_sql", DbType.String, sql);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    RandomExamResultCurrent obj = CreateModelObject(dataReader);
                    obj.WorkNo = DataConvert.ToString(dataReader[GetMappingFieldName("WorkNo")]);
                    examResults.Add(obj);
                }
            }

            return(examResults);
        }
コード例 #8
0
        private void GetPaper()
        {
            // 根据 ProgressBar.htm 显示进度条界面
            string       templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

            reader.Close();
            Response.Write(html);
            Response.Flush();
            System.Threading.Thread.Sleep(200);

            string jsBlock;

            ViewState["BeginTime"] = DateTime.Now.ToString();
            string strId = Request.QueryString.Get("RandomExamID");

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

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

            int year      = obj.BeginTime.Year;
            int ExamCount = obj.MaxExamTimes;

            RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
            IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));
            string       strChooseID = "";
            OracleAccess db          = new OracleAccess();
            OracleAccess dbCenter    = new OracleAccess(System.Configuration.ConfigurationManager.ConnectionStrings["OracleCenter"].ConnectionString);

            string strSql;

            if (ExamArranges.Count > 0)
            {
                strSql = "select a.* from Random_Exam_Arrange_Detail a "
                         + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID"
                         + " inner join Computer_Server c on c.Computer_server_ID=b.Computer_Server_ID"
                         + " where c.Computer_Server_No='" + PrjPub.ServerNo + "' "
                         + " and Random_Exam_ID=" + strId;

                DataSet ds = db.RunSqlDataSet(strSql);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (string.IsNullOrEmpty(strChooseID))
                    {
                        strChooseID += dr["User_Ids"].ToString();
                    }
                    else
                    {
                        strChooseID += "," + dr["User_Ids"];
                    }
                }
            }
            else
            {
                strChooseID = "";
            }

            if (strChooseID == "")
            {
                Response.Write("<script>top.returnValue='本场考试未在本单位安排考生!';window.close();</script>");
                return;
            }

            if (db.GetCount("RANDOM_EXAM_ITEM_TEMP_" + year, "TABLE") == 0)
            {
                strSql = "create table RANDOM_EXAM_ITEM_TEMP_" + year + "  as select * from RANDOM_EXAM_ITEM_" + year + " where 1=2 ";
                db.ExecuteNonQuery(strSql);
            }
            strSql = "insert into RANDOM_EXAM_ITEM_TEMP_" + year + " select * from RANDOM_EXAM_ITEM_" + year + " where Random_Exam_ID=" + strId;
            db.ExecuteNonQuery(strSql);

            if (!PrjPub.IsServerCenter)
            {
                if (dbCenter.GetCount("RANDOM_EXAM_ITEM_TEMP_" + year, "TABLE") == 0)
                {
                    strSql = "create table RANDOM_EXAM_ITEM_TEMP_" + year + "  as select * from RANDOM_EXAM_ITEM_" + year + " where 1=2 ";
                    dbCenter.ExecuteNonQuery(strSql);
                }
                strSql = "insert into RANDOM_EXAM_ITEM_TEMP_" + year + " select * from RANDOM_EXAM_ITEM_" + year + " where Random_Exam_ID=" + strId;
                dbCenter.ExecuteNonQuery(strSql);
            }

            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((1 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();


            //每次生成试卷之前删除已生成的考试试卷
            RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();

            randomExamResultBLL.DelRandomExamResultCurrent(Convert.ToInt32(strId));
            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((2 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();

            System.Threading.Thread.Sleep(200);
            jsBlock = string.Empty;

            string[] str = strChooseID.Split(',');

            RandomExamResultAnswerCurrentBLL randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            //定义全局答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswersCurrentAll = new List <RandomExamResultAnswerCurrent>();
            //定义一个考生一次答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswers = null;

            int progressNum = 1;

            for (int n = 1; n <= ExamCount; n++)
            {
                for (int m = 0; m < str.Length; m++)
                {
                    RandomExamResultCurrent randomExamResult = new RandomExamResultCurrent();

                    randomExamResult.RandomExamId    = int.Parse(strId);
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.BeginDateTime   = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.CurrentDateTime = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.ExamTime        = 0;
                    randomExamResult.EndDateTime     = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.Score           = 0;
                    randomExamResult.OrganizationId  = int.Parse(ConfigurationManager.AppSettings["StationID"]);
                    randomExamResult.Memo            = "";
                    randomExamResult.StatusId        = 0;
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.CorrectRate     = 0;
                    randomExamResult.ExamineeId      = int.Parse(str[m]);
                    randomExamResult.ExamSeqNo       = n;

                    int nRandomExamResultPK = randomExamResultBLL.AddRandomExamResultCurrent(randomExamResult);
                    ViewState["RandomExamResultPK"] = nRandomExamResultPK;

                    strSql = "select a.* from Random_Exam_Arrange_Detail a "
                             + " where ','||User_Ids||',' like '%," + str[m] + ",%' "
                             + " and Random_Exam_ID=" + strId;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    //strSql = "insert into Random_Exam_Result_Detail(Random_Exam_Result_Detail_ID,"
                    //         + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID) "
                    //         + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                    //         + nRandomExamResultPK + ","
                    //         + randomExamResult.RandomExamId + ","
                    //         + randomExamResult.ExamineeId + ","
                    //         + "0," + dr["Computer_Room_ID"] + ") ";
                    //db.ExecuteNonQuery(strSql);

                    strSql = "insert into Random_Exam_Result_Detail_Temp(Random_Exam_Result_Detail_ID,"
                             + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID,Is_Remove) "
                             + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                             + nRandomExamResultPK + ","
                             + randomExamResult.RandomExamId + ","
                             + randomExamResult.ExamineeId + ","
                             + "0," + dr["Computer_Room_ID"] + ",0) ";
                    db.ExecuteNonQuery(strSql);

                    RandomExamItemBLL     randomItemBLL = new RandomExamItemBLL();
                    RandomExamSubjectBLL  subjectBLL    = new RandomExamSubjectBLL();
                    RandomExamStrategyBLL strategyBLL   = new RandomExamStrategyBLL();

                    IList <RandomExamSubject> randomExamSubjects =
                        subjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strId));

                    if (randomExamSubjects != null)
                    {
                        Hashtable hashTableItemIds = new Hashtable();
                        Hashtable htSubjectItemIds = new Hashtable();
                        for (int i = 0; i < randomExamSubjects.Count; i++)
                        {
                            RandomExamSubject paperSubject = randomExamSubjects[i];
                            int nSubjectId = paperSubject.RandomExamSubjectId;
                            //  int nItemCount = paperSubject.ItemCount;

                            IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                            for (int j = 0; j < strategys.Count; j++)
                            {
                                int nStrategyId = strategys[j].RandomExamStrategyId;
                                int nItemCount  = strategys[j].ItemCount;
                                IList <RandomExamItem> itemList = randomItemBLL.GetItemsByStrategyId(nStrategyId, year);

                                // IList<RandomExamItem> itemList = randomItemBLL.GetItemsBySubjectId(nSubjectId);

                                Random    ObjRandom      = new Random();
                                Hashtable hashTable      = new Hashtable();
                                Hashtable hashTableCount = new Hashtable();
                                int       index          = 0;
                                while (hashTable.Count < nItemCount)
                                {
                                    int k = ObjRandom.Next(itemList.Count);
                                    hashTableCount[index] = k;
                                    index = index + 1;
                                    int itemID     = itemList[k].ItemId;
                                    int examItemID = itemList[k].RandomExamItemId;
                                    if (!hashTableItemIds.ContainsKey(itemID))
                                    {
                                        hashTable[examItemID]        = examItemID;
                                        hashTableItemIds[itemID]     = itemID;
                                        htSubjectItemIds[examItemID] = examItemID;
                                    }
                                    //if (hashTableCount.Count == itemList.Count && hashTable.Count < nItemCount)
                                    //{
                                    //    SessionSet.PageMessage = "随机考试在设定的取题范围内的试题量不够,请重新设置取题范围!";
                                    //    return;
                                    //}
                                }
                            }
                        }


                        foreach (int key in htSubjectItemIds.Keys)
                        {
                            string         strItemId = htSubjectItemIds[key].ToString();
                            RandomExamItem item      = randomItemBLL.GetRandomExamItem(Convert.ToInt32(strItemId), year);

                            string nowSelectAnswer   = string.Empty;
                            string nowStandardAnswer = string.Empty;
                            if (item.TypeId != PrjPub.ITEMTYPE_FILLBLANK)
                            {
                                Pub.GetNowAnswer(item, out nowSelectAnswer, out nowStandardAnswer);
                            }

                            RandomExamResultAnswerCurrent randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                            randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                            randomExamResultAnswer.RandomExamItemId   = int.Parse(strItemId);
                            randomExamResultAnswer.JudgeStatusId      = 0;
                            randomExamResultAnswer.JudgeRemark        = string.Empty;
                            randomExamResultAnswer.ExamTime           = 0;
                            randomExamResultAnswer.Answer             = string.Empty;
                            randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                            randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                            randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);

                            //完型填空子题
                            IList <RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(item.ItemId, obj.RandomExamId, year);
                            foreach (RandomExamItem randomExamItem in randomExamItems)
                            {
                                Pub.GetNowAnswer(randomExamItem, out nowSelectAnswer, out nowStandardAnswer);

                                randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                                randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                                randomExamResultAnswer.RandomExamItemId   = randomExamItem.RandomExamItemId;
                                randomExamResultAnswer.JudgeStatusId      = 0;
                                randomExamResultAnswer.JudgeRemark        = string.Empty;
                                randomExamResultAnswer.ExamTime           = 0;
                                randomExamResultAnswer.Answer             = string.Empty;
                                randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                                randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                                randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);
                            }

                            System.Threading.Thread.Sleep(10);
                            jsBlock = "<script>SetPorgressBar('正在生成试卷,请等待......','" + ((progressNum * 100) / ((double)ExamCount * str.Length * htSubjectItemIds.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            progressNum++;
                        }
                    }
                    else
                    {
                        SessionSet.PageMessage = "未找到记录!";
                    }
                }
            }

            bool isRefresh = true;

            try
            {
                objBll.UpdateHasPaper(Convert.ToInt32(strId), PrjPub.ServerNo, true);
            }
            catch
            {
                strSql =
                    @"  update Random_Exam_Computer_Server set  has_paper=1
                      where random_exam_id=" + strId + @" and Computer_server_no='" + PrjPub.ServerNo + @"'";
                dbCenter.ExecuteNonQuery(strSql);
                strSql = @"select count(*)  from Random_Exam_Computer_Server where has_paper=1 and  random_exam_id=" + strId;
                int count = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                if (count > 0)
                {
                    strSql = @"update Random_Exam set has_paper=1 where random_exam_id=" + strId;
                    dbCenter.ExecuteNonQuery(strSql);
                }
                else
                {
                    strSql = @"update Random_Exam set has_paper=0 where random_exam_id=" + strId;
                    dbCenter.ExecuteNonQuery(strSql);
                }
            }


            //如果考试是随到随考,考试状态自动变为正在进行
            if (obj.StartMode == 1)
            {
                try
                {
                    objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);
                    isRefresh = false;
                }
                catch
                {
                    strSql =
                        @"  update Random_Exam_Computer_Server set  Is_Start=1
                      where random_exam_id=" + strId + @" and Computer_server_no='" + PrjPub.ServerNo + @"'";
                    dbCenter.ExecuteNonQuery(strSql);
                    strSql = @"select count(*)  from Random_Exam_Computer_Server where random_exam_id=" + strId;
                    int totalcount = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                    strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=0 and  random_exam_id=" + strId;
                    int count = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                    if (totalcount == count)
                    {
                        strSql = @"update Random_Exam set Is_Start=0 where random_exam_id=" + strId;
                        dbCenter.ExecuteNonQuery(strSql);
                    }
                    else
                    {
                        strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=1 and  random_exam_id=" + strId;
                        count  = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                        if (count > 0)
                        {
                            strSql = @"update Random_Exam set Is_Start=1 where random_exam_id=" + strId;
                            dbCenter.ExecuteNonQuery(strSql);
                        }
                        else
                        {
                            strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=2 and  random_exam_id=" + strId;
                            count  = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                            if (count == totalcount)
                            {
                                strSql = @"update Random_Exam set Is_Start=2 where random_exam_id=" + strId;
                                dbCenter.ExecuteNonQuery(strSql);
                            }
                        }
                    }
                }
            }
            else
            {
                isRefresh = false;
            }

            if (isRefresh)
            {
                objBll.RandomExamRefresh();
            }

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("“" + obj.ExamName + "”生成所有考试试卷");

            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
コード例 #9
0
        private void GetPaperAfter()
        {
            // 根据 ProgressBar.htm 显示进度条界面
            string       templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

            reader.Close();
            Response.Write(html);
            Response.Flush();
            System.Threading.Thread.Sleep(200);

            ViewState["BeginTime"] = DateTime.Now.ToString();
            string strId = Request.QueryString.Get("RandomExamID");

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

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

            int year      = obj.BeginTime.Year;
            int ExamCount = obj.MaxExamTimes;

            System.Threading.Thread.Sleep(10);
            string jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((1 * 100) / ((double)1) + "'); </script>");

            Response.Write(jsBlock);
            Response.Flush();

            if (!PrjPub.IsServerCenter)
            {
                RandomExamArrangeBLL objArrangeBll = new RandomExamArrangeBLL();
                objArrangeBll.RefreshRandomExamArrange();
            }

            //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 = "";
            //}

            //RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();
            //IList<RandomExamResultCurrent> examResults = objResultCurrentBll.GetRandomExamResultInfo(Convert.ToInt32(strId));
            //for (int i = 0; i < examResults.Count; i++)
            //{
            //    strChooseID = ("," + strChooseID + ",").Replace("," + examResults[i].ExamineeId + ",", ",");
            //}

            //strChooseID = strChooseID.TrimStart(',').TrimEnd(',');

            string strChooseID = Request.QueryString.Get("addIds");

            if (strChooseID == string.Empty)
            {
                return;
            }

            string[] str = strChooseID.Split('|');

            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((2 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();

            OracleAccess db = new OracleAccess();
            string       strSql;

            RandomExamResultAnswerCurrentBLL randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            //定义全局答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswersCurrentAll = new List <RandomExamResultAnswerCurrent>();
            //定义一个考生一次答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswers = null;

            System.Threading.Thread.Sleep(200);
            jsBlock = string.Empty;
            int progressNum = 1;

            for (int n = 1; n <= ExamCount; n++)
            {
                for (int m = 0; m < str.Length; m++)
                {
                    RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();
                    RandomExamResultCurrent    randomExamResult    = new RandomExamResultCurrent();

                    randomExamResult.RandomExamId    = int.Parse(strId);
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.BeginDateTime   = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.CurrentDateTime = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.ExamTime        = 0;
                    randomExamResult.EndDateTime     = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.Score           = 0;
                    randomExamResult.OrganizationId  = int.Parse(ConfigurationManager.AppSettings["StationID"]);
                    randomExamResult.Memo            = "";
                    randomExamResult.StatusId        = 0;
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.CorrectRate     = 0;
                    randomExamResult.ExamineeId      = int.Parse(str[m]);
                    randomExamResult.ExamSeqNo       = n;

                    int nRandomExamResultPK = randomExamResultBLL.AddRandomExamResultCurrent(randomExamResult);
                    ViewState["RandomExamResultPK"] = nRandomExamResultPK;

                    strSql = "select a.* from Random_Exam_Arrange_Detail a "
                             + " where ','||User_Ids||',' like '%," + str[m] + ",%' "
                             + " and Random_Exam_ID=" + strId;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];


                    //strSql = "insert into Random_Exam_Result_Detail(Random_Exam_Result_Detail_ID,"
                    //         + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID) "
                    //         + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                    //         + nRandomExamResultPK + ","
                    //         + randomExamResult.RandomExamId + ","
                    //         + randomExamResult.ExamineeId + ","
                    //         + "0," + dr["Computer_Room_ID"] + ") ";
                    //db.ExecuteNonQuery(strSql);


                    strSql = "insert into Random_Exam_Result_Detail_Temp(Random_Exam_Result_Detail_ID,"
                             + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID,Is_Remove) "
                             + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                             + nRandomExamResultPK + ","
                             + randomExamResult.RandomExamId + ","
                             + randomExamResult.ExamineeId + ","
                             + "0," + dr["Computer_Room_ID"] + ",0) ";
                    db.ExecuteNonQuery(strSql);

                    RandomExamItemBLL     randomItemBLL = new RandomExamItemBLL();
                    RandomExamSubjectBLL  subjectBLL    = new RandomExamSubjectBLL();
                    RandomExamStrategyBLL strategyBLL   = new RandomExamStrategyBLL();

                    IList <RandomExamSubject> randomExamSubjects =
                        subjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strId));

                    if (randomExamSubjects != null)
                    {
                        Hashtable hashTableItemIds = new Hashtable();
                        Hashtable htSubjectItemIds = new Hashtable();
                        for (int i = 0; i < randomExamSubjects.Count; i++)
                        {
                            RandomExamSubject paperSubject = randomExamSubjects[i];
                            int nSubjectId = paperSubject.RandomExamSubjectId;
                            //  int nItemCount = paperSubject.ItemCount;

                            IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                            for (int j = 0; j < strategys.Count; j++)
                            {
                                int nStrategyId = strategys[j].RandomExamStrategyId;
                                int nItemCount  = strategys[j].ItemCount;
                                IList <RandomExamItem> itemList = randomItemBLL.GetItemsByStrategyId(nStrategyId, year);

                                // IList<RandomExamItem> itemList = randomItemBLL.GetItemsBySubjectId(nSubjectId);

                                Random    ObjRandom      = new Random();
                                Hashtable hashTable      = new Hashtable();
                                Hashtable hashTableCount = new Hashtable();
                                int       index          = 0;
                                while (hashTable.Count < nItemCount)
                                {
                                    int k = ObjRandom.Next(itemList.Count);
                                    hashTableCount[index] = k;
                                    index = index + 1;
                                    int itemID     = itemList[k].ItemId;
                                    int examItemID = itemList[k].RandomExamItemId;
                                    if (!hashTableItemIds.ContainsKey(itemID))
                                    {
                                        hashTable[examItemID]        = examItemID;
                                        hashTableItemIds[itemID]     = itemID;
                                        htSubjectItemIds[examItemID] = examItemID;
                                    }
                                    //if (hashTableCount.Count == itemList.Count && hashTable.Count < nItemCount)
                                    //{
                                    //    SessionSet.PageMessage = "随机考试在设定的取题范围内的试题量不够,请重新设置取题范围!";
                                    //    return;
                                    //}
                                }
                            }
                        }
                        randomExamResultAnswers = new List <RandomExamResultAnswerCurrent>();
                        foreach (int key in htSubjectItemIds.Keys)
                        {
                            string strItemId = htSubjectItemIds[key].ToString();

                            RandomExamItem item = randomItemBLL.GetRandomExamItem(Convert.ToInt32(strItemId), year);

                            string nowSelectAnswer   = string.Empty;
                            string nowStandardAnswer = string.Empty;
                            if (item.TypeId != PrjPub.ITEMTYPE_FILLBLANK)
                            {
                                Pub.GetNowAnswer(item, out nowSelectAnswer, out nowStandardAnswer);
                            }

                            RandomExamResultAnswerCurrent randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                            randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                            randomExamResultAnswer.RandomExamItemId   = int.Parse(strItemId);
                            randomExamResultAnswer.JudgeStatusId      = 0;
                            randomExamResultAnswer.JudgeRemark        = string.Empty;
                            randomExamResultAnswer.ExamTime           = 0;
                            randomExamResultAnswer.Answer             = string.Empty;
                            randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                            randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                            randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);

                            //完型填空子题
                            IList <RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(item.ItemId, obj.RandomExamId, year);
                            foreach (RandomExamItem randomExamItem in randomExamItems)
                            {
                                Pub.GetNowAnswer(randomExamItem, out nowSelectAnswer, out nowStandardAnswer);

                                randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                                randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                                randomExamResultAnswer.RandomExamItemId   = randomExamItem.RandomExamItemId;
                                randomExamResultAnswer.JudgeStatusId      = 0;
                                randomExamResultAnswer.JudgeRemark        = string.Empty;
                                randomExamResultAnswer.ExamTime           = 0;
                                randomExamResultAnswer.Answer             = string.Empty;
                                randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                                randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                                randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);
                            }

                            System.Threading.Thread.Sleep(10);
                            jsBlock = "<script>SetPorgressBar('正在生成试卷,请等待......','" + ((progressNum * 100) / ((double)ExamCount * str.Length * htSubjectItemIds.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            progressNum++;
                        }
                    }
                    else
                    {
                        SessionSet.PageMessage = "未找到记录!";
                    }
                }
            }

            //临时添加考生无需更改考试状态,因为考试状态肯定是正在进行和生成试卷
            //objBll.UpdateHasPaper(Convert.ToInt32(strId), PrjPub.ServerNo, true);
            ////如果考试是随到随考,考试状态自动变为正在进行
            //if (obj.StartMode == 1)
            //{
            //    objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);
            //}

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("“" + obj.ExamName + "”生成新增考生试卷");

            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
コード例 #10
0
 public int UpdateRandomExamResultCurrent(RandomExamResultCurrent examResult)
 {
     return(dal.UpdateRandomExamResultCurrent(examResult));
 }
コード例 #11
0
 public int AddRandomExamResultCurrent(RandomExamResultCurrent examResult)
 {
     return(dal.AddRandomExamResultCurrent(examResult));
 }
コード例 #12
0
        protected void FillPaper()
        {
            // QueryString id stands for EXAM_RESULT_ID
            string strId = Request.QueryString.Get("id");
            string orgid = Request.QueryString.Get("orgid");

            // Not pass id
            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "参数错误!";

                return;
            }

            RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    randomExamResult    = new RandomExamResultCurrent();

            randomExamResult = randomExamResultBLL.GetRandomExamResult(int.Parse(strId));

            int RandomExamId       = randomExamResult.RandomExamId;
            int randomExamResultId = int.Parse(strId);

            RandomExamBLL objBll = new RandomExamBLL();
            int           year   = objBll.GetExam(RandomExamId).BeginTime.Year;

            RandomExamItemBLL                     randomItemBLL             = new RandomExamItemBLL();
            RandomExamSubjectBLL                  subjectBLL                = new RandomExamSubjectBLL();
            RandomExamResultAnswerCurrentBLL      randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            IList <RandomExamSubject>             randomExamSubjects        = subjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);
            IList <RandomExamResultAnswerCurrent> examResultAnswers         = new List <RandomExamResultAnswerCurrent>();

            examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswersCurrent(randomExamResultId);

            if (randomExamSubjects != null)
            {
                for (int i = 0; i < randomExamSubjects.Count; i++)
                {
                    RandomExamSubject      paperSubject = randomExamSubjects[i];
                    IList <RandomExamItem> PaperItems   = new List <RandomExamItem>();
                    PaperItems = randomItemBLL.GetItemsCurrent(paperSubject.RandomExamSubjectId, randomExamResultId, year);

                    Response.Write("<table width='100%'>");
                    Response.Write(" <tr > <td class='ExamBigTitle' >");
                    Response.Write(" " + GetNo(i) + "");
                    Response.Write(".&nbsp;" + paperSubject.SubjectName + "");
                    Response.Write("  (共" + paperSubject.ItemCount + "题,共" + System.String.Format("{0:0.##}", paperSubject.ItemCount * paperSubject.UnitScore) + "分)</td></tr >");

                    if (PaperItems != null)
                    {
                        for (int j = 0; j < PaperItems.Count; j++)
                        {
                            RandomExamItem paperItem = PaperItems[j];
                            int            k         = j + 1;

                            Response.Write("<tr > <td class='ExamResultItem'>&nbsp;&nbsp;&nbsp;"
                                           + k + ".&nbsp; " + paperItem.Content + "&nbsp;&nbsp;(" + System.String.Format("{0:0.##}", paperSubject.UnitScore) +
                                           "分)</td></tr >");

                            // 组织用户答案
                            RandomExamResultAnswerCurrent theExamResultAnswer = null;
                            string[] strUserAnswers = new string[0];
                            string   strUserAnswer  = string.Empty;

                            foreach (RandomExamResultAnswerCurrent resultAnswer in examResultAnswers)
                            {
                                if (resultAnswer.RandomExamItemId == paperItem.RandomExamItemId)
                                {
                                    theExamResultAnswer = resultAnswer;
                                    break;
                                }
                            }

                            // 若子表无记录,结束页面输出


                            if (theExamResultAnswer == null)
                            {
                                SessionSet.PageMessage = "数据错误!";
                            }

                            // 否则组织考生答案
                            if (theExamResultAnswer.Answer != null || theExamResultAnswer.Answer == string.Empty)
                            {
                                strUserAnswers = theExamResultAnswer.Answer.Split(new char[] { '|' });
                            }
                            for (int n = 0; n < strUserAnswers.Length; n++)
                            {
                                string strN = intToString(int.Parse(strUserAnswers[n]) + 1);
                                if (n == 0)
                                {
                                    strUserAnswer += strN;
                                }
                                else
                                {
                                    strUserAnswer += "," + strN;
                                }
                            }

                            //多选


                            if (paperSubject.ItemTypeId == 2)
                            {
                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN  = intToString(n + 1);
                                    string strij = "-" + paperItem.RandomExamItemId + "-" + i.ToString() + "-"
                                                   + j.ToString() + "-" + n.ToString();
                                    string strName = i.ToString() + j.ToString();

                                    Response.Write(" <tr ><td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }
                            else
                            {
                                //单选


                                string[] strAnswer = paperItem.SelectAnswer.Split(new char[] { '|' });
                                for (int n = 0; n < strAnswer.Length; n++)
                                {
                                    string strN  = intToString(n + 1);
                                    string strij = "-" + paperItem.RandomExamItemId + "-" + i.ToString() + "-" + j.ToString()
                                                   + "-" + n.ToString();
                                    string strName = i.ToString() + j.ToString();

                                    Response.Write("<tr > <td class='ExamItemAnswer'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "
                                                   + strN + "." + strAnswer[n] + "</td></tr >");
                                }
                            }

                            // 组织正确答案
                            string[] strRightAnswers = paperItem.StandardAnswer.Split(new char[] { '|' });
                            string   strRightAnswer  = "";
                            for (int n = 0; n < strRightAnswers.Length; n++)
                            {
                                string strN = intToString(int.Parse(strRightAnswers[n]) + 1);
                                if (n == 0)
                                {
                                    strRightAnswer += strN;
                                }
                                else
                                {
                                    strRightAnswer += "," + strN;
                                }
                            }

                            string strScore = "0";
                            if (strRightAnswer == strUserAnswer)
                            {
                                strScore = System.String.Format("{0:0.##}", paperSubject.UnitScore);
                            }

                            Response.Write(" <tr><td class='ExamAnswer'>&nbsp;&nbsp;&nbsp;★标准答案:"
                                           + "<span id='span-" + paperItem.RandomExamItemId + "-0' name='span-" +
                                           paperItem.RandomExamItemId
                                           + "'>" + strRightAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考生答案:"
                                           + "<span id='span-" + paperItem.RandomExamItemId + "-1' name='span-" +
                                           paperItem.RandomExamItemId
                                           + "'>" + strUserAnswer + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;得分:" + strScore + "</td></tr>");
                        }
                    }
                    Response.Write(" </table> ");
                }
            }
            else
            {
                SessionSet.PageMessage = "数据错误!";

                return;
            }
        }
コード例 #13
0
        private void StopExam(string strResultID)
        {
            ViewState["EndTime"] = DateTime.Now.ToString();
            //记录当前考试所在地的OrgID
            ViewState["OrgID"] = ConfigurationManager.AppSettings["StationID"];

            RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    objResultCurrent    = objResultCurrentBll.GetRandomExamResult(Convert.ToInt32(strResultID));

            objResultCurrent.CurrentDateTime = DateTime.Parse(ViewState["EndTime"].ToString());
            objResultCurrent.ExamTime        = GetSecondBetweenTwoDate(DateTime.Parse(ViewState["EndTime"].ToString()),
                                                                       objResultCurrent.BeginDateTime);

            objResultCurrent.EndDateTime    = DateTime.Parse(ViewState["EndTime"].ToString());
            objResultCurrent.Score          = 0;
            objResultCurrent.OrganizationId = int.Parse(ViewState["OrgID"].ToString());
            objResultCurrent.Memo           = "";
            //参加考试将当前考试的标志置为2-已经结束
            objResultCurrent.StatusId    = 2;
            objResultCurrent.AutoScore   = 0;
            objResultCurrent.CorrectRate = 0;

            RandomExamResultBLL objResultBll = new RandomExamResultBLL();

            try
            {
                objResultCurrentBll.UpdateRandomExamResultCurrent(objResultCurrent);
                int randomExamResultID = objResultBll.RemoveResultAnswer(Convert.ToInt32(strResultID));

                //将实时考试记录(临时表)转存到中间考试成绩表和答卷表
                //int randomExamResultID = objResultBll.RemoveResultAnswerCurrent(Convert.ToInt32(strResultID));

                try
                {
                    OracleAccess dbPhoto = new OracleAccess();
                    string       strSql  = "select * from Random_Exam_Result_Detail where Random_Exam_Result_ID=" +
                                           randomExamResultID + " and Random_Exam_ID=" + objResultCurrent.RandomExamId;
                    DataSet dsPhoto = dbPhoto.RunSqlDataSet(strSql);

                    if (dsPhoto.Tables[0].Rows.Count > 0)
                    {
                        DataRow drPhoto    = dsPhoto.Tables[0].Rows[0];
                        int     employeeId = Convert.ToInt32(drPhoto["Employee_ID"]);
                        if (drPhoto["FingerPrint"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["FingerPrint"], 0, randomExamResultID);
                        }
                        if (drPhoto["Photo1"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo1"], 1, randomExamResultID);
                        }
                        if (drPhoto["Photo2"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo2"], 2, randomExamResultID);
                        }
                        if (drPhoto["Photo3"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo3"], 3, randomExamResultID);
                        }
                    }
                }
                catch
                {
                    hfSql.Value = GetSql();
                }

                #region   路局
                //try
                //{
                //    if (!PrjPub.IsServerCenter)
                //    {
                //        RandomExamResult randomExamResult =
                //            objResultBll.GetRandomExamResult(randomExamResultID);
                //        objResultBll.AddRandomExamResultToServer(randomExamResult);
                //    }
                //}
                //catch
                //{
                //    Pub.ShowErrorPage("无法连接路局服务器,请检查站段服务器网络连接是否正常!");
                //}
                #endregion

                hfSql.Value = GetSql();
                examsGrid.DataBind();
                RandomExamBLL objBll    = new RandomExamBLL();
                SystemLogBLL  objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("“" + objBll.GetExam(objResultCurrent.RandomExamId).ExamName + "”中的“" + objResultCurrent.ExamineeName + "”终止考试");
                SessionSet.PageMessage = "终止考试成功!";
            }
            catch
            {
                SessionSet.PageMessage = "终止考试失败!";
            }
        }