protected void btnSelect_Click(object sender, EventArgs e)
        {
            int employeeID = Convert.ToInt32(ViewState["EmployeeID"].ToString());

            DateTime begin, end;

            try
            {
                begin         = Convert.ToDateTime(ddlYearSmall.SelectedValue + "-" + ddlMonthSmall.SelectedValue + "-" + "01");
                end           = Convert.ToDateTime(ddlYearBig.SelectedValue + "-" + ddlMonthBig.SelectedValue + "-" + "01").AddMonths(1);
                hfBegin.Value = begin.ToString("yyyy-MM-dd");
                hfEnd.Value   = end.ToString("yyyy-MM-dd");
            }
            catch
            {
                SessionSet.PageMessage = "日期选择不正确!";
                return;
            }

            if (employeeID == 0)
            {
                SessionSet.PageMessage = "请选择学员!";
                return;
            }

            RandomExamResultBLL objBll = new RandomExamResultBLL();

            string str = "and a.Begin_Time>to_date('" + hfBegin.Value + "','yyyy-MM-dd') and a.Begin_Time<=to_date('" + hfEnd.Value + "','yyyy-MM-dd') and a.EXAMINEE_ID=" + employeeID;

            if (ddlExamMode.SelectedValue != "0")
            {
                str += " and c.EXAM_STYLE=" + ddlExamMode.SelectedValue;
            }
            IList <RailExam.Model.RandomExamResult> objList = objBll.GetRandomExamResults(str);

            foreach (RandomExamResult randomExamResult in objList)
            {
                randomExamResult.ExamTimeName = randomExamResult.ExamTime / 60 + "分" + randomExamResult.ExamTime % 60 + "秒";
            }

            examsGrid.DataSource = objList;
            examsGrid.DataBind();

            if (examsGrid.DataSource != null)
            {
                Session["StudentExamInfo"] = examsGrid.DataSource;
                hfIsRef.Value = "true";
            }
        }
        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 = "复制失败!";
            }
        }
        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>");
            }
        }
Example #4
0
        protected void btnExam_Click(object sender, EventArgs e)
        {
            string        strId  = Request.QueryString.Get("eid");
            RandomExamBLL objBll = new RandomExamBLL();

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

            OracleAccess db = new OracleAccess();

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

            int    beginYear = obj.BeginTime.Year;
            string strSql    =
                @"select a.*,b.Employee_Name,b.Employee_ID from Random_Exam_Result a
                inner join Employee b on a.Examinee_ID=b.Employee_ID
                where Random_Exam_Result_ID not in (
                select distinct  a.Random_Exam_Result_ID from Random_Exam_Result_Answer a
                        inner join  Random_Exam_Result b on a.Random_Exam_Result_ID=b.Random_Exam_Result_ID
                        where Random_Exam_ID=" + strId + @"
                union all 
                select distinct  a.Random_Exam_Result_ID from Random_Exam_Result_Answer_" + beginYear + @" a
                         inner join  Random_Exam_Result b on a.Random_Exam_Result_ID=b.Random_Exam_Result_ID
                        where Random_Exam_ID=" + strId + @")
                and Random_Exam_ID=" + strId;
            DataSet dsAnswer = db.RunSqlDataSet(strSql);

            if (dsAnswer.Tables[0].Rows.Count > 0)
            {
                string strIDs = string.Empty;
                foreach (DataRow dr in dsAnswer.Tables[0].Rows)
                {
                    if (("," + strChooseID + ",").IndexOf("," + dr["Employee_ID"] + ",") >= 0)
                    {
                        if (string.IsNullOrEmpty(strIDs))
                        {
                            strIDs += dr["Employee_Name"].ToString();
                        }
                        else
                        {
                            strIDs += "," + dr["Employee_Name"];
                        }
                    }
                }

                if (string.IsNullOrEmpty(strIDs))
                {
                    SessionSet.PageMessage = "所有考生试卷完整!";
                }
                else
                {
                    SessionSet.PageMessage = "下列考生在路局服务器无考试试卷:" + strIDs;
                }
            }
            else
            {
                SessionSet.PageMessage = "所有考生试卷完整!";
            }
        }
Example #5
0
        protected DataSet GetDataSet(bool isFirst)
        {
            string  qsExamId = Request.QueryString.Get("eid");
            int     orgID    = Convert.ToInt32(Request.QueryString.Get("OrgID"));
            DataSet ds       = new DataSet();

            if (!string.IsNullOrEmpty(qsExamId))
            {
                string  OrganizationName = txtOrganizationName.Text;
                string  workShopName     = txtWorkShop.Text;
                string  strExamineeName  = txtExamineeName.Text;
                string  strWorkNo        = txtWorkNo.Text;
                decimal dScoreLower      = string.IsNullOrEmpty(txtScoreLower.Text) ? -1000 : decimal.Parse(txtScoreLower.Text);
                decimal dScoreUpper      = string.IsNullOrEmpty(txtScoreUpper.Text) ? 1000 : decimal.Parse(txtScoreUpper.Text);

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

                try
                {
                    //RandomExamBLL objBll = new RandomExamBLL();
                    //RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(qsExamId));

                    //如果在站段是随到随考,需要综合路局和本地考试情况。
                    //if(obj.StartMode == PrjPub.START_MODE_NO_CONTROL && !PrjPub.IsServerCenter)
                    //{
                    //    examResults = bllExamResult.GetRandomExamResultsFromServer(int.Parse(qsExamId), OrganizationName, strExamineeName, dScoreLower,
                    //         dScoreUpper, orgID);
                    //}
                    //else
                    //{
                    //    examResults = bllExamResult.GetRandomExamResults(int.Parse(qsExamId), OrganizationName, strExamineeName, dScoreLower,
                    //             dScoreUpper, orgID);
                    //}

                    examResults = bllExamResult.GetRandomExamResults(int.Parse(qsExamId), OrganizationName, workShopName, strExamineeName, strWorkNo, dScoreLower,
                                                                     dScoreUpper, orgID);

                    if (isFirst)
                    {
                        lblNowCount.Text = examResults.Count.ToString();
                    }
                }
                catch
                {
                    Pub.ShowErrorPage("无法连接站段服务器,请检查站段服务器是否打开以及网络连接是否正常!");
                }

                ExamResultStatusBLL      bllExamResultStatus = new ExamResultStatusBLL();
                IList <ExamResultStatus> examResultStatuses  = bllExamResultStatus.GetExamResultStatuses();

                DataTable dtExamResults        = ConvertToDataTable((IList)examResults);
                DataTable dtExamResultStatuses = ConvertToDataTable((IList)examResultStatuses);

                if (dtExamResults != null)
                {
                    ds.Tables.Add(dtExamResults);
                }
                else
                {
                    ds.Tables.Add(ConvertToDataTable(typeof(RandomExamResult)));
                }
                ds.Tables.Add(dtExamResultStatuses);
                ds.Relations.Add(ds.Tables["ExamResultStatus"].Columns["ExamResultStatusId"],
                                 ds.Tables["RandomExamResult"].Columns["StatusId"]);
            }

            return(ds);
        }
        private IList <Employee> BindGrid()
        {
            string RandomExamID = Request.QueryString.Get("eid");
            string OrgID        = Request.QueryString.Get("OrgID");

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

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

            examResults = bllExamResult.GetRandomExamResults(Convert.ToInt32(RandomExamID), OrganizationName, string.Empty, strExamineeName, string.Empty, dScoreLower,
                                                             dScoreUpper, Convert.ToInt32(OrgID));

            string strID = string.Empty;

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

            RandomExamBLL objBll = new RandomExamBLL();

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

            RandomExamArrangeBLL      objArrangebll  = new RandomExamArrangeBLL();
            IList <RandomExamArrange> objArrangeList = objArrangebll.GetRandomExamArranges(Convert.ToInt32(RandomExamID));
            string strChooseID = string.Empty;

            if (objArrangeList.Count > 0)
            {
                if (PrjPub.IsServerCenter && Convert.ToInt32(OrgID) == objExam.OrgId)
                {
                    strChooseID = objArrangeList[0].UserIds;
                }
                else if (PrjPub.IsServerCenter && Convert.ToInt32(OrgID) != objExam.OrgId)
                {
                    string[] strEmployee = objArrangeList[0].UserIds.Split(',');

                    OrganizationBLL orgBll      = new OrganizationBLL();
                    EmployeeBLL     employeeBll = new EmployeeBLL();
                    int             count       = 0;
                    for (int i = 0; i < strEmployee.Length; i++)
                    {
                        Employee employee     = employeeBll.GetChooseEmployeeInfo(strEmployee[i]);
                        int      stationOrgID = orgBll.GetStationOrgID(employee.OrgID);

                        if (stationOrgID == Convert.ToInt32(OrgID))
                        {
                            if (strChooseID == string.Empty)
                            {
                                strChooseID = strEmployee[i];
                            }
                            else
                            {
                                strChooseID += "," + strEmployee[i];
                            }
                        }
                    }
                }
                else
                {
                    string 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 b.Computer_Server_ID=c.Computer_Server_ID "
                                    + " where c.Computer_Server_No='" + PrjPub.ServerNo + "'"
                                    + " and a.Random_Exam_ID=" + RandomExamID;
                    OracleAccess db        = new OracleAccess();
                    DataSet      dsArrange = db.RunSqlDataSet(strSql);

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

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

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

                if (("," + strID + ",").IndexOf(("," + str[i] + ",")) < 0)
                {
                    if (strNoResult == string.Empty)
                    {
                        strNoResult = str[i];
                    }
                    else
                    {
                        strNoResult = strNoResult + "," + str[i];
                    }
                }
            }

            EmployeeBLL      objbll  = new EmployeeBLL();
            IList <Employee> objList = new List <Employee>();

            if (strNoResult != string.Empty)
            {
                string[] strNo = strNoResult.Split(',');
                for (int i = 0; i < strNo.Length; i++)
                {
                    Employee employee = objbll.GetChooseEmployeeInfo(strNo[i]);
                    if (employee.EmployeeID != 0)
                    {
                        objList.Add(employee);
                    }
                }
            }

            Session["NoExamInfo"] = objList;

            return(objList);
        }