private void BindGrid() { ExamBLL examBll = new ExamBLL(); int categoryId = hfCategoryId.Value == "" ? -1 : Convert.ToInt32(hfCategoryId.Value); DateTime beginDate = dateStartDateTime.DateValue == null ? Convert.ToDateTime("0001-01-01") : Convert.ToDateTime(dateStartDateTime.DateValue); DateTime endDate = dateEndDateTime.DateValue == null ? Convert.ToDateTime("0001-01-01") : Convert.ToDateTime(dateEndDateTime.DateValue); int orgId = Convert.ToInt32(Request.QueryString.Get("Orgid")); examsGrid.DataSource = examBll.GetExamsInfoByOrgID(txtExamName.Text, categoryId, beginDate, endDate, orgId, hfIsServer.Value); examsGrid.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !searchExamCallBack.IsCallback) { //如果是系统管理员访问站段服务器则没有权限监控站段考试 if (!PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.RoleID == 1) { btnGetPaper.Enabled = false; btnDelPaper.Enabled = false; btnStart.Enabled = false; btnStop.Enabled = false; btnEnd.Enabled = false; btnUpload.Enabled = false; btnUploadScore.Enabled = false; HfUpdateRight.Value = "False"; } //if (PrjPub.IsWuhan()) //{ // examsGrid.Levels[0].Columns[3].HeadingText = "员工编码"; //} //else //{ // examsGrid.Levels[0].Columns[3].HeadingText = "工资编号"; //} if (PrjPub.IsServerCenter) { btnUpload.Enabled = false; btnUploadScore.Enabled = false; } //当前站段有两台服务器并且当前服务器为次服务器时屏蔽“删除所有考生试卷”和“上传考试成绩”按钮 //if(!PrjPub.IsServerCenter && PrjPub.HasTwoServer() && !PrjPub.IsMainServer()) //{ // btnGetPaper.Visible = false; // btnDelPaper.Visible = false; // btnUpload.Visible = false; //} hfOrgID.Value = ConfigurationManager.AppSettings["StationID"].ToString(); string strId = Request.QueryString.Get("RandomExamID"); RandomExamArrangeBLL objArrangeBll = new RandomExamArrangeBLL(); IList <RandomExamArrange> objArrangeList = objArrangeBll.GetRandomExamArranges(Convert.ToInt32(strId)); string[] str = { "0" }; hfNowCount.Value = "0"; if (objArrangeList.Count == 1) { string strSql = "select * 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 b.Org_ID='" + ConfigurationManager.AppSettings["StationID"] + "'" + " and c.Computer_Server_No='" + PrjPub.ServerNo + "'" + " and Random_Exam_ID=" + strId; OracleAccess db = new OracleAccess(); DataSet ds = db.RunSqlDataSet(strSql); string strUserId = ""; foreach (DataRow dr in ds.Tables[0].Rows) { if (string.IsNullOrEmpty(strUserId)) { strUserId += dr["User_Ids"].ToString(); } else { strUserId += "," + dr["User_Ids"]; } } strUserId = ("," + strUserId + ",").Replace(",0,", ","); str = ((strUserId.TrimStart(',')).TrimEnd(',')).Split(','); ExamBLL objexambll = new ExamBLL(); IList <RailExam.Model.Exam> objExamList = objexambll.GetExamsInfoByOrgID(null, -1, Convert.ToDateTime("0001-01-01"), Convert.ToDateTime("0001-01-01"), Convert.ToInt32(hfOrgID.Value), PrjPub.IsServerCenter.ToString()); foreach (RailExam.Model.Exam objExam in objExamList) { if (objExam.ExamId == Convert.ToInt32(strId)) { hfNowCount.Value = (str.Length - objExam.ExamineeCount).ToString(); break; } } } //获取当前考试的生成试卷的状态和次数 RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId)); RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL(); RandomExamComputerServer server = serverBll.GetRandomExamComputerServer(objRandomExam.RandomExamId, PrjPub.ServerNo); if (server.HasPaper && objRandomExam.StartMode == 2 && server.IsStart != 0) { lblTitle.Text = "考试验证码:"; lblCode.Text = server.RandomExamCode; btnApply.Visible = true; } if (server.HasPaper && server.IsStart != 2)// && !objRandomExam.HasTrainClass { btnAddEmployee.Visible = true; } if (PrjPub.CurrentLoginUser.EmployeeID != 0) { examsGrid.Levels[0].Columns[12].Visible = false; } } if (!searchExamCallBack.IsCallback) { hfSql.Value = GetSql(); examsGrid.DataBind(); } if (Request.Form.Get("OutPutRandom") != null && Request.Form.Get("OutPutRandom") != "") { OutputWord(Request.Form.Get("OutPutRandom")); } if (Request.Form.Get("StopExam") != null && Request.Form.Get("StopExam") != "") { StopExam(Request.Form.Get("StopExam")); } if (Request.Form.Get("DeleteExam") != null && Request.Form.Get("DeleteExam") != "") { DeleteExam(Request.Form.Get("DeleteExam")); } if (Request.Form.Get("ClearExam") != null && Request.Form.Get("ClearExam") != "") { ClearExam(Request.Form.Get("ClearExam")); } if (Request.Form.Get("ReplyExam") != null && Request.Form.Get("ReplyExam") != "") { ReplyExam(Request.Form.Get("ReplyExam")); } if (Request.Form.Get("IsGet") != null && Request.Form.Get("IsGet") != "") { hfSql.Value = GetSql(); examsGrid.DataBind(); string strId = Request.QueryString.Get("RandomExamID"); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId)); //if(!obj.HasTrainClass) //{ btnAddEmployee.Visible = true; //} SessionSet.PageMessage = "生成成功!"; } if (Request.Form.Get("IsEnd") != null && Request.Form.Get("IsEnd") != "") { hfSql.Value = GetSql(); examsGrid.DataBind(); SessionSet.PageMessage = "结束考试成功!"; } if (Request.Form.Get("IsUpload") != null && Request.Form.Get("IsUpload") != "") { hfSql.Value = GetSql(); examsGrid.DataBind(); string strId = Request.QueryString.Get("RandomExamID"); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("“" + obj.ExamName + "”上传考试成绩和答卷"); SessionSet.PageMessage = "上传成功!"; } if (Request.Form.Get("IsStart") != null && Request.Form.Get("IsStart") != "") { hfSql.Value = GetSql(); examsGrid.DataBind(); SessionSet.PageMessage = "开始考试成功!"; string strId = Request.QueryString.Get("RandomExamID"); //获取当前考试的生成试卷的状态和次数 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.HasPaper && objExam.StartMode == 2) { lblCode.Text = "考试验证码:" + server.RandomExamCode; btnApply.Visible = true; } ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"ApplyExam();", true); } if (Request.Form.Get("StudentInfo") != null && Request.Form.Get("StudentInfo") != "" && !searchExamCallBack.IsCallback) { DownloadStudentInfoExcel(); } refreshGridCallback.RefreshInterval = Convert.ToInt32(ConfigurationManager.AppSettings["RefreshInterval"]); btnUpload.Visible = btnUploadScore.Visible = false; // 包神这里用不著上传 2014-03-18 }