コード例 #1
0
        protected void FillPage(string strExamId)
        {
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strExamId));

            if (randomExam != null)
            {
                ViewState["Year"] = randomExam.BeginTime.Year.ToString();
                lblTitle.Text     = randomExam.ExamName;
            }

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

            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;
            }

            // 用于前台JS判断是否完成全部试题
            hfPaperItemsCount.Value = nItemCount.ToString();

            lblTitleRight.Text = "总共" + nItemCount + "题,共 " + nTotalScore + "分";
        }
コード例 #2
0
        private void DownloadStudentInfoExcel()
        {
            string path = Server.MapPath("/RailExamBao/Excel/Excel.xls");

            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id")));

            if (File.Exists(path))
            {
                FileInfo file = new FileInfo(path);
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition",
                                        "attachment; filename=" + HttpUtility.UrlEncode(objRandomExam.ExamName + "参加考试学员名单") +
                                        ".xls");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());

                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-excel";

                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["mode"]      = Request.QueryString.Get("mode");
                ViewState["startmode"] = Request.QueryString.Get("startmode");

                hfMode.Value = ViewState["mode"].ToString();

                if (ViewState["mode"].ToString() == "ReadOnly")
                {
                    btnInput.Enabled = false;
                }

                string strId = Request.QueryString.Get("id");
                if (!string.IsNullOrEmpty(strId))
                {
                    HfRandomExamid.Value = strId;
                    RandomExamBLL             randomExamBLL = new RandomExamBLL();
                    RailExam.Model.RandomExam RandomExam    = randomExamBLL.GetExam(int.Parse(strId));
                    if (RandomExam != null)
                    {
                        txtPaperName.Text = RandomExam.ExamName;
                    }


                    ItemTypeBLL      objTypeBll  = new ItemTypeBLL();
                    IList <ItemType> objTypeList = objTypeBll.GetItemTypes();
                    foreach (ItemType objType in objTypeList)
                    {
                        if (RandomExam.IsComputerExam)
                        {
                            if (objType.ItemTypeId > PrjPub.ITEMTYPE_FILLBLANKDETAIL)
                            {
                                continue;
                            }
                        }

                        ListItem item = new ListItem();
                        item.Text  = objType.TypeName;
                        item.Value = objType.ItemTypeId.ToString();
                        lbType.Items.Add(item);
                    }

                    Grid1.DataBind();
                }
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    int nID = Int32.Parse(strDeleteID);
                    RandomExamSubjectBLL RandomExamSubjectBLL = new RandomExamSubjectBLL();
                    RandomExamSubjectBLL.DeleteRandomExamSubject(nID);
                    Grid1.DataBind();
                }
            }
        }
コード例 #4
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(ViewState["ExamID"].ToString()));

            string strSql = "select * from Random_Exam_Computer_Server where Random_Exam_ID=" + ViewState["ExamID"].ToString()
                            + " and Computer_Server_No=" + PrjPub.ServerNo;
            OracleAccess db = new OracleAccess();
            DataRow      dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

            if (txtCode.Text != dr["Random_Exam_Code"].ToString())
            {
                SessionSet.PageMessage = "验证码输入有误,请重新输入!";
                txtCode.Text           = "";
                return;
            }

            //获取当前考生即将考试的试卷
            string strIP = Pub.GetRealIP();
            RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();

            RailExam.Model.RandomExamResultCurrent objResultCurrent =
                objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(ViewState["StudentID"].ToString()),
                                                               Convert.ToInt32(ViewState["ExamID"].ToString()));

            ViewState["CurrentID"] = objResultCurrent.RandomExamResultId;
            //objResultCurrentBll.UpdateRandomExamResultCurrentIP(Convert.ToInt32(ViewState["CurrentID"].ToString()), strIP);

            RandomExamApplyBLL objApplyBll = new RandomExamApplyBLL();
            RandomExamApply    objNowApply = objApplyBll.GetRandomExamApplyByExamResultCurID(objResultCurrent.RandomExamResultId);

            if (objNowApply.RandomExamApplyID == 0)
            {
                RandomExamApply objApply = new RandomExamApply();
                objApply.RandomExamResultCurID = Convert.ToInt32(ViewState["CurrentID"].ToString());
                objApply.RandomExamID          = Convert.ToInt32(ViewState["ExamID"].ToString());
                objApply.CodeFlag    = txtCode.Text == dr["Random_Exam_Code"].ToString();
                objApply.ApplyStatus = 0;
                objApply.IPAddress   = strIP;
                hfID.Value           = objApplyBll.AddRandomExamApply(objApply).ToString();
            }
            else
            {
                objNowApply.CodeFlag    = txtCode.Text == dr["Random_Exam_Code"].ToString();
                objNowApply.ApplyStatus = 0;
                objNowApply.IPAddress   = Pub.GetRealIP();
                objApplyBll.UpdateRandomExamApply(objNowApply);
                hfID.Value = objNowApply.RandomExamApplyID.ToString();
            }

            lblApply.Text    = "已提交考试请求,请等待回复......";
            btnClose.Visible = true;
            btnOK.Visible    = false;
            lblTitle.Visible = false;
            txtCode.Visible  = false;
            img.Visible      = true;
        }
コード例 #5
0
        //获取查询本站段可用机房的Sql语句
        private string GetUseSql(OracleAccess db, RailExam.Model.RandomExam exam)
        {
            //判断本站微机教室是否被其他站段占用。
            string strSql = "select a.Computer_Room_ID from Computer_Room_Apply a "
                            + " inner join Org b on a.Apply_Org_ID=b.Org_ID "
                            + " inner join Computer_Room c on a.Computer_Room_ID=c.Computer_Room_ID "
                            + " where REPLY_STATUS=1 and a.Apply_Org_ID=" + PrjPub.CurrentLoginUser.StationOrgID
                            + " and ((to_date('" + exam.BeginTime + "','YYYY-MM-DD HH24:MI:SS')>= APPLY_START_TIME"
                            + " and to_date('" + exam.BeginTime + "','YYYY-MM-DD HH24:MI:SS')<= APPLY_END_TIME)"
                            + " or (to_date('" + exam.EndTime + "','YYYY-MM-DD HH24:MI:SS')>= APPLY_START_TIME "
                            + " and to_date('" + exam.EndTime + "','YYYY-MM-DD HH24:MI:SS')<= APPLY_END_TIME)) "
                            + " and c.Is_Use=1 and c.IS_EFFECT=1";
            DataSet dsUse = db.RunSqlDataSet(strSql);

            string strUse = string.Empty;

            foreach (DataRow dr in dsUse.Tables[0].Rows)
            {
                #region 判断是否存在该微机教室正在进行的考试,如果存在需要排除
                //strSql = "select * from Random_Exam_Arrange_Detail a "
                //         + "inner join Random_Exam b on a.Random_Exam_ID=b.Random_Exam_ID "
                //         + "where a.Computer_Room_ID=" + dr["Computer_Room_ID"]
                //         + " and (b.Status_ID<=1 or b.Is_Start<=1)";

                //if (db.RunSqlDataSet(strSql).Tables[0].Rows.Count > 0)
                //{
                //    if (strUse == string.Empty)
                //    {
                //        strUse += dr["Computer_Room_ID"].ToString();
                //    }
                //    else
                //    {
                //        strUse += "," + dr["Computer_Room_ID"];
                //    }
                //}
                #endregion

                if (strUse == string.Empty)
                {
                    strUse += dr["Computer_Room_ID"].ToString();
                }
                else
                {
                    strUse += "," + dr["Computer_Room_ID"];
                }
            }

            //排除本站段被其他站段占用的微机教室
            strSql = " select Computer_Room_ID,Computer_Room_Name "
                     + " from Computer_Room c "
                     + " where  c.IS_EFFECT=1 and Org_ID=" + PrjPub.CurrentLoginUser.StationOrgID;

            //if(strUse != string.Empty)
            //{
            //    strSql += " and Computer_Room_ID not in (" + strUse + ")";
            //}

            return(strSql);
        }
コード例 #6
0
        private void BindBookTree()
        {
            string        strId  = Request.QueryString.Get("id");
            RandomExamBLL objBll = new RandomExamBLL();

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


            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            string strPostID = objRandomExam.PostID;

            string[] str    = strPostID.Split(',');
            int      orgID  = PrjPub.CurrentLoginUser.OrgID;
            int      leader = objRandomExam.IsGroupLeader;
            int      techID = objRandomExam.TechnicianTypeID;

            PostBLL   objPostBll = new PostBLL();
            Hashtable htBook     = new Hashtable();

            for (int i = 0; i < str.Length; i++)
            {
                int          postID      = Convert.ToInt32(str[i]);
                IList <Post> objPostList = objPostBll.GetPostsByParentID(postID);
                if (objPostList.Count > 0)
                {
                    continue;
                }

                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

                if (bookList.Count > 0)
                {
                    TreeViewNode tvn = null;

                    foreach (RailExam.Model.Book book in bookList)
                    {
                        if (!htBook.ContainsKey(book.bookId))
                        {
                            tvn       = new TreeViewNode();
                            tvn.ID    = book.bookId.ToString();
                            tvn.Value = book.bookId.ToString();
                            //int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                            tvn.Text    = book.bookName;
                            tvn.ToolTip = book.bookName;
                            tvn.Attributes.Add("isBook", "true");
                            tvn.ImageUrl           = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";
                            tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=1&item=no&id=" +
                                                     book.bookId;

                            tvBookChapter.Nodes.Add(tvn);

                            htBook.Add(book.bookId, book.bookName);
                        }
                    }
                }
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RandomExamBLL             objBll = new RandomExamBLL();
                RailExam.Model.RandomExam obj    = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("examID")));

                hfName.Value = obj.ExamName;
            }
        }
コード例 #8
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) + "分";
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !CallBack1.IsCallback)
            {
                string strExamId = Request.QueryString.Get("id");
                ViewState["BeginTime"] = DateTime.Now.ToString();
                ViewState["StudentID"] = Request.QueryString.Get("employeeID");

                if (strExamId != null && strExamId != "")
                {
                    RandomExamBLL             randomExamBLL = new RandomExamBLL();
                    RailExam.Model.RandomExam randomExam    = randomExamBLL.GetExam(int.Parse(strExamId));

                    #region 考前判断(屏蔽)
                    //if (randomExam.StartMode == 2 && randomExam.OrgId.ToString() != ConfigurationManager.AppSettings["StationID"].ToString() && randomExam.OrgId != 32)
                    //{
                    //    OrganizationBLL OrgBll = new OrganizationBLL();
                    //    string strOrgName = OrgBll.GetOrganization(randomExam.OrgId).ShortName;
                    //    Response.Write("<script>alert('该考试为" + strOrgName + "统一时间考试,必须在" + strOrgName + "参加!'); top.window.close();</script>");
                    //    return;
                    //}
                    ////如果当前考试为手动控制,则需判断考试是否开始
                    //if (randomExam.StartMode == 2 && randomExam.IsStart == 0)
                    //{
                    //    Response.Write("<script>alert('该考试还没有开始,请耐心等待!'); top.window.close();</script>");
                    //    return;
                    //}
                    //if (randomExam.StartMode == 2 && randomExam.IsStart == 2)
                    //{
                    //    Response.Write("<script>alert('该考试已经结束!'); top.window.close();</script>");
                    //    return;
                    //}
                    #endregion

                    HiddenFieldExamTime.Value = DateTime.Now.AddMinutes(randomExam.ExamTime).ToString();
                    HfExamTime.Value          = (randomExam.ExamTime * 60).ToString();

                    //获取当前考生最新需要做的考试试卷主表记录
                    RandomExamResultCurrentBLL             objResultCurrentBll = new RandomExamResultCurrentBLL();
                    RailExam.Model.RandomExamResultCurrent objResultCurrent    =
                        objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(ViewState["StudentID"].ToString()),
                                                                       Convert.ToInt32(strExamId));
                    //设置当前考生本次考试还剩下的考试时间
                    HfExamTime.Value = ((randomExam.ExamTime * 60) - objResultCurrent.ExamTime).ToString();
                    FillPage(strExamId);
                }
            }
        }
コード例 #10
0
        protected void btnAddEmployee_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            RandomExamBLL objBll = new RandomExamBLL();

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

            if (obj.CreatePerson != PrjPub.CurrentLoginUser.EmployeeName && PrjPub.CurrentLoginUser.RoleID != 362 && PrjPub.CurrentLoginUser.RoleID != 1)
            {
                SessionSet.PageMessage = "您没有添加考生的权限!添加考生只能由出卷人操作。";
                return;
            }

            ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"showEmployee(" + (obj.HasTrainClass ?1:0) + ")", true);
        }
コード例 #11
0
        private void GetHashTable()
        {
            string        strId  = Request.QueryString.Get("id");
            RandomExamBLL objBll = new RandomExamBLL();

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


            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            string strPostID = objRandomExam.PostID;

            string[] str    = strPostID.Split(',');
            int      orgID  = PrjPub.CurrentLoginUser.OrgID;
            int      leader = objRandomExam.IsGroupLeader;
            int      techID = objRandomExam.TechnicianTypeID;

            PostBLL   objPostBll = new PostBLL();
            Hashtable htBook     = new Hashtable();

            for (int i = 0; i < str.Length; i++)
            {
                int          postID      = Convert.ToInt32(str[i]);
                IList <Post> objPostList = objPostBll.GetPostsByParentID(postID);
                if (objPostList.Count > 0)
                {
                    continue;
                }

                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

                if (bookList.Count > 0)
                {
                    foreach (RailExam.Model.Book book in bookList)
                    {
                        if (!htBook.ContainsKey(book.bookId))
                        {
                            htBook.Add(book.bookId, book.bookName);
                        }
                    }
                }
            }
            _htBook = htBook;
        }
コード例 #12
0
        private void BindGrid()
        {
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("eid")));
            if (!objExam.IsComputerExam)
            {
                gradesGrid.Levels[0].Columns[8].Visible  = false;
                gradesGrid.Levels[0].Columns[9].Visible  = false;
                gradesGrid.Levels[0].Columns[10].Visible = true;
                gradesGrid.Levels[0].Columns[12].Visible = false;
            }
            else
            {
                gradesGrid.Levels[0].Columns[8].Visible  = true;
                gradesGrid.Levels[0].Columns[9].Visible  = true;
                gradesGrid.Levels[0].Columns[10].Visible = false;
            }
        }
コード例 #13
0
        protected void FillPage(string strExamId)
        {
            //获取考试基本信息
            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strExamId));
            if (randomExam != null)
            {
                lblTitle.Text = randomExam.ExamName;
            }

            //获取考试题数和分数
            RandomExamSubjectBLL randomExamSubjectBLL = new RandomExamSubjectBLL();
            IList <RailExam.Model.RandomExamSubject> RandomExamSubjects = randomExamSubjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strExamId));
            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;
            }

            // 用于前台JS判断是否完成全部试题
            hfPaperItemsCount.Value = nItemCount.ToString();
            lblTitleRight.Text      = "总共" + nItemCount + "题,共" + System.String.Format("{0:0.##}", nTotalScore) + "分";


            string strSql = "select a.*,b.post_name, GetOrgName(a.org_id) as org_name from Employee a "
                            + "  left join post b on a.post_id = b.post_id"
                            + " where a.Employee_ID=" + Request.QueryString.Get("employeeID");
            OracleAccess db = new OracleAccess();

            DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

            lblWorkNo.Text  = dr["Work_No"].ToString();
            lblIDCard.Text  = dr["Identity_CardNo"].ToString();
            lblSex.Text     = dr["Sex"].ToString();
            lblOrgName.Text = dr["org_name"].ToString();
            lblPost.Text    = dr["post_name"].ToString();
            lblName.Text    = dr["Employee_Name"].ToString();
        }
コード例 #14
0
        protected void Callback1_Callback(object sender, CallBackEventArgs e)
        {
            try
            {
                string strId = ViewState["ExamID"].ToString();
                RandomExamResultCurrentBLL             objResultCurrentBll = new RandomExamResultCurrentBLL();
                RailExam.Model.RandomExamResultCurrent objResultCurrent    =
                    objResultCurrentBll.GetRandomExamResult(Convert.ToInt32(ViewState["RandomExamResultID"].ToString()));

                if (objResultCurrent.RandomExamId == 0)
                {
                    hfStart.Value = "2";
                }
                else
                {
                    objResultCurrent.ExamTime = Convert.ToInt32(ViewState["LastExamTime"].ToString()) + GetSecondBetweenTwoDate(DateTime.Now, DateTime.Parse(ViewState["BeginTime"].ToString()));
                    objResultCurrentBll.UpdateRandomExamResultCurrent(objResultCurrent);

                    RandomExamBLL             objBll        = new RandomExamBLL();
                    RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId));
                    hfStart.Value = objRandomExam.IsStart.ToString();
                }

                if (hfStart.Value == "2")
                {
                    RandomExamResultBLL objResultBll = new RandomExamResultBLL();
                    RandomExamResult    objResult    =
                        objResultBll.GetNewRandomExamResultByExamineeID(Convert.ToInt32(ViewState["EmployeeID"].ToString()),
                                                                        Convert.ToInt32(strId));

                    hfResultID.Value = objResult.RandomExamResultId.ToString();
                }
            }
            catch
            {
                hfStart.Value = "-1";
            }

            hfResultID.RenderControl(e.Output);
            hfStart.RenderControl(e.Output);
        }
コード例 #15
0
        protected void btnEnd_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "缺少参数!";
                return;
            }
            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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


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

            if (server.IsStart == 0)
            {
                if (objExam.EndTime >= DateTime.Today)
                {
                    SessionSet.PageMessage = "当前考试还未开始考试!";
                    return;
                }
            }
            else if (server.IsStart == 2)
            {
                SessionSet.PageMessage = "当前考试已经结束!";
                return;
            }

            ClientScript.RegisterStartupScript(GetType(),
                                               "jsSelectFirstNode",
                                               @"EndPaper();",
                                               true);
        }
コード例 #16
0
        private void DownloadAll(string strType)
        {
            RandomExamBLL objBll = new RandomExamBLL();
            string        strId  = Request.QueryString.Get("eid");

            RailExam.Model.RandomExam obj = objBll.GetExam(int.Parse(strId));
            string filename = "";

            filename = Server.MapPath("/RailExamBao/Excel/" + strType + "/");

            string ZipName = Server.MapPath("/RailExamBao/Excel/Word.zip");

            GzipCompress(filename, ZipName);

            FileInfo file = new FileInfo(ZipName.ToString());

            this.Response.Clear();
            this.Response.Buffer          = true;
            this.Response.Charset         = "utf-7";
            this.Response.ContentEncoding = Encoding.UTF7;
            // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
            if (strType.IndexOf("合格") >= 0)
            {
                this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(obj.ExamName + "合格试卷") + ".zip");
            }
            else
            {
                this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(obj.ExamName) + ".zip");
            }
            // 添加头信息,指定文件大小,让浏览器能够显示下载进度
            this.Response.AddHeader("Content-Length", file.Length.ToString());
            // 指定返回的是一个不能被客户端读取的流,必须被下载
            this.Response.ContentType = "application/ms-word";
            // 把文件流发送到客户端
            this.Response.WriteFile(file.FullName);
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange != 1)
                //{
                //    HfUpdateRight.Value = "False";
                //    HfDeleteRight.Value = "False";
                //}
                //else
                //{
                //    HfUpdateRight.Value = PrjPub.HasEditRight("新增考试").ToString();
                //    HfDeleteRight.Value = PrjPub.HasDeleteRight("新增考试").ToString();
                //}

                hfRailSystemID.Value = PrjPub.GetRailSystemId().ToString();

                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                if (PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.UseType == 0)
                {
                    hfIsAdmin.Value = "True";
                }
                else
                {
                    hfIsAdmin.Value = "False";
                }

                if (PrjPub.HasEditRight("新增考试") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("新增考试") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                ListItem item = new ListItem();
                item.Value = Session["StationOrgID"].ToString();
                item.Text  = "--请选择--";
                ddlOrg.Items.Add(item);

                if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.UseType == 0 && PrjPub.CurrentLoginUser.IsAdmin)
                {
                    ddlOrg.Visible = true;
                    lblOrg.Visible = true;

                    OrganizationBLL      objOrgBll = new OrganizationBLL();
                    IList <Organization> objList   = objOrgBll.GetOrganizationsByLevel(2);
                    foreach (Organization organization in objList)
                    {
                        ListItem litem = new ListItem();
                        litem.Value = organization.OrganizationId.ToString();
                        litem.Text  = organization.ShortName;
                        ddlOrg.Items.Add(litem);
                    }
                }
                else
                {
                    ddlOrg.Visible = false;
                    lblOrg.Visible = false;
                }

                hfOrgID.Value          = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                HfExamCategoryId.Value = Request.QueryString.Get("id");
                Grid1.DataBind();
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    //RandomExamResultBLL reBll = new RandomExamResultBLL();
                    //IList<RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strDeleteID));

                    //if (examResults.Count > 0)
                    //{
                    //    SessionSet.PageMessage = "已有考生参加考试,该考试不能被删除!";
                    //    Grid1.DataBind();
                    //    return;
                    //}


                    DeleteData(int.Parse(strDeleteID));
                    Grid1.DataBind();
                }

                if (Request.Form.Get("Refresh") == "true")
                {
                    Grid1.DataBind();
                }

                if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != string.Empty)
                {
                    OutputWord(Request.Form.Get("OutPut"));
                }

                if (Request.Form.Get("ResetID") != null && Request.Form.Get("ResetID") != string.Empty)
                {
                    Grid1.DataBind();
                }

                if (Request.Form.Get("arrangeID") != null && Request.Form.Get("arrangeID") != string.Empty)
                {
                    string                    strId   = Request.Form.Get("arrangeID");
                    RandomExamBLL             objBll  = new RandomExamBLL();
                    RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(strId));

                    //if(objExam.HasPaper)
                    //{
                    //    SessionSet.PageMessage = "该考试已经生成试卷,不能重新安排微机教室!";
                    //    Grid1.DataBind();
                    //    return;
                    //}

                    if (!PrjPub.IsServerCenter)
                    {
                        Grid1.DataBind();
                        return;
                    }

                    if (PrjPub.CurrentLoginUser.RoleID != 1)
                    {
                        OracleAccess              db          = new OracleAccess();
                        RandomExamArrangeBLL      arrangeBll  = new RandomExamArrangeBLL();
                        IList <RandomExamArrange> arrangeList = arrangeBll.GetRandomExamArranges(Convert.ToInt32(strId));

                        if (arrangeList.Count == 0)
                        {
                            SessionSet.PageMessage = "该考试还未选择考生,不能安排微机教室!";
                            Grid1.DataBind();
                            return;
                        }

                        RandomExamArrange arrange = arrangeList[0];

                        bool            hasOrg      = false;
                        string[]        str         = arrange.UserIds.Split(',');
                        EmployeeBLL     employeebll = new EmployeeBLL();
                        OrganizationBLL orgBll      = new OrganizationBLL();
                        for (int i = 0; i < str.Length; i++)
                        {
                            Employee obj = employeebll.GetEmployee(Convert.ToInt32(str[i]));

                            if (orgBll.GetStationOrgID(obj.OrgID) == PrjPub.CurrentLoginUser.StationOrgID)
                            {
                                hasOrg = true;
                                break;
                            }
                        }

                        if (!hasOrg)
                        {
                            SessionSet.PageMessage = "该考试没有本站段考生,无须安排微机教室!";
                            Grid1.DataBind();
                            return;
                        }
                    }

                    Grid1.DataBind();
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"showArrange(" + strId + ");",
                                                       true);
                }
            }
        }
コード例 #18
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id")));

            SpreadsheetClass xlsheet = new SpreadsheetClass();
            Worksheet        ws      = (Worksheet)xlsheet.Worksheets[1];

            ws.Cells.Font.set_Size(10);
            ws.Cells.Font.set_Name("宋体");

            ws.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单";
            Range rang1 = ws.get_Range(ws.Cells[1, 1], ws.Cells[1, 7]);

            rang1.set_MergeCells(true);
            rang1.set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            rang1.Font.set_Name("宋体");


            //write headertext
            ws.Cells[2, 1] = "序号";
            ((Range)ws.Cells[2, 1]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);


            ws.Cells[2, 2] = "姓名";
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            if (PrjPub.IsWuhan())
            {
                ws.Cells[2, 3] = "员工编码";
            }
            else
            {
                ws.Cells[2, 3] = "工资编号";
            }
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 4] = "职名";
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 5] = "组织机构";
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 8] = "考试地点";
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            for (int j = 0; j < gvChoose.Rows.Count; j++)
            {
                ws.Cells[3 + j, 1] = ((Label)gvChoose.Rows[j].FindControl("lblNo")).Text;

                ws.Cells[3 + j, 2] = ((Label)gvChoose.Rows[j].FindControl("LabelName")).Text;
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 3] = "'" + ((Label)gvChoose.Rows[j].FindControl("LabelWorkNo")).Text;
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);


                ws.Cells[3 + j, 4] = ((Label)gvChoose.Rows[j].FindControl("LabelPostName")).Text;
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 5] = ((Label)gvChoose.Rows[j].FindControl("Labelorgid")).Text;
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

                ws.Cells[3 + j, 8] = ((Label)gvChoose.Rows[j].FindControl("lblComputeRoom")).Text;
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            }

            ws.Name = "1-1";
            ws.Cells.Columns.AutoFit();

            try
            {
                ((Worksheet)xlsheet.Worksheets[1]).Activate();

                string path = Server.MapPath("../Excel/Excel.xls");
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                xlsheet.Export(path, SheetExportActionEnum.ssExportActionNone, SheetExportFormat.ssExportAsAppropriate);

                FileInfo file = new FileInfo(path);
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition",
                                        "attachment; filename=" + HttpUtility.UrlEncode(objRandomExam.ExamName + "参加考试学员名单") + ".xls");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());

                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-excel";

                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
            catch
            {
                SessionSet.PageMessage = "系统错误,导出Excel文件失败!";
            }
        }
コード例 #19
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                string                    examId        = Request.QueryString.Get("examID");
                RandomExamBLL             objBll        = new RandomExamBLL();
                RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(examId));
                if (objRandomExam.IsStart != 2)
                {
                    SessionSet.PageMessage = "考试还未结束不能生成补考试卷!";
                    return;
                }

                //OrganizationBLL OrgBll = new OrganizationBLL();
                //Organization org = OrgBll.GetOrganization(objRandomExam.OrgId);
                //if (org.SuitRange != 1 && !objRandomExam.IsUpload)
                //{
                //    Grid1.DataBind();
                //    SessionSet.PageMessage = "考试为站段考试,还未上传考试成绩不能生成补考试卷!";
                //    return;
                //}

                if (objRandomExam.HasTrainClass)
                {
                    string strTrainClassID = "";
                    RandomExamTrainClassBLL      trainClassBLL = new RandomExamTrainClassBLL();
                    IList <RandomExamTrainClass> trainClasses  =
                        trainClassBLL.GetRandomExamTrainClassByRandomExamID(Convert.ToInt32(examId));
                    foreach (RandomExamTrainClass trainClass in trainClasses)
                    {
                        if (strTrainClassID == "")
                        {
                            strTrainClassID = "'" + trainClass.TrainClassID + "'";
                        }
                        else
                        {
                            strTrainClassID = strTrainClassID + ",'" + trainClass.TrainClassID + "'";
                        }
                    }
                }

                string  OrganizationName = "";
                string  strExamineeName  = "";
                decimal dScoreLower      = 0;
                decimal dScoreUpper      = 1000;

                IList <RandomExamResult> examResults   = null;
                RandomExamResultBLL      bllExamResult = new RandomExamResultBLL();

                examResults = bllExamResult.GetRandomExamResults(objRandomExam.RandomExamId, OrganizationName, "", strExamineeName, string.Empty, dScoreLower,
                                                                 dScoreUpper, objRandomExam.OrgId);


                string strID     = string.Empty;
                string strNoPass = string.Empty;
                foreach (RandomExamResult result in examResults)
                {
                    if (strID == string.Empty)
                    {
                        strID = result.ExamineeId.ToString();
                    }
                    else
                    {
                        strID = strID + "," + result.ExamineeId;
                    }

                    //当补考考生不为未参加考试考生时
                    if (ddlSelect.SelectedValue != "2")
                    {
                        if (result.Score < objRandomExam.PassScore)
                        {
                            if (strNoPass == string.Empty)
                            {
                                strNoPass = result.ExamineeId.ToString();
                            }
                            else
                            {
                                strNoPass = strNoPass + "," + result.ExamineeId;
                            }
                        }
                    }
                }

                RandomExamArrangeBLL      objArrangebll  = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objArrangeList =
                    objArrangebll.GetRandomExamArranges(objRandomExam.RandomExamId);
                string strChooseID = string.Empty;
                if (objArrangeList.Count > 0)
                {
                    strChooseID = objArrangeList[0].UserIds;
                }
                string[] str = strChooseID.Split(',');

                string strNoResult = string.Empty;
                //当补考考生不为不及格考生时
                if (ddlSelect.SelectedValue != "1")
                {
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (("," + strID + ",").IndexOf(("," + str[i] + ",")) < 0)
                        {
                            if (strNoResult == string.Empty)
                            {
                                strNoResult = str[i];
                            }
                            else
                            {
                                strNoResult = strNoResult + "," + str[i];
                            }
                        }
                    }
                }

                string strTotal = string.Empty;
                if (strNoResult == string.Empty && strNoPass == string.Empty)
                {
                    strTotal = string.Empty;
                }
                else if (strNoResult == string.Empty && strNoPass != string.Empty)
                {
                    strTotal = strNoPass;
                }
                else if (strNoResult != string.Empty && strNoPass == string.Empty)
                {
                    strTotal = strNoResult;
                }
                else if (strNoResult != string.Empty && strNoPass != string.Empty)
                {
                    strTotal = strNoPass + "," + strNoResult;
                }

                if (strTotal == string.Empty)
                {
                    SessionSet.PageMessage = "所选考试无考试不及格和未参加考试学员,不需生成补考考试!";
                    return;
                }

                int nowExamID = objBll.AddResetRandomExam(objRandomExam.RandomExamId);

                if (nowExamID == 0)
                {
                    SessionSet.PageMessage = "复制失败!";
                    return;
                }

                RandomExamArrange objArrange = new RandomExamArrange();
                objArrange.RandomExamId = nowExamID;
                objArrange.UserIds      = strTotal;
                objArrange.Memo         = string.Empty;
                int newArrangeId = objArrangebll.AddRandomExamArrange(objArrange);

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

                str = strTotal.Split(',');

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string strArrange = string.Empty;
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (("," + dr["User_Ids"] + ",").IndexOf("," + str[i] + ",") >= 0)
                        {
                            if (strArrange == string.Empty)
                            {
                                strArrange = str[i];
                            }
                            else
                            {
                                strArrange += "," + str[i];
                            }
                        }
                    }

                    if (strArrange != string.Empty)
                    {
                        XmlDocument doc = new XmlDocument();
                        //Request.PhysicalApplicationPath取得config文件路径
                        doc.Load(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "web.config"));
                        XmlNode node  = doc.SelectSingleNode("configuration/dataConfiguration/@defaultDatabase");
                        string  value = node.Value;
                        int     id    = 0;
                        if (value == "Oracle")
                        {
                            OracleParameter para1 = new OracleParameter("p_User_Ids", OracleType.Clob);
                            OracleParameter para2 = new OracleParameter("p_random_exam_arrange_de_id", OracleType.Number);
                            para2.Direction = ParameterDirection.Output;
                            OracleParameter para3 = new OracleParameter("p_random_exam_arrange_Id", OracleType.Number);
                            para3.Value = newArrangeId;
                            OracleParameter para4 = new OracleParameter("p_random_Exam_ID", OracleType.Number);
                            para4.Value = nowExamID;
                            OracleParameter para5 = new OracleParameter("p_computer_room_id", OracleType.Number);
                            para5.Value = Convert.ToInt32(dr["Computer_Room_ID"].ToString());


                            IDataParameter[] paras = new IDataParameter[] { para1, para2, para3, para4, para5 };
                            id =
                                Pub.RunAddProcedure(false, "USP_RANDOM_EXAM_ARRANGE_DE_I", paras,
                                                    System.Text.Encoding.Unicode.GetBytes(strArrange));
                        }
                    }
                }

                //向Random_Exam_Computer_Server 机房考试状态表 插入记录
                strSql = "select c.Computer_Server_No 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 a.Random_Exam_ID=" + nowExamID;
                DataSet dsComputer = db.RunSqlDataSet(strSql);

                string serverNo = "";
                foreach (DataRow dr in dsComputer.Tables[0].Rows)
                {
                    if (serverNo != dr["Computer_Server_No"].ToString())
                    {
                        serverNo = dr["Computer_Server_No"].ToString();
                        strSql   = "insert into Random_Exam_Computer_Server"
                                   + "(Random_Exam_ID,Computer_Server_No,Status_ID,Is_Start,Has_Paper,"
                                   + "Random_Exam_Code,Is_Upload,DownLoaded) "
                                   + "values (" + nowExamID + "," + serverNo + ",0,0,0,'',0,0)";
                        db.ExecuteNonQuery(strSql);
                    }
                }

                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
            catch
            {
                SessionSet.PageMessage = "复制失败!";
            }
        }
コード例 #20
0
        protected void btnInput_Click(object sender, EventArgs e)
        {
            if (ViewState["EmptyFlag"].ToString() != null && ViewState["EmptyFlag"].ToString() == "1")
            {
                return;
            }

            string strId    = Request.QueryString.Get("id");
            string strAllId = hfrbnID.Value;
            IList <RailExam.Model.Employee> Employees = null;
            EmployeeBLL psBLL = new EmployeeBLL();

            Employees = psBLL.GetEmployeesSelect(Convert.ToInt32(ddlOrg.SelectedValue), ViewState["PinYin"].ToString(), ViewState["WorkNo"].ToString(), ViewState["EmployeeName"].ToString(), "a.employee_Name");

            for (int i = 0; i < Employees.Count; i++)
            {
                string strEmId     = Employees[i].EmployeeID.ToString();
                string strOldAllId = strAllId;
                if (strOldAllId == strEmId)
                {
                    strAllId = strEmId;
                }
            }

            ViewState["ChooseId"] = strAllId;

            if (strAllId == "")
            {
                SessionSet.PageMessage = "请选择考生!";
                return;
            }
            else
            {
                RandomExamBLL             objBll = new RandomExamBLL();
                RailExam.Model.RandomExam random = objBll.GetExam(int.Parse(strId));

                if (random.RandomExamModularTypeID > 1)
                {
                    OracleAccess db     = new OracleAccess();
                    string       strSql = "select * from Random_Exam_Modular_Type where Random_Exam_Modular_Type_ID=" +
                                          random.RandomExamModularTypeID;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    strSql = "select * from Random_Exam_Modular_Type where Level_Num=" +
                             (Convert.ToInt32(dr["Level_NUM"]) - 1);
                    DataRow drPre = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    strSql = " select a.* "
                             + "from Random_Exam_Result a "
                             + " inner join Random_Exam b on a.Random_Exam_ID=b.Random_Exam_ID "
                             +
                             " left join Random_Exam_Modular_Type c on b.Random_Exam_Modular_Type_ID=c.Random_Exam_Modular_Type_ID "
                             + " where c.Level_Num=" + (Convert.ToInt32(dr["Level_NUM"]) - 1);
                    DataSet ds = db.RunSqlDataSet(strSql);

                    strSql = "select * from Employee where Employee_ID = " + strAllId;
                    DataRow drEmp = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    string strErrorMessage = string.Empty;

                    DataRow[] drs = ds.Tables[0].Select("EXAMINEE_ID=" + strAllId);

                    if (drs.Length == 0)
                    {
                        strErrorMessage = "所选考生【" + drEmp["Employee_Name"] + "】未能通过【" +
                                          drPre["Random_Exam_Modular_Type_Name"] + "】考试,不能参加【" +
                                          dr["Random_Exam_Modular_Type_Name"] + "】考试!";
                    }


                    if (!string.IsNullOrEmpty(strErrorMessage))
                    {
                        SessionSet.PageMessage = strErrorMessage;
                        return;
                    }
                }
            }

            if (ViewState["UpdateMode"] != null && ViewState["UpdateMode"].ToString() == "0")
            {
                RandomExamArrangeBLL      examArrangeBLL = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objList        = examArrangeBLL.GetRandomExamArranges(int.Parse(strId));

                if (objList.Count == 0)
                {
                    RandomExamArrange examArrange = new RandomExamArrange();
                    examArrange.RandomExamId = int.Parse(strId);
                    examArrange.UserIds      = strAllId;
                    examArrange.Memo         = "";
                    examArrangeBLL.AddRandomExamArrange(examArrange);
                    ViewState["UpdateMode"] = 1;
                    if (txtWorkNo.Text != "")
                    {
                        txtWorkNo.Text = "";
                        txtWorkNo.Focus();
                    }
                    if (txtPinYin.Text != "")
                    {
                        txtPinYin.Text = "";
                        txtPinYin.Focus();
                    }
                    if (txtEmployeeName.Text != "")
                    {
                        txtEmployeeName.Text = "";
                        txtEmployeeName.Focus();
                    }
                    BindEmptyGrid1();
                    SessionSet.PageMessage = "添加成功!";
                    return;
                }
                else
                {
                    ViewState["UpdateMode"] = "1";
                }
            }

            if (ViewState["UpdateMode"] != null && ViewState["UpdateMode"].ToString() == "1")
            {
                RandomExamArrangeBLL examArrangeBLL = new RandomExamArrangeBLL();
                string strEndId = examArrangeBLL.GetRandomExamArranges(int.Parse(strId))[0].UserIds;

                if (("," + strEndId + ",").IndexOf("," + strAllId + ",") >= 0)
                {
                    SessionSet.PageMessage = "该学员已添加!";
                    return;
                }

                if (strEndId == "")
                {
                    examArrangeBLL.UpdateRandomExamArrange(int.Parse(strId), strAllId);
                }
                else
                {
                    examArrangeBLL.UpdateRandomExamArrange(int.Parse(strId), strEndId + "," + strAllId);
                }

                if (txtWorkNo.Text != "")
                {
                    txtWorkNo.Text = "";
                    txtWorkNo.Focus();
                }
                if (txtPinYin.Text != "")
                {
                    txtPinYin.Text = "";
                    txtPinYin.Focus();
                }
                if (txtEmployeeName.Text != "")
                {
                    txtEmployeeName.Text = "";
                    txtEmployeeName.Focus();
                }
                BindEmptyGrid1();
                SessionSet.PageMessage = "添加成功!";

                ClientScript.RegisterClientScriptBlock(GetType(), "", " window.opener.form1.Refresh.value = 'true',window.opener.form1.submit();", true);
                return;
            }
        }
コード例 #21
0
        protected void FillHeading(string strId, string orgid)
        {
            RandomExamResultBLL randomExamResultBLL = new RandomExamResultBLL();
            RandomExamResult    randomExamResult    = new RandomExamResult();

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

            OracleAccess db     = new OracleAccess();
            string       strSql = "select a.*"
                                  + " from Random_Exam_Result_Detail a"
                                  + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId
                                  + " and Employee_ID=" + randomExamResult.ExamineeId
                                  + " and Random_Exam_ID=" + randomExamResult.RandomExamId;

            DataTable dtExam = db.RunSqlDataSet(strSql).Tables[0];

            if (dtExam.Rows.Count == 0)
            {
                strSql = "select a.*"
                         + " from Random_Exam_Result_Detail_Temp a"
                         + " where a.Random_Exam_Result_ID=" + randomExamResult.RandomExamResultId
                         + " and Employee_ID=" + randomExamResult.ExamineeId
                         + " and Random_Exam_ID=" + randomExamResult.RandomExamId;

                dtExam = db.RunSqlDataSet(strSql).Tables[0];
            }

            if (dtExam.Rows.Count > 0)
            {
                bool isExists =
                    Directory.Exists(Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/"));

                DataRow drExam = dtExam.Rows[0];
                lblFignerDate.Text = drExam["FingerPrint_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["FingerPrint_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate1.Text = drExam["Photo1_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo1_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate2.Text = drExam["Photo2_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo2_Date"]).ToString("yyyy-MM-dd HH:mm");
                lblPhotoDate3.Text = drExam["Photo3_Date"] == DBNull.Value
                                         ? string.Empty
                                         : Convert.ToDateTime(drExam["Photo3_Date"]).ToString("yyyy-MM-dd HH:mm");

                string filepath = Server.MapPath("/RailExamBao/Online/Photo/" + randomExamResult.RandomExamId + "/") + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_";
                string path     = "../Online/Photo/" + randomExamResult.RandomExamId + "/" + randomExamResult.ExamineeId + "_" + randomExamResult.RandomExamResultId + "_";

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "00.jpg"))
                    {
                        fignerImage.ImageUrl = path + "00.jpg";
                    }
                    else
                    {
                        fignerImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["FingerPrint"] != DBNull.Value)
                    {
                        fignerImage.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=0";
                    }
                    else
                    {
                        fignerImage.ImageUrl = "../images/empty.jpg";
                    }
                }

                DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                    {
                        picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId;
                    }
                    else
                    {
                        picImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    picImage.ImageUrl = "../images/empty.jpg";
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "01.jpg"))
                    {
                        photoImage1.ImageUrl = path + "01.jpg";
                    }
                    else
                    {
                        photoImage1.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo1"] != DBNull.Value)
                    {
                        photoImage1.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=1";
                    }
                    else
                    {
                        photoImage1.ImageUrl = "../images/empty.jpg";
                    }
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "02.jpg"))
                    {
                        photoImage2.ImageUrl = path + "02.jpg";
                    }
                    else
                    {
                        photoImage2.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo2"] != DBNull.Value)
                    {
                        photoImage2.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=2";
                    }
                    else
                    {
                        photoImage2.ImageUrl = "../images/empty.jpg";
                    }
                }

                if (PrjPub.IsServerCenter && isExists)
                {
                    if (File.Exists(filepath + "03.jpg"))
                    {
                        photoImage3.ImageUrl = path + "03.jpg";
                    }
                    else
                    {
                        photoImage3.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    if (drExam["Photo3"] != DBNull.Value)
                    {
                        photoImage3.ImageUrl = "ShowResultImage.aspx?resultDetailID=" +
                                               drExam["Random_Exam_Result_Detail_ID"] + "&typeID=3";
                    }
                    else
                    {
                        photoImage3.ImageUrl = "../images/empty.jpg";
                    }
                }
            }
            else
            {
                fignerImage.ImageUrl = "../images/empty.jpg";
                DataSet ds = Pub.GetPhotoDateSet(randomExamResult.ExamineeId.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0] != DBNull.Value)
                    {
                        picImage.ImageUrl = "../RandomExamTai/ShowImage.aspx?EmployeeID=" + randomExamResult.ExamineeId;
                    }
                    else
                    {
                        picImage.ImageUrl = "../images/empty.jpg";
                    }
                }
                else
                {
                    picImage.ImageUrl = "../images/empty.jpg";
                }
                photoImage1.ImageUrl = "../images/empty.jpg";
                photoImage2.ImageUrl = "../images/empty.jpg";
                photoImage3.ImageUrl = "../images/empty.jpg";
            }

            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) + "分";
        }
コード例 #22
0
        public void FillPaper()
        {
            string strId = Request.QueryString.Get("id");

            RandomExamBLL randomExamBLL = new RandomExamBLL();

            RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strId));
            ViewState["Year"] = randomExam.BeginTime.Year.ToString();

            RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();

            RailExam.Model.RandomExamResultCurrent randomExamResult = objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(Request.QueryString.Get("employeeID")), Convert.ToInt32(strId));

            int RandomExamId       = Convert.ToInt32(strId);
            int randomExamResultId = randomExamResult.RandomExamResultId;

            RandomExamItemBLL         randomItemBLL      = new RandomExamItemBLL();
            RandomExamSubjectBLL      subjectBLL         = new RandomExamSubjectBLL();
            IList <RandomExamSubject> randomExamSubjects = subjectBLL.GetRandomExamSubjectByRandomExamId(RandomExamId);

            RandomExamResultAnswerCurrentBLL      randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            IList <RandomExamResultAnswerCurrent> examResultAnswers         = new List <RandomExamResultAnswerCurrent>();

            examResultAnswers = randomExamResultAnswerBLL.GetExamResultAnswersCurrent(randomExamResultId);

            OracleAccess db = new OracleAccess();

            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, Convert.ToInt32(ViewState["Year"].ToString()));

                    Response.Write("<br>");
                    Response.Write("<span class='StudentLeftInfo'><b> 第" + GetNo(i) + "大题:" + paperSubject.SubjectName + "</b></span>");
                    Response.Write("<br>");

                    if (PaperItems != null)
                    {
                        Response.Write("<table width='100%'  border='1'>");
                        int z     = 1;
                        int tempK = 0;
                        int count = 1;
                        for (int j = 0; j < PaperItems.Count; j++)
                        {
                            RandomExamItem paperItem = PaperItems[j];
                            int            k         = j + 1;


                            if (paperItem.TypeId != PrjPub.ITEMTYPE_FILLBLANKDETAIL && paperItem.TypeId != PrjPub.ITEMTYPE_FILLBLANK)
                            {
                                z = 1;

                                if (k % 5 == 1)
                                {
                                    Response.Write("</tr >");
                                    Response.Write("<tr><td class='StudentTableInfo' id='Item" + i + j + "' >"
                                                   + "<a href='AttendExamNew.aspx?id=" + strId + "&employeeID=" + Request.QueryString.Get("employeeID")
                                                   + "#Test" + i + j + "' target='ifExamInfo' style='cursor: hand;'><b>" + k + "</b></a></td>");
                                }
                                else
                                {
                                    Response.Write("<td class='StudentTableInfo' id='Item" + i + j + "' >"
                                                   + "<a href='AttendExamNew.aspx?id=" + strId + "&employeeID=" + Request.QueryString.Get("employeeID")
                                                   + "#Test" + i + j + "' target='ifExamInfo' style='cursor: hand;'><b>" + k + "</b></a></td>");
                                }
                            }
                            else
                            {
                                if (paperItem.TypeId == PrjPub.ITEMTYPE_FILLBLANK)
                                {
                                    z = 1;
                                    tempK++;
                                }

                                if (count % 3 == 1)
                                {
                                    Response.Write("</tr >");
                                    Response.Write("<tr><td class='StudentTableInfo' id='Item" + i + j + "' >"
                                                   + "<a href='AttendExamNew.aspx?id=" + strId + "&employeeID=" + Request.QueryString.Get("employeeID")
                                                   + "#Test" + i + j + "' target='ifExamInfo' style='cursor: hand;'><b>" + tempK + "-(" + z + ")</b></a></td>");
                                }
                                else
                                {
                                    Response.Write("<td class='StudentTableInfo' id='Item" + i + j + "' >"
                                                   + "<a href='AttendExamNew.aspx?id=" + strId + "&employeeID=" + Request.QueryString.Get("employeeID")
                                                   + "#Test" + i + j + "' target='ifExamInfo' style='cursor: hand;'><b>" + tempK + "-(" + z + ")</b></a></td>");
                                }

                                z++;
                                count++;
                            }
                        }

                        Response.Write("</tr >");
                        Response.Write("</table>");
                    }
                }

                //ClientScript.RegisterStartupScript(GetType(), "StartStyle", "<script>StartStyle()</script>");
            }
            else
            {
                SessionSet.PageMessage = "未找到记录!";
            }
        }
コード例 #23
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>");
        }
コード例 #24
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>");
        }
コード例 #25
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>");
        }
コード例 #26
0
        private void updateExam()
        {
            // 根据 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;

            try
            {
                string                    strId   = Request.QueryString.Get("RandomExamID");
                RandomExamBLL             examBll = new RandomExamBLL();
                RailExam.Model.RandomExam exam    = examBll.GetExam(Convert.ToInt32(strId));

                IList <RandomExamResult> examResults   = null;
                RandomExamResultBLL      bllExamResult = new RandomExamResultBLL();
                examResults = bllExamResult.GetRandomExamResults(int.Parse(strId), "", "", "", "", 0, 1000, Convert.ToInt32(Request.QueryString.Get("OrgID")));
                string strChooseID = string.Empty;
                foreach (RandomExamResult randomExamResult in examResults)
                {
                    if (string.IsNullOrEmpty(strChooseID))
                    {
                        strChooseID += randomExamResult.ExamineeId;
                    }
                    else
                    {
                        strChooseID += "," + randomExamResult.ExamineeId;
                    }
                }

                OracleAccess access = new OracleAccess();
                string       strSql =
                    @"select ER.Begin_Time,E.Is_Computerexam,ER.Examinee_ID,
                        case when z.computer_room_seat=0 then GetOrgName(ER.org_ID)||CR.Computer_Room_Name||'微机教室'
                        else GetOrgName(ER.org_ID)||CR.Computer_Room_Name||'微机教室-'||z.computer_room_seat||'机位' end Computer_Room_Name, 
                        case when y.subject_name is not null then y.subject_name else
                        case when  MT.RANDOM_EXAM_MODULAR_TYPE_NAME is not null then (MT.RANDOM_EXAM_MODULAR_TYPE_NAME||'-'|| E.EXAM_NAME) 
                        else E.EXAM_NAME end  end as subject, 
                        ER.Score,ER.Is_Pass,E.RANDOM_EXAM_ID 
                        from random_exam_result ER 
                        inner join random_exam_result_detail z on ER.Random_Exam_Result_Id=z.Random_Exam_Result_Id and z.is_remove=1
                        left join random_exam E on E.RANDOM_EXAM_ID=ER.RANDOM_EXAM_ID 
                        left join random_exam_train_class x on E.Random_Exam_ID=x.Random_Exam_ID
                        left join Zj_Train_Class_Subject y on x.train_class_subject_id=y.train_class_subject_id
                        left join computer_room CR on CR.COMPUTER_ROOM_ID=z.Computer_Room_Id 
                        left join random_exam_modular_type MT on MT.RANDOM_EXAM_MODULAR_TYPE_ID=E.Random_Exam_Modular_Type_Id
                        Inner join (
                        select b.*,min(a.end_time) end_time from Random_Exam_Result a
                        inner join
                       (select distinct  max(a.score) score, a.examinee_id, a.Random_Exam_Id
                        from Random_EXAM_RESULT a where  a.status_id > 0.
                        group by a.examinee_id, a.Random_Exam_Id) b on a.examinee_id =b.examinee_id
                        and a.score =b.score and a.Random_Exam_Id = b.Random_Exam_Id
                        group by  b.examinee_id, b.Random_Exam_Id,b.score ) F on ER.examinee_id = f.examinee_id
                        and ER.score = f.score  and ER.Random_Exam_Id = f.Random_Exam_Id
                        and ER.end_time=f.end_time 
                        where ER.Random_Exam_ID=" + strId;



                DataTable dtSel = access.RunSqlDataSet(strSql).Tables[0];
                if (dtSel != null && dtSel.Rows.Count > 0)
                {
                    int i = 1;
                    foreach (DataRow r in dtSel.Rows)
                    {
                        if (("," + strChooseID + ",").IndexOf("," + r["Examinee_ID"] + ",") < 0)
                        {
                            System.Threading.Thread.Sleep(10);
                            jsBlock = "<script>SetPorgressBar('更新考生考试档案','" + ((i * 100) / ((double)dtSel.Rows.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            i++;
                            continue;
                        }
                        access.ExecuteNonQuery(" delete from zj_employee_exam where Random_Exam_ID=" + strId +
                                               " and  employee_id=" + r["Examinee_ID"]);

                        string exam_date      = r["Begin_Time"].ToString();
                        int    exam_style     = Convert.ToInt32(r["Is_Computerexam"]);
                        string exam_address   = r["Computer_Room_Name"].ToString();
                        string exam_subject   = r["subject"].ToString();
                        double exam_score     = Convert.ToDouble(r["Score"]);
                        int    exam_result    = Convert.ToInt32(r["Is_Pass"]);
                        int    random_exam_id = Convert.ToInt32(r["RANDOM_EXAM_ID"]);

                        StringBuilder sqlInsert = new StringBuilder();
                        sqlInsert.Append(
                            "insert into zj_employee_exam(employee_exam_id,employee_id,exam_date,exam_style,exam_address,");
                        sqlInsert.Append("exam_subject,exam_score ,exam_result,create_date,create_person,random_exam_id");
                        sqlInsert.Append(")  values(employee_exam_seq.nextval,{0},to_date('{1}','yyyy-mm-dd hh24:mi:ss'),{2},");
                        sqlInsert.Append(" '{3}','{4}','{5}',{6},to_date('{7}','yyyy-mm-dd hh24:mi:ss'),'{8}',{9})");
                        string sqlIns = string.Format(sqlInsert.ToString(), r["Examinee_ID"], exam_date, exam_style, exam_address,
                                                      exam_subject, exam_score, exam_result, DateTime.Now, PrjPub.CurrentLoginUser.EmployeeName,
                                                      random_exam_id);

                        access.ExecuteNonQuery(sqlIns);

                        System.Threading.Thread.Sleep(10);
                        jsBlock = "<script>SetPorgressBar('更新考生考试档案','" + ((i * 100) / ((double)dtSel.Rows.Count)).ToString("0.00") + "'); </script>";
                        Response.Write(jsBlock);
                        Response.Flush();

                        i++;
                    }
                }

                if (exam.HasTrainClass)
                {
                    jsBlock = string.Empty;

                    RandomExamTrainClassBLL      objBll  = new RandomExamTrainClassBLL();
                    IList <RandomExamTrainClass> objList =
                        objBll.GetRandomExamTrainClassByRandomExamID(Convert.ToInt32(strId));

                    string strClassID = "";
                    foreach (RandomExamTrainClass trainClass in objList)
                    {
                        strClassID += (strClassID == string.Empty)
                                          ? trainClass.TrainClassID.ToString()
                                          : "," + trainClass.TrainClassID;
                    }

                    StringBuilder sqlClass = new StringBuilder();
                    sqlClass.Append(" select C.TRAIN_CLASS_ID,begin_date,end_date,TP.TRAIN_PLAN_TYPE_ID,TP.Location,C.Employee_ID ");
                    sqlClass.Append(" from zj_train_class TC right join (select  train_plan_id, train_class_id,Employee_ID from zj_train_plan_employee");
                    sqlClass.AppendFormat(" where train_class_id in ({0}) ", strClassID);
                    sqlClass.Append("  ) C on C.TRAIN_CLASS_ID=TC.TRAIN_CLASS_ID ");
                    sqlClass.Append(" left join zj_train_plan TP on TP.TRAIN_PLAN_ID=C.TRAIN_PLAN_ID");
                    access = new OracleAccess();
                    DataTable dtClass = access.RunSqlDataSet(sqlClass.ToString()).Tables[0];
                    if (dtClass != null && dtClass.Rows.Count > 0)
                    {
                        int i = 1;
                        foreach (DataRow r in dtClass.Rows)
                        {
                            if (("," + strChooseID + ",").IndexOf("," + r["Employee_ID"] + ",") < 0)
                            {
                                System.Threading.Thread.Sleep(10);
                                jsBlock = "<script>SetPorgressBar('更新考生培训档案','" + ((i * 100) / ((double)dtClass.Rows.Count)).ToString("0.00") + "'); </script>";
                                Response.Write(jsBlock);
                                Response.Flush();

                                i++;
                                continue;
                            }

                            access.ExecuteNonQuery(" delete from zj_employee_train where Train_class_ID in (" + strClassID + ") and  employee_id=" + r["Employee_ID"]);

                            int    trainClassID    = Convert.ToInt32(r["TRAIN_CLASS_ID"]);
                            string beginDate       = r["begin_date"].ToString();
                            string endDate         = r["end_date"].ToString();
                            int    trainPlanTypeID = Convert.ToInt32(r["TRAIN_PLAN_TYPE_ID"]);
                            string location        = r["Location"].ToString();
                            int    hour            = 0;
                            string classSubject    = string.Empty;

                            DataTable dtSubject =
                                access.RunSqlDataSet(
                                    "select subject_name,class_hour from zj_train_class_subject where train_class_id=" +
                                    trainClassID).Tables[0];
                            if (dtSubject != null && dtSubject.Rows.Count > 0)
                            {
                                List <string> lst = new List <string>();
                                foreach (DataRow rhour in dtSubject.Rows)
                                {
                                    lst.Add(rhour["subject_name"].ToString());
                                    if (rhour["class_hour"].ToString() != "")
                                    {
                                        hour += Convert.ToInt32(rhour["class_hour"]);
                                    }
                                }
                                classSubject = string.Join(",", lst.ToArray());
                            }

                            StringBuilder sqlInsert = new StringBuilder();
                            sqlInsert.Append("insert into zj_employee_train values(EMPLOYEE_TRAIN_SEQ.NEXTVAL,");
                            sqlInsert.Append("{0},{1},to_date('{2}','yyyy-mm-dd hh24:mi:ss'),to_date('{3}','yyyy-mm-dd hh24:mi:ss'),");
                            sqlInsert.Append("{4},'{5}',{6},'{7}',to_date('{8}','yyyy-mm-dd hh24:mi:ss'),'{9}')");
                            string sqlIns = string.Format(sqlInsert.ToString(), r["Employee_ID"], trainClassID, beginDate, endDate,
                                                          trainPlanTypeID, location, hour, classSubject, DateTime.Now, PrjPub.CurrentLoginUser.EmployeeName);

                            access.ExecuteNonQuery(sqlIns);

                            jsBlock = "<script>SetPorgressBar('更新考生培训档案','" + ((i * 100) / ((double)dtClass.Rows.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            i++;
                        }
                    }
                }

                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
            catch (Exception)
            {
                Response.Write("<script>top.returnValue='false';top.close();</script>");
            }
        }
コード例 #27
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dataTable = BindGrid();

            if (txtMET2.Text == "")
            {
                txtMET2.Text = "1";
            }

            if (chkHasTrainClass.Checked)
            {
                if (hfPostID.Value == "")
                {
                    SessionSet.PageMessage = "带有培训班的考试,必须选择职名!";
                    return;
                }
            }

            RandomExamBLL examBLL = new RandomExamBLL();

            RailExam.Model.RandomExam exam = new RailExam.Model.RandomExam();

            string strID        = string.Empty;
            string strMode      = ViewState["mode"].ToString();
            string strStartMode = ViewState["startmode"].ToString();

            RandomExamTrainClassBLL objTrainClassBll = new RandomExamTrainClassBLL();

            string[] strPost         = hfPostID.Value.Split(',');
            string   strErrorMessage = "";

            OracleAccess db = new OracleAccess();

            if (strMode == "Insert")
            {
                string strExam = "select * from Random_Exam where Exam_Name='" + txtExamName.Text + "'";
                if (db.RunSqlDataSet(strExam).Tables[0].Rows.Count > 0)
                {
                    SessionSet.PageMessage = "该考试名称在系统中已经存在,请重新输入!";
                    txtExamName.Focus();
                    return;
                }

                if (chkHasTrainClass.Checked)
                {
                    foreach (DataRow dr in dataTable.Rows)
                    {
                        for (int i = 0; i < strPost.Length; i++)
                        {
                            IList <RandomExamTrainClass> objList =
                                objTrainClassBll.GetRandomExamTrainClassCount(Convert.ToInt32(dr["TrainClassID"].ToString()),
                                                                              Convert.ToInt32(dr["TrainClassSubjectID"].ToString()),
                                                                              Convert.ToInt32(strPost[i]));
                            if (objList.Count > 0)
                            {
                                strErrorMessage = "培训班“" + dr["TrainClassName"] + "”的考试科目“" + dr["TrainClassSubjectName"] + "”已新增当前所选职名的试卷!";
                            }
                        }
                    }
                }

                if (strErrorMessage != "")
                {
                    SessionSet.PageMessage = strErrorMessage;
                    return;
                }

                exam.CategoryId   = int.Parse(hfCategoryId.Value);
                exam.ExamName     = txtExamName.Text;
                exam.Memo         = txtMemo.Text;
                exam.CreatePerson = PrjPub.CurrentLoginUser.EmployeeName;
                exam.ExamModeId   = 1;
                exam.PassScore    = Convert.ToDecimal(txtPassScore.Text);
                if (rbnExamMode1.Checked)
                {
                    exam.IsComputerExam = true;
                }
                else
                {
                    exam.IsComputerExam = false;
                }

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

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

                exam.IsAutoScore    = chAutoScore.Checked;
                exam.CanSeeAnswer   = chkCanSeeAnswer.Checked;
                exam.CanSeeScore    = chSeeScore.Checked;
                exam.IsPublicScore  = chPublicScore.Checked;
                exam.IsUnderControl = chUD.Checked;
                exam.MaxExamTimes   = int.Parse(txtMET2.Text);
                exam.MinExamTimes   = 1;
                exam.BeginTime      = DateTime.Parse(dateBeginTime.DateValue.ToString());
                exam.EndTime        = DateTime.Parse(dateEndTime.DateValue.ToString());
                exam.ExamTypeId     = 1;
                exam.CreateTime     = DateTime.Now;
                exam.Description    = txtDescription.Text;
                exam.ExamTime       = int.Parse(txtExamTime.Text);
                exam.StatusId       = 1;
                exam.PostID         = hfPostID.Value;

                exam.RandomExamModularTypeID = Convert.ToInt32(ddlModularType.SelectedValue);
                exam.IsReduceError           = chkIsReduceScore.Checked;

                exam.AutoSaveInterval = chkAllItem.Checked ? 1 : 0;

                if (saveTd.Visible)
                {
                    exam.SaveStatus = Convert.ToInt32(ddlDate.SelectedValue);

                    if (dateSaveDate.Visible)
                    {
                        if (dateSaveDate.DateValue == null)
                        {
                            SessionSet.PageMessage = "请选择一个存档时间!";
                            return;
                        }

                        exam.SaveDate = Convert.ToDateTime(dateSaveDate.DateValue);
                    }
                }
                else
                {
                    exam.SaveStatus = 0;
                    exam.SaveDate   = null;
                }

                //exam.AutoSaveInterval = 0;
                exam.OrgId = PrjPub.CurrentLoginUser.StationOrgID;

                exam.HasTrainClass = chkHasTrainClass.Checked;

                int id = examBLL.AddExam(exam);
                strID = id.ToString();

                if (_isWuhanOnly)
                {
                    //当考试来源为培训班时,需自动添加考生。
                    if (chkHasTrainClass.Checked)
                    {
                        foreach (DataRow dr in dataTable.Rows)
                        {
                            RandomExamTrainClass obj = new RandomExamTrainClass();
                            obj.RandomExamID        = Convert.ToInt32(strID);
                            obj.TrainClassID        = Convert.ToInt32(dr["TrainClassID"].ToString());
                            obj.TrainClassSubjectID = Convert.ToInt32(dr["TrainClassSubjectID"].ToString());
                            objTrainClassBll.AddRandomExamTrainClass(obj);
                        }
                        //ClientScript.RegisterStartupScript(GetType(),
                        //    "jsSelectFirstNode",
                        //    @"SaveArrange(" + strID + ",'" + strStartMode + "','" + strMode + "');",
                        //    true);

                        //string strClause = strID + "|" + strStartMode + "|" + strMode;
                        //ClientScript.RegisterStartupScript(GetType(), "import", "inputCallback.callback('" + strClause + "');", true);

                        try
                        {
                            SaveRandomExamArrange(strID, hfTrainClassID.Value, hfPostID.Value);
                        }
                        catch
                        {
                            SessionSet.PageMessage = "添加考生失败";
                            return;
                        }

                        Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                    }
                    else
                    {
                        Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                    }
                }
                else
                {
                    Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                }
            }
            else if (strMode == "Edit")
            {
                strID = Request.QueryString.Get("id");

                if (Pub.HasPaper(Convert.ToInt32(strID)))
                {
                    Response.Write("<script>alert('该考试已生成试卷,不能被编辑!');window.close();</script>");
                    return;
                }

                string strExam = "select * from Random_Exam where Random_Exam_ID!=" + strID + " and Exam_Name='" + txtExamName.Text + "'";
                if (db.RunSqlDataSet(strExam).Tables[0].Rows.Count > 0)
                {
                    SessionSet.PageMessage = "该考试名称在系统中已经存在,请重新输入!";
                    txtExamName.Focus();
                    return;
                }

                string    strSql = "select * from Random_Exam_Computer_Server where Has_Paper=1 and Random_Exam_ID=" + strID;
                DataTable dt     = db.RunSqlDataSet(strSql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    SessionSet.PageMessage = "当前考试已经生成试卷,不能继续编辑!";
                    return;
                }


                if (chkHasTrainClass.Checked && ViewState["TrainClass"].ToString() != hfTrainClassID.Value)
                {
                    foreach (DataRow dr in dataTable.Rows)
                    {
                        for (int i = 0; i < strPost.Length; i++)
                        {
                            IList <RandomExamTrainClass> objList =
                                objTrainClassBll.GetRandomExamTrainClassCount(Convert.ToInt32(dr["TrainClassID"].ToString()),
                                                                              Convert.ToInt32(dr["TrainClassSubjectID"].ToString()),
                                                                              Convert.ToInt32(strPost[i]));
                            if (objList.Count > 0)
                            {
                                if (objList[0].RandomExamID.ToString() != strID)
                                {
                                    strErrorMessage = "培训班“" + dr["TrainClassName"] + "”的考试科目“" + dr["TrainClassSubjectName"] + "”已新增当前所选职名的试卷!";
                                }
                            }
                        }
                    }
                }

                if (strErrorMessage != "")
                {
                    SessionSet.PageMessage = strErrorMessage;
                    return;
                }

                exam.CategoryId   = Convert.ToInt32(hfCategoryId.Value);
                exam.ExamName     = txtExamName.Text;
                exam.Memo         = txtMemo.Text;
                exam.RandomExamId = int.Parse(strID);
                exam.ExamTime     = int.Parse(txtExamTime.Text);
                exam.ExamModeId   = 1;
                exam.PassScore    = Convert.ToDecimal(txtPassScore.Text);
                if (rbnExamMode1.Checked)
                {
                    exam.IsComputerExam = true;
                }
                else
                {
                    exam.IsComputerExam = false;
                }

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

                if (rbnStyle1.Checked)
                {
                    exam.ExamStyle = 1;
                }
                else
                {
                    exam.ExamStyle = 2;
                }
                exam.BeginTime = DateTime.Parse(dateBeginTime.DateValue.ToString());
                exam.EndTime   = DateTime.Parse(dateEndTime.DateValue.ToString());

                exam.IsAutoScore    = chAutoScore.Checked;
                exam.CanSeeAnswer   = chkCanSeeAnswer.Checked;
                exam.CanSeeScore    = chSeeScore.Checked;
                exam.IsPublicScore  = chPublicScore.Checked;
                exam.IsUnderControl = chUD.Checked;
                exam.MaxExamTimes   = int.Parse(txtMET2.Text);
                exam.MinExamTimes   = 1;
                exam.ExamTypeId     = 1;
                exam.Description    = txtDescription.Text;
                //exam.AutoSaveInterval = 0;

                exam.RandomExamModularTypeID = Convert.ToInt32(ddlModularType.SelectedValue);
                exam.IsReduceError           = chkIsReduceScore.Checked;
                exam.AutoSaveInterval        = chkAllItem.Checked ? 1 : 0;

                if (saveTd.Visible)
                {
                    exam.SaveStatus = Convert.ToInt32(ddlDate.SelectedValue);

                    if (dateSaveDate.Visible)
                    {
                        if (dateSaveDate.DateValue == null)
                        {
                            SessionSet.PageMessage = "请选择一个存档时间!";
                            return;
                        }

                        exam.SaveDate = Convert.ToDateTime(dateSaveDate.DateValue);
                    }
                }
                else
                {
                    exam.SaveStatus = 0;
                    exam.SaveDate   = null;
                }

                RandomExamArrangeBLL objArrangeBll = new RandomExamArrangeBLL();
                //当是否为培训班改变或则培训班改变时,需删除考试安排
                if (Convert.ToBoolean(ViewState["HasTrainClass"].ToString()) != chkHasTrainClass.Checked ||
                    ViewState["TrainClass"].ToString() != hfTrainClassID.Value || ViewState["PostID"].ToString() != hfPostID.Value)
                {
                    objArrangeBll.DeleteRandomExamArrangeByRandomExamID(Convert.ToInt32(strID));
                }

                if ((Convert.ToBoolean(ViewState["HasTrainClass"].ToString()) != chkHasTrainClass.Checked && !chkHasTrainClass.Checked) || ViewState["TrainClass"].ToString() != hfTrainClassID.Value)
                {
                    objTrainClassBll.DeleteRandomExamTrainClassByRandomExamID(Convert.ToInt32(strID));
                }

                exam.HasTrainClass = chkHasTrainClass.Checked;
                exam.PostID        = hfPostID.Value;
                exam.Version       = exam.Version + 1;
                examBLL.UpdateExam(exam);

                if (_isWuhanOnly)
                {
                    if (chkHasTrainClass.Checked)
                    {
                        //当培训班或职名发生变化时,更改考生名单
                        if (ViewState["TrainClass"].ToString() != hfTrainClassID.Value || ViewState["PostID"].ToString() != hfPostID.Value)
                        {
                            objTrainClassBll.DeleteRandomExamTrainClassByRandomExamID(Convert.ToInt32(strID));
                            foreach (DataRow dr in dataTable.Rows)
                            {
                                RandomExamTrainClass obj = new RandomExamTrainClass();
                                obj.RandomExamID        = Convert.ToInt32(strID);
                                obj.TrainClassID        = Convert.ToInt32(dr["TrainClassID"].ToString());
                                obj.TrainClassSubjectID = Convert.ToInt32(dr["TrainClassSubjectID"].ToString());
                                objTrainClassBll.AddRandomExamTrainClass(obj);
                            }

                            //ClientScript.RegisterStartupScript(GetType(),
                            //"jsSelectFirstNode",
                            //@"SaveArrange(" + strID + ",'" + strStartMode + "','" + strMode + "');",
                            //true);

                            //string strClause = strID + "|" + strStartMode + "|" + strMode;
                            //ClientScript.RegisterStartupScript(GetType(), "import", "inputCallback.callback('" + strClause + "');", true);

                            try
                            {
                                SaveRandomExamArrange(strID, hfTrainClassID.Value, hfPostID.Value);
                            }
                            catch
                            {
                                SessionSet.PageMessage = "添加考生失败";
                                return;
                            }

                            Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                        }
                        else
                        {
                            Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                        }
                    }
                    else
                    {
                        Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                    }
                }
                else
                {
                    Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
                }
            }
            else
            {
                strID = Request.QueryString.Get("id");
                Response.Redirect("RandomExamManageSecond.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strID);
            }
        }
コード例 #28
0
        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;
            }
        }
コード例 #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }
                ViewState["mode"]      = Request.QueryString.Get("mode");
                ViewState["startmode"] = Request.QueryString.Get("startmode");

                hfMode.Value = ViewState["mode"].ToString();

                if (ViewState["mode"].ToString() == "ReadOnly")
                {
                    btnInput.Enabled = false;
                }

                string strId = Request.QueryString.Get("id");
                if (!string.IsNullOrEmpty(strId))
                {
                    HfRandomExamid.Value = strId;
                    RandomExamBLL             randomExamBLL = new RandomExamBLL();
                    RailExam.Model.RandomExam RandomExam    = randomExamBLL.GetExam(int.Parse(strId));
                    if (RandomExam != null)
                    {
                        txtPaperName.Text = RandomExam.ExamName;
                    }

                    ItemTypeBLL      objTypeBll  = new ItemTypeBLL();
                    IList <ItemType> objTypeList = objTypeBll.GetItemTypes();
                    foreach (ItemType objType in objTypeList)
                    {
                        if (RandomExam.IsComputerExam)
                        {
                            if (objType.ItemTypeId > PrjPub.ITEMTYPE_JUDGE)
                            {
                                continue;
                            }
                        }

                        ListItem item = new ListItem();
                        item.Text  = objType.TypeName;
                        item.Value = objType.ItemTypeId.ToString();
                        lbType.Items.Add(item);
                    }

                    BindGrid();
                }
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    int nID = Int32.Parse(strDeleteID);
                    RandomExamSubjectBLL RandomExamSubjectBLL = new RandomExamSubjectBLL();
                    RandomExamSubjectBLL.DeleteRandomExamSubject(nID);
                    BindGrid();
                }
            }
        }
コード例 #30
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            string strId        = Request.QueryString.Get("id");
            string strMode      = ViewState["mode"].ToString();
            string strStartMode = ViewState["startmode"].ToString();

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                if (strStartMode == "Edit")
                {
                    //Response.Redirect("/RailExamBao/RandomExamOther/RandomExamStudent.aspx?startmode=Edit&mode=Edit&id=" + strId);
                    Response.Redirect("/RailExamBao/RandomExam/SelectEmployeeDetailNew.aspx?startmode=Edit&mode=Edit&id=" + strId);
                    return;
                }
                else
                {
                    Response.Redirect("/RailExamBao/RandomExam/SelectEmployeeDetailNew.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strId);
                    return;
                }
            }

            RandomExamStrategyBLL psbcBll = new RandomExamStrategyBLL();

            int Ncount = psbcBll.GetRandomExamStrategysByExamID(int.Parse(strId)).Count;

            if (Ncount == 0)
            {
                SessionSet.PageMessage = "请添加策略!";
                return;
            }

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

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

            for (int i = 0; i < randomExamSubjects.Count; i++)
            {
                int     nSubjectId      = randomExamSubjects[i].RandomExamSubjectId;
                decimal nTotalItemCount = randomExamSubjects[i].ItemCount;

                IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                int nItemCount = 0;
                for (int j = 0; j < strategys.Count; j++)
                {
                    nItemCount += strategys[j].ItemCount;
                }

                ExamItemCounts += nItemCount;
                if (nItemCount != nTotalItemCount)
                {
                    SessionSet.PageMessage = "大题设定的试题数和取题范围设定的总题数不相等,请重新设置!";
                    return;
                }
            }

            if (ExamItemCounts == 0)
            {
                SessionSet.PageMessage = "考试的总题数不能为0,请重新设置!";
                return;
            }

            //获取考试信息
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId));
            int year = obj.BeginTime.Year;

            //删除可能的取题范围
            randomItemBLL.DeleteItems(int.Parse(strId), year);

            Hashtable htItemID  = new Hashtable();
            Hashtable htChapter = new Hashtable();

            for (int i = 0; i < randomExamSubjects.Count; i++)
            {
                IList <RailExam.Model.Item> itemList = new List <RailExam.Model.Item>();
                int     nSubjectId = randomExamSubjects[i].RandomExamSubjectId;
                decimal nUnitScore = randomExamSubjects[i].UnitScore;

                IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                for (int k = 0; k < strategys.Count; k++)
                {
                    //策略
                    int    nChapterId        = strategys[k].RangeId;
                    int    nRangeType        = strategys[k].RangeType;
                    int    typeId            = strategys[k].ItemTypeId;
                    int    StrategyId        = strategys[k].RandomExamStrategyId;
                    int    strDiffId         = strategys[k].ItemDifficultyID;
                    int    strMaxDiffId      = strategys[k].MaxItemDifficultyID;
                    string excludesChapterID = strategys[k].ExcludeChapterId;

                    IList <RailExam.Model.Item> itemListTemp = new List <RailExam.Model.Item>();
                    itemListTemp = itemBLL.GetItemsByStrategyNew(nRangeType, strDiffId, strMaxDiffId, nChapterId, typeId, excludesChapterID);

                    if (itemListTemp.Count < strategys[k].ItemCount)
                    {
                        SessionSet.PageMessage = "大题" + (i + 1).ToString() + "在设定的取题范围内的试题量不够,请重新设置取题范围!";
                        return;
                    }

                    for (int m = 0; m < itemListTemp.Count; m++)
                    {
                        itemListTemp[m].StrategyId = StrategyId;
                        if (itemListTemp[m].StatusId == 1)
                        {
                            if (htChapter.ContainsKey(itemListTemp[m].ChapterId))
                            {
                                ArrayList objList = (ArrayList)htChapter[itemListTemp[m].ChapterId];

                                if (objList.IndexOf(itemListTemp[m].KeyWord) < 0)
                                {
                                    itemList.Add(itemListTemp[m]);
                                    if (itemListTemp[m].KeyWord != "" && itemListTemp[m].KeyWord != null)
                                    {
                                        objList.Add(itemListTemp[m].KeyWord);
                                    }
                                }
                            }
                            else
                            {
                                ArrayList objList = new ArrayList();
                                if (itemListTemp[m].KeyWord != "" && itemListTemp[m].KeyWord != null)
                                {
                                    objList.Add(itemListTemp[m].KeyWord);
                                }

                                itemList.Add(itemListTemp[m]);

                                htChapter.Add(itemListTemp[m].ChapterId, objList);
                            }
                        }
                    }
                }

                if (itemList.Count < randomExamSubjects[i].ItemCount)
                {
                    SessionSet.PageMessage = "大题" + (i + 1).ToString() + "在设定的取题范围内符合要求的试题量不够,请重新设置取题范围!";
                    return;
                }

                IList <RandomExamItem> randomExamItems = new List <RandomExamItem>();

                int n = 0;
                foreach (RailExam.Model.Item item in itemList)
                {
                    if (string.IsNullOrEmpty(item.StandardAnswer) && (item.TypeId == PrjPub.ITEMTYPE_SINGLECHOOSE || item.TypeId == PrjPub.ITEMTYPE_MULTICHOOSE || item.TypeId == PrjPub.ITEMTYPE_JUDGE))
                    {
                        n = n + 1;
                        break;
                    }
                    if (!htItemID.ContainsKey(item.ItemId))
                    {
                        htItemID.Add(item.ItemId, item.ItemId);
                    }
                    else
                    {
                        continue;
                    }
                    RandomExamItem paperItem = new RandomExamItem();
                    paperItem.SubjectId      = nSubjectId;
                    paperItem.StrategyId     = item.StrategyId;
                    paperItem.RandomExamId   = int.Parse(strId);
                    paperItem.AnswerCount    = item.AnswerCount;
                    paperItem.BookId         = item.BookId;
                    paperItem.CategoryId     = item.CategoryId;
                    paperItem.ChapterId      = item.ChapterId;
                    paperItem.CompleteTime   = item.CompleteTime;
                    paperItem.Content        = item.Content;
                    paperItem.CreatePerson   = item.CreatePerson;
                    paperItem.CreateTime     = item.CreateTime;
                    paperItem.Description    = item.Description;
                    paperItem.DifficultyId   = item.DifficultyId;
                    paperItem.ItemId         = item.ItemId;
                    paperItem.Memo           = item.Memo;
                    paperItem.OrganizationId = item.OrganizationId;
                    paperItem.OutDateDate    = item.OutDateDate;
                    paperItem.Score          = nUnitScore;
                    paperItem.SelectAnswer   = item.SelectAnswer;
                    paperItem.Source         = item.Source;
                    paperItem.StandardAnswer = item.StandardAnswer;
                    paperItem.StatusId       = item.StatusId;
                    paperItem.TypeId         = item.TypeId;
                    paperItem.UsedCount      = item.UsedCount;
                    paperItem.Version        = item.Version;
                    randomExamItems.Add(paperItem);
                }

                if (n == 1)
                {
                    SessionSet.PageMessage = "大题" + (i + 1).ToString() + "有无标准答案的试题,请重新设置取题范围!";
                    return;
                }

                if (randomExamItems.Count > 0)
                {
                    randomItemBLL.AddItem(randomExamItems, year);
                }
            }

            /*
             * Hashtable hashTableItemIds = new Hashtable();
             * for (int i = 0; i < randomExamSubjects.Count; i++)
             * {
             *      int nSubjectId = randomExamSubjects[i].RandomExamSubjectId;
             *      //int nItemCount = randomExamSubjects[i].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);
             *              Random ObjRandom = new Random();
             *              Hashtable hashTable = new Hashtable();
             *              Hashtable hashTableCount = new Hashtable();
             *              while (hashTable.Count < nItemCount)
             *              {
             *                      int k = ObjRandom.Next(itemList.Count);
             *                      hashTableCount[k] = k;
             *                      int itemID = itemList[k].ItemId;
             *                      if (!hashTableItemIds.ContainsKey(itemID))
             *                      {
             *                              hashTable[itemID] = itemID;
             *                              hashTableItemIds[itemID] = itemID;
             *                      }
             *
             *                      if (hashTableCount.Count == itemList.Count && hashTable.Count < nItemCount)
             *                      {
             *                              SessionSet.PageMessage = "随机考试在设定的取题范围内的试题量不够,请重新设置取题范围!";
             *                              return;
             *                      }
             *              }
             *      }
             * }*/
            Response.Redirect("/RailExamBao/RandomExam/SelectEmployeeDetailNew.aspx?startmode=" + strStartMode + "&mode=" + strMode + "&id=" + strId);
        }