Ejemplo n.º 1
0
        private void HasExamId()
        {
            string strExamId = Request.QueryString.Get("id");

            //已经参加考试的考生自动填充上

            RandomExamResultBLL reBll = new RandomExamResultBLL();
            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strExamId));
            string strId = "";

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId = examResults[i].ExamineeId.ToString();

                if (strId.Length == 0)
                {
                    strId += strEmId;
                }
                else
                {
                    strId += "," + strEmId;
                }
            }
            ViewState["HasExamId"] = strId;;
        }
Ejemplo n.º 2
0
        private void DeleteData(int nBookID)
        {
            RandomExamSubjectBLL paperStrategySubjectBLL = new RandomExamSubjectBLL();
            RandomExamSubject    paperStrategySubject    = paperStrategySubjectBLL.GetRandomExamSubject(int.Parse(Request.QueryString.Get("id")));

            if (paperStrategySubject != null)
            {
                RandomExamResultBLL reBll = new RandomExamResultBLL();
                IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(paperStrategySubject.RandomExamId);

                if (Pub.HasPaper(Convert.ToInt32(paperStrategySubject.RandomExamId)))
                {
                    SessionSet.PageMessage = "该考试已生成试卷,取题范围不能被删除!";
                    return;
                }

                if (examResults.Count > 0)
                {
                    SessionSet.PageMessage = "已有考生参加考试,取题范围不能被删除!";
                    return;
                }
            }

            RandomExamStrategyBLL paperStrategyBookChapterBLL = new RandomExamStrategyBLL();

            paperStrategyBookChapterBLL.DeleteRandomExamStrategy(nBookID);

            OracleAccess db     = new OracleAccess();
            string       strSql = "delete from Random_Exam_Strategy where Is_Mother_Item=1 and Mother_ID=" + nBookID;

            db.ExecuteNonQuery(strSql);

            strSql = "delete from Random_Exam_Item_Select where  RANDOM_EXAM_STRATEGY_ID=" + nBookID;
            db.ExecuteNonQuery(strSql);
        }
Ejemplo n.º 3
0
        protected void btnLast_Click(object sender, EventArgs e)
        {
            string strId        = Request.QueryString.Get("id");
            string strStartMode = ViewState["startmode"].ToString();
            string strFlag      = "";

            if (ViewState["mode"].ToString() == "Insert")
            {
                strFlag = "Edit";
            }
            else if (ViewState["mode"].ToString() == "Edit")
            {
                RandomExamResultBLL reBll = new RandomExamResultBLL();
                IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(Convert.ToInt32(strId));

                if (examResults.Count > 0)
                {
                    strFlag = "ReadOnly";
                }
                else
                {
                    strFlag = ViewState["mode"].ToString();
                }
            }
            else
            {
                strFlag = ViewState["mode"].ToString();
            }

            Response.Redirect("RandomExamManageThird.aspx?startmode=" + strStartMode + "&mode=" + strFlag + "&id=" + strId);
        }
        protected void btnLast_Click(object sender, ImageClickEventArgs e)
        {
            string strId        = Request.QueryString.Get("id");
            string strStartMode = ViewState["startmode"].ToString();
            string strFlag      = "";

            if (ViewState["mode"].ToString() == "Insert")
            {
                strFlag = "Edit";
            }
            else if (ViewState["mode"].ToString() == "Edit")
            {
                RandomExamResultBLL reBll = new RandomExamResultBLL();
                IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(Convert.ToInt32(strId));

                if (examResults.Count > 0)
                {
                    strFlag = "ReadOnly";
                }
                else
                {
                    strFlag = ViewState["mode"].ToString();
                }
            }
            else
            {
                strFlag = ViewState["mode"].ToString();
            }

            if (PrjPub.IsWuhan())
            {
                Response.Redirect("RandomExamManageThird.aspx?startmode=" + strStartMode + "&mode=" + strFlag + "&id=" + strId);
            }
            else
            {
                string strItemType = "";
                RandomExamSubjectBLL      objSubjectBll  = new RandomExamSubjectBLL();
                IList <RandomExamSubject> objSubjectList = objSubjectBll.GetRandomExamSubjectByRandomExamId(Convert.ToInt32(strId));
                foreach (RandomExamSubject subject in objSubjectList)
                {
                    if (strItemType == "")
                    {
                        strItemType = subject.ItemTypeId.ToString();
                    }
                    else
                    {
                        strItemType = strItemType + "|" + subject.ItemTypeId;
                    }
                }
                Response.Redirect("/RailExamBao/RandomExamOther/RandomExamStrategyInfo.aspx?startmode=" + strStartMode + "&mode=" + strFlag + "&itemType=" + strItemType + "&id=" + strId);
            }
        }
Ejemplo n.º 5
0
        private void UploadPaper()
        {
            // 根据 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 strId = Request.QueryString.Get("RandomExamID");
            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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

            string       typeid = Request.QueryString.Get("typeid");
            string       strSql, strKey = "0";
            OracleAccess db = new OracleAccess();

            int orgId = Convert.ToInt32(ConfigurationManager.AppSettings["StationID"]);

            try
            {
                RandomExamResultBLL objResultBll = new RandomExamResultBLL();

                strSql = "select SYNCHRONIZE_LOG_SEQ.NextVal@link_sf from dual";
                DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];
                strKey = dr[0].ToString();

                strSql = "insert into  SYNCHRONIZE_LOG@link_sf values(" + strKey + ","
                         + orgId + ",6,sysdate,null,1," + PrjPub.ServerNo + ")";
                db.ExecuteNonQuery(strSql);

                strSql =
                    @"select Examinee_ID,Random_Exam_Result_ID from Random_Exam_Result@link_sf where Random_Exam_ID=" + obj.RandomExamId + @"
                                      and org_id=" + PrjPub.StationID + @" and examinee_id in (select employee_Id from Random_Exam_Result_Detail a
                                      inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID
                                      inner join Computer_Server c on b.Computer_Server_ID=c.Computer_Server_ID
                                      where to_number(c.Computer_Server_No)=" + PrjPub.ServerNo + @" and a.Random_Exam_ID=" + obj.RandomExamId + ")";
                DataSet dsResult = db.RunSqlDataSet(strSql);


                IList <RandomExamResult> randomExamResults = objResultBll.GetRandomExamResultByExamID(obj.RandomExamId);
                int count = randomExamResults.Count + dsResult.Tables[0].Rows.Count + 1;
                System.Threading.Thread.Sleep(10);
                string jsBlock = "<script>SetPorgressBar('正在上传考试答卷,请等待......','" + ((1 * 100) / ((double)count)).ToString("0.00") + "'); </script>";
                Response.Write(jsBlock);
                Response.Flush();


                string    strUrl = "ftp://" + PrjPub.ServerIP + "/Photo";
                Uri       directoryToDownload = new Uri(strUrl);
                FtpClient ftpSession          = FtpClient.GetFtpClient(directoryToDownload.Host);

                if (ftpSession == null)
                {
                    Pub.AddFtp();
                    ftpSession = FtpClient.GetFtpClient(directoryToDownload.Host);
                }

                ftpSession.MakeDirectory("/Photo/" + obj.RandomExamId);

                int progressNum = 2;

                foreach (DataRow drResult in dsResult.Tables[0].Rows)
                {
                    ftpSession.DeleteFile(new Uri(strUrl + "/" + obj.RandomExamId + "/" + drResult["Examinee_ID"] + "_" + drResult["Random_Exam_Result_ID"] + "_00.jpg"));
                    ftpSession.DeleteFile(new Uri(strUrl + "/" + obj.RandomExamId + "/" + drResult["Examinee_ID"] + "_" + drResult["Random_Exam_Result_ID"] + "_01.jpg"));
                    ftpSession.DeleteFile(new Uri(strUrl + "/" + obj.RandomExamId + "/" + drResult["Examinee_ID"] + "_" + drResult["Random_Exam_Result_ID"] + "_02.jpg"));
                    ftpSession.DeleteFile(new Uri(strUrl + "/" + obj.RandomExamId + "/" + drResult["Examinee_ID"] + "_" + drResult["Random_Exam_Result_ID"] + "_03.jpg"));

                    System.Threading.Thread.Sleep(10);
                    jsBlock = "<script>SetPorgressBar('正在上传考试答卷,请等待......','" + ((progressNum * 100) / ((double)count)).ToString("0.00") + "'); </script>";
                    Response.Write(jsBlock);
                    Response.Flush();

                    progressNum++;
                }

                //先删除路局的考试成绩和答卷
                objResultBll.DeleteRandomExamResultServer(obj.RandomExamId);

                foreach (RandomExamResult randomExamResult in randomExamResults)
                {
                    if (randomExamResult.IsTemp == 1)
                    {
                        //从中间提交表到正式表
                        objResultBll.RemoveResultAnswerTemp(randomExamResult.RandomExamResultId);
                    }

                    //获取路局的主键ID
                    strSql = "select Random_Exam_Result_Seq.Nextval@link_sf from dual";
                    DataRow drSeq    = db.RunSqlDataSet(strSql).Tables[0].Rows[0];
                    int     serverId = Convert.ToInt32(drSeq[0]);

                    //将成绩插入路局
                    objResultBll.InsertRandomExamResultServer(randomExamResult.RandomExamResultId, serverId, obj.RandomExamId);

                    if (typeid == "2")
                    {
                        //将答卷插入路局
                        objResultBll.InsertRandomExamResultAnswerServer(obj.RandomExamId, randomExamResult.RandomExamResultId, serverId);
                    }

                    strSql = "select * from Random_Exam_Result_Photo where Random_Exam_ID=" + obj.RandomExamId +
                             " and Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId;
                    DataSet ds = db.RunSqlDataSet(strSql);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow drPhoto = ds.Tables[0].Rows[0];

                        int employeeId = Convert.ToInt32(drPhoto["Employee_ID"]);
                        Uri ftpUri     = new Uri(strUrl + "/" + obj.RandomExamId + "/");
                        if (drPhoto["FingerPrint"] != DBNull.Value)
                        {
                            SavePhotoToServer(employeeId, (byte[])drPhoto["FingerPrint"], 0, serverId, ftpSession, ftpUri);
                        }

                        if (drPhoto["Photo1"] != DBNull.Value)
                        {
                            SavePhotoToServer(employeeId, (byte[])drPhoto["Photo1"], 1, serverId, ftpSession, ftpUri);
                        }

                        if (drPhoto["Photo2"] != DBNull.Value)
                        {
                            SavePhotoToServer(employeeId, (byte[])drPhoto["Photo2"], 2, serverId, ftpSession, ftpUri);
                        }

                        if (drPhoto["Photo3"] != DBNull.Value)
                        {
                            SavePhotoToServer(employeeId, (byte[])drPhoto["Photo3"], 3, serverId, ftpSession, ftpUri);
                        }
                    }

                    System.Threading.Thread.Sleep(10);
                    jsBlock = "<script>SetPorgressBar('正在上传考试答卷,请等待......','" + ((progressNum * 100) / ((double)count)).ToString("0.00") + "'); </script>";
                    Response.Write(jsBlock);
                    Response.Flush();

                    progressNum++;
                }

                if (typeid == "1")
                {
                    //只上传成绩须更新时间
                    strSql = "update Random_Exam_Computer_Server@link_sf set  "
                             + "Last_Upload_Date=sysdate   where random_exam_id=" + obj.RandomExamId
                             + " and Computer_server_no=" + PrjPub.ServerNo;
                    db.ExecuteNonQuery(strSql);
                }
                else
                {
                    //如果考试已经结束上传,将上传标志置为已经上传
                    if (obj.IsStart == 2)
                    {
                        objBll.UpdateIsUpload(obj.RandomExamId, PrjPub.ServerNo, 1);
                    }
                    else
                    {
                        objBll.UpdateIsUpload(obj.RandomExamId, PrjPub.ServerNo, 0);
                    }
                }

                strSql = "update SYNCHRONIZE_LOG@link_sf set SYNCHRONIZE_STATUS_ID=2,End_Time=sysdate where SYNCHRONIZE_LOG_ID=" + strKey;
                db.ExecuteNonQuery(strSql);
            }
            catch (Exception ex)
            {
                strSql = "update SYNCHRONIZE_LOG@link_sf set SYNCHRONIZE_STATUS_ID=3,End_Time=sysdate where SYNCHRONIZE_LOG_ID=" + strKey;
                db.ExecuteNonQuery(strSql);
                Response.Write("<script>alert('" + ex.Message.Replace("\n", "\r\n") + "');window.close();</script>");
                return;
            }

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
        protected void FillPage(int nExamID)
        {
            RandomExamBLL examBLL = new RandomExamBLL();

            RailExam.Model.RandomExam exam = examBLL.GetExam(nExamID);

            if (exam != null)
            {
                if (ViewState["startmode"].ToString() == "Edit")
                {
                    if (Pub.HasPaper(exam.RandomExamId))
                    {
                        Response.Write("<script>alert('该考试已生成试卷,不能被编辑!');window.close();</script>");
                        return;
                    }
                }
                hfHasTrainClass.Value   = exam.HasTrainClass.ToString();
                txtCategoryName.Text    = exam.CategoryName;
                hfCategoryId.Value      = exam.CategoryId.ToString();
                ddlType.SelectedValue   = exam.ExamTypeId.ToString();
                txtExamName.Text        = exam.ExamName;
                txtExamTime.Text        = exam.ExamTime.ToString();
                dateBeginTime.DateValue = exam.BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
                dateEndTime.DateValue   = exam.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                txtPassScore.Text       = exam.PassScore.ToString();
                if (exam.IsComputerExam)
                {
                    rbnExamMode1.Checked = true;
                    rbnExamMode2.Checked = false;
                }
                else
                {
                    rbnExamMode1.Checked = false;
                    rbnExamMode2.Checked = true;
                    rbnExamMode1.Enabled = false;
                    rbnExamMode2.Enabled = false;
                }

                if (exam.StartMode == 1)
                {
                    rbnStartMode1.Checked = true;
                }
                else
                {
                    rbnStartMode2.Checked = true;
                }

                if (exam.ExamStyle == 1)
                {
                    rbnStyle1.Checked = true;
                }
                else
                {
                    rbnStyle2.Checked = true;
                }

                if (exam.AutoSaveInterval == 1)
                {
                    chkAllItem.Checked = true;
                }
                else
                {
                    chkAllItem.Checked = false;
                }

                txtMET2.Text                 = exam.MaxExamTimes.ToString();
                chUD.Checked                 = exam.IsUnderControl;
                chAutoScore.Checked          = exam.IsAutoScore;
                chkCanSeeAnswer.Checked      = exam.CanSeeAnswer;
                chSeeScore.Checked           = exam.CanSeeScore;
                chPublicScore.Checked        = exam.IsPublicScore;
                txtDescription.Text          = exam.Description;
                txtMemo.Text                 = exam.Memo;
                ddlModularType.SelectedValue = exam.RandomExamModularTypeID.ToString();
                chkIsReduceScore.Checked     = exam.IsReduceError;

                //存档考试
                if (exam.ExamStyle == 2)
                {
                    rbnStyle2.Checked     = true;
                    saveTd.Visible        = true;
                    ddlDate.SelectedValue = exam.SaveStatus.ToString();

                    if (exam.SaveStatus == 2)
                    {
                        dateSaveDate.Visible   = true;
                        dateSaveDate.DateValue = Convert.ToDateTime(exam.SaveDate).ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        dateSaveDate.Visible = false;
                    }
                }
                else
                {
                    rbnStyle1.Checked = true;
                    saveTd.Visible    = false;
                }

                lblCreatePerson.Text = exam.CreatePerson;
                lblCreateTime.Text   = exam.CreateTime.ToString("yyyy-MM-dd HH:mm");

                if (ViewState["startmode"].ToString() == "Edit")
                {
                    RandomExamResultBLL reBll = new RandomExamResultBLL();
                    IList <RailExam.Model.RandomExamResult> examResults =
                        reBll.GetRandomExamResultByExamID(exam.RandomExamId);

                    if (examResults.Count > 0)
                    {
                        ViewState["mode"] = "ReadOnly";
                    }
                }



                chkHasTrainClass.Checked   = exam.HasTrainClass;
                ViewState["HasTrainClass"] = chkHasTrainClass.Checked.ToString();
                SetTrainClassVisible(chkHasTrainClass.Checked);
                if (chkHasTrainClass.Checked)
                {
                    RandomExamTrainClassBLL      objTrainClassBll  = new RandomExamTrainClassBLL();
                    IList <RandomExamTrainClass> objTrainClassList =
                        objTrainClassBll.GetRandomExamTrainClassByRandomExamID(exam.RandomExamId);
                    DataTable dataTable = new DataTable();
                    dataTable.Columns.Add(new DataColumn("RandomExamTrainClassID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("RandomExamID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("TrainClassID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("TrainClassName", typeof(string)));
                    dataTable.Columns.Add(new DataColumn("TrainClassSubjectID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("TrainClassSubjectName", typeof(string)));

                    string strSql = "";
                    foreach (RandomExamTrainClass trainClass in objTrainClassList)
                    {
                        DataRow newRow = dataTable.NewRow();

                        newRow[0] = trainClass.RandomExamTrainClassID;
                        newRow[1] = trainClass.RandomExamID;
                        newRow[2] = trainClass.TrainClassID;

                        OracleAccess db = new OracleAccess();
                        strSql    = "select * from ZJ_Train_Class where Train_Class_ID=" + trainClass.TrainClassID;
                        newRow[3] = db.RunSqlDataSet(strSql).Tables[0].Rows[0]["Train_Class_Name"].ToString();

                        newRow[4] = trainClass.TrainClassSubjectID;

                        strSql    = "select * from ZJ_Train_Class_Subject where Train_Class_Subject_ID=" + trainClass.TrainClassSubjectID;
                        newRow[5] = db.RunSqlDataSet(strSql).Tables[0].Rows[0]["Subject_Name"].ToString();

                        dataTable.Rows.Add(newRow);

                        if (hfTrainClassID.Value == "")
                        {
                            hfTrainClassID.Value = trainClass.TrainClassID.ToString();
                        }
                        else
                        {
                            hfTrainClassID.Value = hfTrainClassID.Value + "," + trainClass.TrainClassID.ToString();
                        }
                    }

                    ViewState["TrainClass"] = hfTrainClassID.Value;

                    Grid1.DataSource = dataTable;
                    Grid1.DataBind();

                    //当考试为补考的时候,不能修改培训班信息
                    if (exam.IsReset)
                    {
                        chkHasTrainClass.Enabled = false;
                        Grid1.Enabled            = false;
                        btnAddTrainClass.Visible = false;
                    }
                    hfIsReset.Value = exam.IsReset.ToString();
                }
                else
                {
                    ViewState["TrainClass"] = "";
                    ViewState["PostID"]     = "";
                }

                hfPostID.Value      = exam.PostID;
                ViewState["PostID"] = hfPostID.Value;

                if (!string.IsNullOrEmpty(exam.PostID))
                {
                    PostBLL  postBLL   = new PostBLL();
                    string[] strPostID = exam.PostID.Split(',');
                    for (int i = 0; i < strPostID.Length; i++)
                    {
                        if (i == 0)
                        {
                            txtPost.Text = postBLL.GetPost(Convert.ToInt32(strPostID[i])).PostName;
                        }
                        else
                        {
                            txtPost.Text = txtPost.Text + "," + postBLL.GetPost(Convert.ToInt32(strPostID[i])).PostName;
                        }
                    }
                    hfPostName.Value = txtPost.Text;
                }
            }

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                txtExamName.Enabled      = false;
                dateBeginTime.Enabled    = false;
                dateEndTime.Enabled      = false;
                ddlType.Enabled          = false;
                txtExamTime.Enabled      = false;
                rbnExamMode1.Enabled     = false;
                rbnExamMode2.Enabled     = false;
                txtMET2.Enabled          = false;
                chUD.Enabled             = false;
                chAutoScore.Enabled      = false;
                chkCanSeeAnswer.Enabled  = false;
                chSeeScore.Enabled       = false;
                chPublicScore.Enabled    = false;
                txtDescription.Enabled   = false;
                txtMemo.Enabled          = false;
                rbnStartMode1.Enabled    = false;
                rbnStartMode2.Enabled    = false;
                txtPassScore.Enabled     = false;
                chkHasTrainClass.Enabled = false;
                Grid1.Enabled            = false;
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strID = Request.QueryString.Get("id");
                ViewState["mode"]     = Request.QueryString.Get("mode");
                hfItemType.Value      = Request.QueryString.Get("itemTypeID");
                ddlType.SelectedValue = hfItemType.Value;
                if (ViewState["mode"].ToString() == "Insert")
                {
                    string subjectId = Request.QueryString.Get("subjectid");
                    hfSubjectId.Value = subjectId;
                    if (!string.IsNullOrEmpty(subjectId))
                    {
                        RandomExamSubjectBLL paperStrategySubjectBLL = new RandomExamSubjectBLL();
                        RandomExamSubject    paperStrategySubject    = paperStrategySubjectBLL.GetRandomExamSubject(int.Parse(subjectId));

                        if (paperStrategySubject != null)
                        {
                            hfExamID.Value        = paperStrategySubject.RandomExamId.ToString();
                            txtSubjectName.Text   = paperStrategySubject.SubjectName;
                            ddlType.SelectedValue = paperStrategySubject.ItemTypeId.ToString();
                            labelTotalCount.Text  = paperStrategySubject.ItemCount.ToString();

                            RandomExamStrategyBLL randomExamStrategyBLL = new RandomExamStrategyBLL();
                            IList <RailExam.Model.RandomExamStrategy> RandomExamStrategys = randomExamStrategyBLL.GetRandomExamStrategys(paperStrategySubject.RandomExamSubjectId);

                            int hasCount = 0;
                            foreach (RailExam.Model.RandomExamStrategy randomExamStrategy in RandomExamStrategys)
                            {
                                hasCount += randomExamStrategy.ItemCount;
                            }

                            labelLeaveCount.Text = (paperStrategySubject.ItemCount - hasCount).ToString();

                            txtNDR.Text = labelLeaveCount.Text;

                            RandomExamResultBLL reBll = new RandomExamResultBLL();
                            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(paperStrategySubject.RandomExamId);

                            if (examResults.Count > 0)
                            {
                                SaveButton.Visible = false;
                            }
                        }

                        hfSubjectId.Value = subjectId;

                        mother1.Visible = false;
                        mother2.Visible = false;
                    }

                    OracleAccess db     = new OracleAccess();
                    string       strSql = "select RANDOM_EXAM_STRATEGY_SEQ.nextval from dual";
                    DataRow      dr     = db.RunSqlDataSet(strSql).Tables[0].Rows[0];
                    hfKeyID.Value = dr[0].ToString();
                }
                else
                {
                    hfKeyID.Value = strID;
                    FillPage(int.Parse(strID));
                }
            }

            if (!string.IsNullOrEmpty(HfChapterId.Value))
            {
                if (HfRangeType.Value == "4")
                {
                    BookChapterBLL chapterBll = new BookChapterBLL();
                    BookChapter    chapter    = chapterBll.GetBookChapter(Convert.ToInt32(HfChapterId.Value));

                    txtChapterName.Text = chapter.ChapterName;
                }
                else
                {
                    BookBLL             bookBll = new BookBLL();
                    RailExam.Model.Book book    = bookBll.GetBook(Convert.ToInt32(HfChapterId.Value));

                    txtChapterName.Text = book.bookName;
                }
            }

            if (!string.IsNullOrEmpty(HfExCludeChaptersId.Value))
            {
                string strSql = "select * from Book_Chapter where Chapter_ID in (" + HfExCludeChaptersId.Value + ")";

                OracleAccess db = new OracleAccess();
                DataSet      ds = db.RunSqlDataSet(strSql);

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

                txtExCludeChapters.Text = strName;
            }
        }
Ejemplo n.º 8
0
        private void FillPage(int nID)
        {
            RandomExamStrategyBLL paperStrategyBookChapterBLL = new RandomExamStrategyBLL();

            RandomExamStrategy paperStrategyBookChapter = paperStrategyBookChapterBLL.GetRandomExamStrategy(nID);

            if (paperStrategyBookChapter != null)
            {
                txtMemo.Text        = paperStrategyBookChapter.Memo;
                txtChapterName.Text = paperStrategyBookChapter.RangeName;
                HfRangeName.Value   = paperStrategyBookChapter.RangeName;

                hfSubjectId.Value     = paperStrategyBookChapter.SubjectId.ToString();
                HfRangeType.Value     = paperStrategyBookChapter.RangeType.ToString();
                HfChapterId.Value     = paperStrategyBookChapter.RangeId.ToString();
                ddlType.SelectedValue = paperStrategyBookChapter.ItemTypeId.ToString();
                txtNDR.Text           = paperStrategyBookChapter.ItemCount.ToString();



                RandomExamSubjectBLL paperStrategySubjectBLL = new RandomExamSubjectBLL();
                RandomExamSubject    paperStrategySubject    = paperStrategySubjectBLL.GetRandomExamSubject(int.Parse(hfSubjectId.Value));

                if (paperStrategySubject != null)
                {
                    hfExamID.Value       = paperStrategySubject.RandomExamId.ToString();
                    txtSubjectName.Text  = paperStrategySubject.SubjectName;
                    labelTotalCount.Text = paperStrategySubject.ItemCount.ToString();

                    IList <RailExam.Model.RandomExamStrategy> RandomExamStrategys = paperStrategyBookChapterBLL.GetRandomExamStrategys(paperStrategySubject.RandomExamSubjectId);

                    int hasCount = 0;
                    foreach (RailExam.Model.RandomExamStrategy randomExamStrategy in RandomExamStrategys)
                    {
                        if (randomExamStrategy.RandomExamStrategyId != nID)
                        {
                            hasCount += randomExamStrategy.ItemCount;
                        }
                    }

                    labelLeaveCount.Text = (paperStrategySubject.ItemCount - hasCount).ToString();

                    RandomExamResultBLL reBll = new RandomExamResultBLL();
                    IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(paperStrategySubject.RandomExamId);

                    if (examResults.Count > 0)
                    {
                        ViewState["mode"] = "ReadOnly";
                    }
                }

                string strSql = "select a.random_exam_strategy_id as RandomExamStrategyId,a.Item_Count as ItemCount,"
                                + "GetBookChapterName(b.Chapter_ID) ChapterName, b.Chapter_ID as ChapterId,b.ID_Path as IDPath "
                                + "from random_exam_strategy a"
                                + " inner join Book_Chapter b on a.Range_ID=b.Chapter_ID "
                                + " where a.Is_Mother_Item=1 and a.Mother_ID=" + nID;

                OracleAccess db = new OracleAccess();

                DataSet ds = db.RunSqlDataSet(strSql);


                if (paperStrategyBookChapter.RangeType == 3 && ds.Tables[0].Rows.Count == 0)
                {
                    txtExCludeChapters.Text = paperStrategyBookChapter.ExcludeChapterId;

                    if (string.IsNullOrEmpty(paperStrategyBookChapter.ExcludeChapterId) == false)
                    {
                        FillExcludeCategorysID(paperStrategyBookChapter.ExcludeChapterId);
                    }
                }

                int     sumTotalCount = 0;
                ItemBLL itembll       = new ItemBLL();
                if (HfRangeType.Value == "3")
                {
                    sumTotalCount = itembll.GetItemsByBookID(Convert.ToInt32(HfChapterId.Value),
                                                             Convert.ToInt32(hfItemType.Value));
                }
                else
                {
                    BookChapterBLL bookChapterBll = new BookChapterBLL();
                    BookChapter    bookChapter    = bookChapterBll.GetBookChapter(Convert.ToInt32(HfChapterId.Value));
                    sumTotalCount = itembll.GetItemsByBookChapterIdPath(bookChapter.IdPath,
                                                                        Convert.ToInt32(hfItemType.Value));
                }

                if (ds.Tables[0].Rows.Count == 0)
                {
                    mother1.Visible = false;
                    mother2.Visible = false;
                }
                else
                {
                    mother1.Visible = true;
                    mother2.Visible = true;

                    DataColumn dc1 = ds.Tables[0].Columns.Add("MaxItemCount");

                    ItemBLL item        = new ItemBLL();
                    int     sumCount    = 0;
                    int     sumMaxCount = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        dr["MaxItemCount"] = item.GetItemsByBookChapterIdPath(dr["IDPath"].ToString(),
                                                                              Convert.ToInt32(hfItemType.Value));

                        sumCount    += Convert.ToInt32(dr["ItemCount"].ToString());
                        sumMaxCount += Convert.ToInt32(dr["MaxItemCount"].ToString());
                    }

                    txtNDR.Text = (paperStrategyBookChapter.ItemCount + sumCount).ToString();

                    Grid1.DataSource = ds;
                    Grid1.DataBind();

                    lblMotherInfo.Text = "其中子题最大题数:" + (sumTotalCount - sumMaxCount) + ";母题最大题数:" + sumMaxCount;
                }
                strSql              = "select * from Item a inner join Book_Chapter b on a.Chapter_ID=b.Chapter_ID " + GetSelectSql();
                lblTotalCount.Text  = db.RunSqlDataSet(strSql).Tables[0].Rows.Count.ToString();
                strSql              = " select * from  Random_Exam_Item_Select where RANDOM_EXAM_STRATEGY_ID=" + nID;
                lblSelectCount.Text = db.RunSqlDataSet(strSql).Tables[0].Rows.Count.ToString();
            }

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                SaveButton.Visible   = false;
                CancelButton.Visible = true;
                ddlType.Enabled      = false;
                txtMemo.Enabled      = false;
            }
        }
Ejemplo n.º 9
0
        private void BindChoosedGrid(string strId, string strOrderBy)
        {
            HasExamId();

            string strExamId = Request.QueryString.Get("id");
            //已经参加考试的考生自动填充上

            RandomExamResultBLL reBll = new RandomExamResultBLL();
            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strExamId));

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId     = examResults[i].ExamineeId.ToString();
                string strOldAllId = "," + strId + ",";
                if (strOldAllId.IndexOf("," + strEmId + ",") == -1)
                {
                    if (strId.Length == 0)
                    {
                        strId += strEmId;
                    }
                    else
                    {
                        strId += "," + strEmId;
                    }
                }
            }

            EmployeeBLL psBLL = new EmployeeBLL();
            DataSet     ds    = new DataSet();

            string strIDs = "," + strId + ",";

            if (strIDs.Length > 2000)
            {
                ds = psBLL.GetEmployeesByEmployeeIdS(strIDs);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //DataView dv = ds.Tables[0].DefaultView;
                    //dv.Sort = strOrderBy;
                    Grid2.DataSource = ds;
                    Grid2.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
            else
            {
                IList <Employee> objList = psBLL.GetEmployeesByEmployeeId(strIDs);
                if (objList.Count > 0)
                {
                    ds.Tables.Add(ConvertToDataTable((IList)objList));
                    Grid2.DataSource = ds;
                    Grid2.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
        }
        private void BindChoosedGrid(string strId)
        {
            HasExamId();

            string strExamId = Request.QueryString.Get("id");
            //已经参加考试的考生自动填充上

            RandomExamResultBLL reBll = new RandomExamResultBLL();
            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strExamId));

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId     = examResults[i].ExamineeId.ToString();
                string strOldAllId = "," + strId + ",";
                if (strOldAllId.IndexOf("," + strEmId + ",") == -1)
                {
                    if (strId.Length == 0)
                    {
                        strId += strEmId;
                    }
                    else
                    {
                        strId = strEmId + "," + strId;
                    }
                }
            }

            EmployeeBLL psBLL = new EmployeeBLL();
            DataSet     ds    = new DataSet();

            //string strIDs = "," + strId + ",";
            //if (strIDs.Length > 2000)
            //{
            //    ds = psBLL.GetEmployeesByEmployeeIdS(strIDs);
            //    if (ds.Tables[0].Rows.Count > 0)
            //    {
            //        gvChoose.DataSource = ds;
            //        gvChoose.DataBind();
            //    }
            //    else
            //    {
            //        BindEmptyGrid2();
            //    }
            //}
            //else
            //{
            //    IList<Employee> objList = psBLL.GetEmployeesByEmployeeId(strIDs);
            //    if (objList.Count > 0)
            //    {
            //        ds.Tables.Add(ConvertToDataTable((IList)objList));
            //        gvChoose.DataSource = objList;
            //        gvChoose.DataBind();
            //    }
            //    else
            //    {
            //        BindEmptyGrid2();
            //    }
            //}

            string[]         str     = strId.Split(',');
            IList <Employee> objList = new List <Employee>();

            if (str[0] != "")
            {
                OracleAccess db = new OracleAccess();
                string       strSql;

                string    strQuery       = GetSql();
                ArrayList objEmloyeeList = new ArrayList();
                if (!string.IsNullOrEmpty(strQuery))
                {
                    IList <Employee> objSelectList = psBLL.GetEmployeeByWhereClause("1=1" + strQuery);

                    foreach (Employee employee in objSelectList)
                    {
                        objEmloyeeList.Add(employee.EmployeeID.ToString());
                    }
                }

                for (int i = 0; i < str.Length; i++)
                {
                    if (string.IsNullOrEmpty(str[i]))
                    {
                        continue;
                    }

                    Employee obj = psBLL.GetChooseEmployeeInfo(str[i]);
                    obj.RowNum = i + 1;
                    //if(string.IsNullOrEmpty(obj.WorkNo))
                    //{
                    //    strSql = "select identity_cardno from Employee where Employee_ID=" + str[i];
                    //    obj.WorkNo = db.RunSqlDataSet(strSql).Tables[0].Rows[0][0].ToString();
                    //}

                    if (!string.IsNullOrEmpty(strQuery))
                    {
                        if (objEmloyeeList.IndexOf(str[i]) >= 0)
                        {
                            objList.Add(obj);
                        }
                    }
                    else
                    {
                        objList.Add(obj);
                    }
                }

                if (objList.Count > 0)
                {
                    ds.Tables.Add(ConvertToDataTable((IList)objList));

                    if (ViewState["Sort"] != null)
                    {
                        try
                        {
                            ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString();
                        }
                        catch
                        {
                        }
                    }

                    DataColumn dc = ds.Tables[0].Columns.Add("ComputeRoom");

                    strSql = "select a.*,c.Short_Name||'-'||b.Computer_Room_Name as ComputeRoom "
                             + " from Random_Exam_Arrange_Detail a "
                             + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID"
                             + " inner join Org c on b.Org_ID=c.Org_ID"
                             + " where Random_Exam_ID='" + strExamId + "'";
                    DataSet dsDetail = db.RunSqlDataSet(strSql);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string    strUser = "******" + dr["EmployeeID"] + ",";
                        DataRow[] drs     = dsDetail.Tables[0].Select("','+User_Ids+',' like '%" + strUser + "%'");

                        if (drs.Length > 0)
                        {
                            dr["ComputeRoom"] = drs[0]["ComputeRoom"].ToString();
                        }
                        else
                        {
                            dr["ComputeRoom"] = string.Empty;
                        }
                    }

                    gvChoose.DataSource = ds;
                    gvChoose.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
            else
            {
                BindEmptyGrid2();
            }
        }
        private void BindGrid()
        {
            RandomExamResultBLL      objResultBll  = new RandomExamResultBLL();
            IList <RandomExamResult> objResultList = objResultBll.GetRandomExamResultByExamID(Convert.ToInt32(ViewState["ExamID"]));
            Hashtable htResult = new Hashtable();

            foreach (RandomExamResult result in objResultList)
            {
                htResult.Add(result.ExamineeId, result.ExamineeName);
            }

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("RandomExamResultID", typeof(int)));
            dt.Columns.Add(new DataColumn("ExamineeID", typeof(int)));
            dt.Columns.Add(new DataColumn("ExamineeName", typeof(string)));
            dt.Columns.Add(new DataColumn("WorkNo", typeof(string)));
            dt.Columns.Add(new DataColumn("PostName", typeof(string)));
            dt.Columns.Add(new DataColumn("OrganizationName", typeof(string)));
            dt.Columns.Add(new DataColumn("ExamOrgName", typeof(string)));
            dt.Columns.Add(new DataColumn("Score", typeof(string)));

            RandomExamArrangeBLL      objArrangeBll  = new RandomExamArrangeBLL();
            IList <RandomExamArrange> objArrangeList = objArrangeBll.GetRandomExamArranges(Convert.ToInt32(ViewState["ExamID"]));

            if (objArrangeList.Count == 0)
            {
                Grid1.DataSource = dt;
                Grid1.DataBind();
                return;
            }
            RandomExamArrange objArrange = objArrangeList[0];

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


            EmployeeBLL objEmployeeBll = new EmployeeBLL();

            for (int i = 0; i < str.Length; i++)
            {
                Employee objEmployee = objEmployeeBll.GetEmployee(Convert.ToInt32(str[i]));
                if (!htResult.ContainsKey(Convert.ToInt32(str[i])))
                {
                    DataRow dr = dt.NewRow();
                    dr["RandomExamResultID"] = 0;
                    dr["ExamineeID"]         = Convert.ToInt32(str[i]);
                    dr["ExamineeName"]       = objEmployee.EmployeeName;
                    dr["WorkNo"]             = objEmployee.WorkNo;
                    dr["PostName"]           = objEmployee.PostName;
                    dr["OrganizationName"]   = objEmployee.OrgName;
                    dr["ExamOrgName"]        = ViewState["ExamOrgName"].ToString();
                    dr["Score"] = "";
                    dt.Rows.Add(dr);
                }
                else
                {
                    RandomExamResult objResult =
                        objResultBll.GetRandomExamResultByExamineeID(Convert.ToInt32(str[i]), Convert.ToInt32(ViewState["ExamID"]))[0];
                    DataRow dr = dt.NewRow();
                    dr["RandomExamResultID"] = objResult.RandomExamResultId;
                    dr["ExamineeID"]         = Convert.ToInt32(str[i]);
                    dr["ExamineeName"]       = objResult.ExamineeName;
                    dr["WorkNo"]             = objResult.WorkNo;
                    dr["PostName"]           = objEmployee.PostName;
                    dr["OrganizationName"]   = objEmployee.OrgName;
                    dr["ExamOrgName"]        = ViewState["ExamOrgName"].ToString();
                    dr["Score"] = objResult.Score;
                    dt.Rows.Add(dr);
                }
            }

            Grid1.DataSource = dt;
            Grid1.DataBind();
        }
Ejemplo n.º 12
0
        //查找已生成试卷的人员信息
        private void HasExamId()
        {
            string strExamId = ViewState["ExamID"].ToString();

            if (!string.IsNullOrEmpty(Request.QueryString.Get("selectType")))
            {
                //RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();
                //IList<RandomExamResultCurrent> examResults = objResultCurrentBll.GetRandomExamResultInfo(Convert.ToInt32(strExamId));
                //string strId = "";
                //for (int i = 0; i < examResults.Count; i++)
                //{
                //    string strEmId = examResults[i].ExamineeId.ToString();

                //    if (("," + strId + ",").IndexOf("," + strEmId + ",") < 0)
                //    {
                //        if (strId.Length == 0)
                //        {
                //            strId += strEmId;
                //        }
                //        else
                //        {
                //            strId += "," + strEmId;
                //        }
                //    }
                //}
                //ViewState["HasExamId"] = strId;

                string       strSql = "select * from Random_Exam_Arrange_Detail where Random_Exam_ID=" + strExamId;
                OracleAccess db     = new OracleAccess();
                DataSet      ds     = db.RunSqlDataSet(strSql);

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

                ViewState["HasExamId"] = strId;
            }
            else
            {
                RandomExamResultBLL reBll = new RandomExamResultBLL();
                IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strExamId));
                string strId = "";
                for (int i = 0; i < examResults.Count; i++)
                {
                    string strEmId = examResults[i].ExamineeId.ToString();

                    if (strId.Length == 0)
                    {
                        strId += strEmId;
                    }
                    else
                    {
                        strId += "," + strEmId;
                    }
                }
                ViewState["HasExamId"] = strId;;
            }
        }
        protected void FillPage(int nExamID)
        {
            RandomExamBLL examBLL = new RandomExamBLL();

            RailExam.Model.RandomExam exam = examBLL.GetExam(nExamID);

            if (exam != null)
            {
                ViewState["OrgID"] = exam.OrgId.ToString();

                if (ViewState["startmode"].ToString() == "Edit")
                {
                    if (exam.HasPaper)
                    {
                        Response.Write("<script>alert('该考试已生成试卷,不能被编辑!');window.close();</script>");
                    }
                }
                txtCategoryName.Text    = exam.CategoryName;
                hfCategoryId.Value      = exam.CategoryId.ToString();
                ddlType.SelectedValue   = exam.ExamTypeId.ToString();
                txtExamName.Text        = exam.ExamName;
                txtExamTime.Text        = exam.ExamTime.ToString();
                ViewState["BeginTime"]  = exam.BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
                dateBeginTime.DateValue = exam.BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
                dateEndTime.DateValue   = exam.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                txtPassScore.Text       = exam.PassScore.ToString();

                if (exam.IsComputerExam)
                {
                    rbnExamMode1.Checked = true;
                }
                else
                {
                    rbnExamMode2.Checked = true;
                }

                if (exam.StartMode == 1)
                {
                    rbnStartMode1.Checked = true;
                }
                else
                {
                    rbnStartMode2.Checked = true;
                }



                if (exam.MinExamTimes == 1)
                {
                    rbnSubject1.Checked = true;
                }
                else if (exam.MinExamTimes == 2)
                {
                    rbnSubject2.Checked = true;
                }
                ViewState["Subject"] = exam.MinExamTimes;

                txtMET2.Text             = exam.MaxExamTimes.ToString();
                chUD.Checked             = exam.IsUnderControl;
                chAutoScore.Checked      = exam.IsAutoScore;
                chSeeAnswer.Checked      = exam.CanSeeAnswer;
                chSeeScore.Checked       = exam.CanSeeScore;
                chPublicScore.Checked    = exam.IsPublicScore;
                txtDescription.Text      = exam.Description;
                txtMemo.Text             = exam.Memo;
                ddlIsGroup.SelectedValue = exam.IsGroupLeader.ToString();
                ddlTech.SelectedValue    = exam.TechnicianTypeID.ToString();
                hfPostID.Value           = exam.PostID;
                ViewState["PostID"]      = hfPostID.Value;

                PostBLL  postBLL   = new PostBLL();
                string[] strPostID = exam.PostID.Split(',');
                for (int i = 0; i < strPostID.Length; i++)
                {
                    if (i == 0)
                    {
                        txtPost.Text = postBLL.GetPost(Convert.ToInt32(strPostID[i])).PostName;
                    }
                    else
                    {
                        txtPost.Text = txtPost.Text + "," + postBLL.GetPost(Convert.ToInt32(strPostID[i])).PostName;
                    }
                }
                hfPostName.Value = txtPost.Text;


                lblCreatePerson.Text = exam.CreatePerson;
                lblCreateTime.Text   = exam.CreateTime.ToString("yyyy-MM-dd HH:mm");

                if (ViewState["startmode"].ToString() == "Edit")
                {
                    RandomExamResultBLL reBll = new RandomExamResultBLL();
                    IList <RailExam.Model.RandomExamResult> examResults =
                        reBll.GetRandomExamResultByExamID(exam.RandomExamId);

                    if (examResults.Count > 0)
                    {
                        ViewState["mode"] = "ReadOnly";
                    }
                }

                chkHasTrainClass.Checked   = exam.HasTrainClass;
                hfHasTrainClass.Value      = chkHasTrainClass.Checked.ToString();
                ViewState["HasTrainClass"] = chkHasTrainClass.Checked.ToString();

                SetTrainClassVisible(chkHasTrainClass.Checked);

                if (exam.ExamStyle == 1)
                {
                    rbnStyle1.Checked = true;
                }
                else
                {
                    rbnStyle2.Checked = true;
                }

                if (chkHasTrainClass.Checked)
                {
                    OracleAccess db = new OracleAccess();

                    RandomExamTrainClassHaBLL      objTrainClassBll  = new RandomExamTrainClassHaBLL();
                    IList <RandomExamTrainClassHa> objTrainClassList =
                        objTrainClassBll.GetRandomExamTrainClassByRandomExamID(exam.RandomExamId);
                    DataTable dataTable = new DataTable();
                    dataTable.Columns.Add(new DataColumn("RandomExamTrainClassID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("RandomExamID", typeof(int)));
                    dataTable.Columns.Add(new DataColumn("TrainClassID", typeof(string)));
                    dataTable.Columns.Add(new DataColumn("TrainClassName", typeof(string)));

                    string strSql = "";
                    foreach (RandomExamTrainClassHa trainClass in objTrainClassList)
                    {
                        DataRow newRow = dataTable.NewRow();

                        newRow[0] = trainClass.RandomExamTrainClassID;
                        newRow[1] = trainClass.RandomExamID;
                        newRow[2] = trainClass.ArchivesID;

                        strSql    = "select * from Train_Info where Archives_Num='" + trainClass.ArchivesID + "' and Unit_Code='" + exam.OrgId + "'";
                        newRow[3] = db.RunSqlDataSet(strSql).Tables[0].Rows[0]["Class_Name"].ToString();

                        dataTable.Rows.Add(newRow);

                        if (hfTrainClassID.Value == "")
                        {
                            hfTrainClassID.Value = trainClass.ArchivesID;
                        }
                        else
                        {
                            hfTrainClassID.Value = hfTrainClassID.Value + "," + trainClass.ArchivesID;
                        }
                    }

                    ViewState["TrainClass"] = hfTrainClassID.Value;

                    Grid1.DataSource = dataTable;
                    Grid1.DataBind();

                    //当考试为补考的时候,不能修改培训班信息
                    if (exam.IsReset)
                    {
                        chkHasTrainClass.Enabled = false;
                        Grid1.Enabled            = false;
                        btnAddTrainClass.Visible = false;
                    }
                    hfIsReset.Value = exam.IsReset.ToString();
                }
                else
                {
                    ViewState["TrainClass"] = "";
                }
            }

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                chkHasTrainClass.Enabled = false;
                txtExamName.Enabled      = false;
                dateBeginTime.Enabled    = false;
                dateEndTime.Enabled      = false;
                ddlType.Enabled          = false;
                txtExamTime.Enabled      = false;
                rbnExamMode1.Enabled     = false;
                rbnExamMode2.Enabled     = false;
                txtMET2.Enabled          = false;
                chUD.Enabled             = false;
                chAutoScore.Enabled      = false;
                chSeeAnswer.Enabled      = false;
                chSeeScore.Enabled       = false;
                chPublicScore.Enabled    = false;
                txtDescription.Enabled   = false;
                txtMemo.Enabled          = false;
                rbnStartMode1.Enabled    = false;
                rbnStartMode2.Enabled    = false;
                rbnStyle1.Enabled        = false;
                rbnStyle2.Enabled        = false;
                txtPost.Enabled          = false;
                ddlIsGroup.Enabled       = false;
                ddlTech.Enabled          = false;
                txtCategoryName.Enabled  = false;
                txtPassScore.Enabled     = false;
            }
        }