private void BindGrid() { RandomExamApplyBLL objbll = new RandomExamApplyBLL(); Grid1.DataSource = objbll.GetRandomExamApplyByExamID(Convert.ToInt32(Request.QueryString.Get("RandomExamID"))); Grid1.DataBind(); }
protected void CallBack1_Callback(object sender, ComponentArt.Web.UI.CallBackEventArgs e) { if (hfID.Value != "") { RandomExamApplyBLL objBll = new RandomExamApplyBLL(); RandomExamApply obj = objBll.GetRandomExamApply(Convert.ToInt32(hfID.Value)); if (obj.RandomExamApplyID != 0) { if (obj.ApplyStatus == 1) { hfNow.Value = "1"; } else { hfNow.Value = "0"; } } else { hfNow.Value = "-1"; } } else { hfNow.Value = "0"; } hfNow.RenderControl(e.Output); }
protected void btnClose_Click(object sender, EventArgs e) { RandomExamApplyBLL objBll = new RandomExamApplyBLL(); objBll.DelRandomExamApply(Convert.ToInt32(hfID.Value)); Response.Write("<script>top.close();</script>"); }
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; }
protected void gridCallback_callback(object sender, CallBackEventArgs e) { RandomExamApplyBLL objbll = new RandomExamApplyBLL(); Grid1.DataSource = objbll.GetRandomExamApplyByOrgID(Convert.ToInt32(Request.QueryString.Get("OrgID")), PrjPub.ServerNo.ToString()); Grid1.DataBind(); Grid1.RenderControl(e.Output); }
private void BindGrid() { RandomExamApplyBLL objbll = new RandomExamApplyBLL(); IList <RandomExamApply> objList = objbll.GetRandomExamApplyByOrgID(Convert.ToInt32(Request.QueryString.Get("OrgID")), PrjPub.ServerNo.ToString()); Grid1.DataSource = objList; Grid1.DataBind(); }
//是否可以显示前台 public static bool IsShowOnline() { string strIP = Pub.GetRealIP(); RandomExamApplyBLL objBll = new RandomExamApplyBLL(); IList <RandomExamApply> objList = objBll.GetRandomExamApplyByIPAddress(strIP); if (objList.Count > 0) { return(false); } else { return(true); } }
protected void btnApply_Click(object sender, EventArgs e) { RandomExamApplyBLL objbll = new RandomExamApplyBLL(); IList <RandomExamApply> objList = objbll.GetRandomExamApplyByOrgID(Convert.ToInt32(hfOrgID.Value), PrjPub.ServerNo.ToString()); if (objList.Count == 0) { SessionSet.PageMessage = "没有需要回复的请求!"; return; } ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"showApply();", true); }
protected void Session_End(object sender, EventArgs e) { if (PrjPub.CurrentStudent != null) { string strCacheKey = PrjPub.CurrentStudent.EmployeeID.ToString(); string strUser = Convert.ToString(HttpContext.Current.Cache[strCacheKey]); if (strUser != string.Empty) { HttpContext.Current.Cache.Remove(strCacheKey); SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); objloginBll.DeleteSystemUserLogin(Convert.ToInt32(strCacheKey)); } } if (Session["IPAddress"] != null) { string strIP = Session["IPAddress"].ToString(); RandomExamApplyBLL objBll = new RandomExamApplyBLL(); objBll.DelRandomExamApplyByIPAddress(strIP); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !gridCallback.IsCallback) { BindGrid(); } string strChoose = Request.Form.Get("ChooseID"); if (strChoose != "" && strChoose != null) { RandomExamApplyBLL objBll = new RandomExamApplyBLL(); string[] str = strChoose.ToString().Split(','); string strEmployeeID = ""; for (int i = 0; i < str.Length; i++) { RandomExamApply obj = objBll.GetRandomExamApply(Convert.ToInt32(str[i])); if (("," + strEmployeeID + ",").IndexOf("," + obj.RandomExamID + "#" + obj.EmployeeID + ",") < 0) { if (strEmployeeID == "") { strEmployeeID = obj.RandomExamID + "#" + obj.EmployeeID.ToString(); } else { strEmployeeID = strEmployeeID + "," + obj.RandomExamID + "#" + obj.EmployeeID; } } else { SessionSet.PageMessage = "不能同时通过同一考生的两次同一考试请求!"; ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"getGrid('" + strChoose + "');", true); return; } } for (int i = 0; i < str.Length; i++) { objBll.UpdateRandomExamApplyStatus(Convert.ToInt32(str[i]), 1); } BindGrid(); } string strChooseID = Request.Form.Get("ChooseOneID"); if (strChooseID != "" && strChooseID != null) { string[] str = strChooseID.Split('|'); string strApplyID = str[0]; string strEmployeeID = str[1]; RandomExamApplyBLL objBll = new RandomExamApplyBLL(); RandomExamApply objApply = objBll.GetRandomExamApply(Convert.ToInt32(strApplyID)); IList <RandomExamApply> objList = objBll.GetRandomExamApplyByOrgID(Convert.ToInt32(Request.QueryString.Get("OrgID")), PrjPub.ServerNo.ToString()); foreach (RandomExamApply apply in objList) { if (apply.RandomExamApplyID.ToString() != strApplyID && apply.RandomExamID == objApply.RandomExamID && apply.EmployeeID.ToString() == strEmployeeID && apply.ApplyStatus == 1) { SessionSet.PageMessage = "已有该考生的考试请求获得通过!"; ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"getGrid('" + strApplyID + "');", true); return; } } objBll.UpdateRandomExamApplyStatus(Convert.ToInt32(strApplyID), 1); BindGrid(); } string strDel = Request.Form.Get("deleteid"); if (strDel != "" && strDel != null) { RandomExamApplyBLL objBll = new RandomExamApplyBLL(); objBll.DelRandomExamApply(Convert.ToInt32(strDel)); BindGrid(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && !Callback1.IsCallback && !ItemAnswerChangeCallBack.IsCallback) { string strExamId = Request.QueryString.Get("id"); ViewState["ExamID"] = strExamId; ViewState["BeginTime"] = DateTime.Now.ToString(); //记录当前考试所在地的OrgID ViewState["OrgID"] = ConfigurationManager.AppSettings["StationID"]; ViewState["EmployeeID"] = Request.QueryString.Get("employeeID"); if (strExamId != null && strExamId != "") { RandomExamBLL randomExamBLL = new RandomExamBLL(); RailExam.Model.RandomExam randomExam = randomExamBLL.GetExam(int.Parse(strExamId)); ViewState["Year"] = randomExam.BeginTime.Year.ToString(); 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["EmployeeID"].ToString()), Convert.ToInt32(strExamId)); ViewState["LastExamTime"] = objResultCurrent.ExamTime.ToString(); HfExamTime.Value = ((randomExam.ExamTime * 60) - objResultCurrent.ExamTime).ToString(); if (objResultCurrent.ExamTime < 600 && randomExam.ExamTime * 60 > 600) { hfNeed.Value = (600 - objResultCurrent.ExamTime).ToString(); } else { hfNeed.Value = ""; } //获取该考生当前考试次数 RandomExamResultBLL RandomExamResultBLL = new RandomExamResultBLL(); int nowCount; //如果在站段考试为随到随考,需要检测路局异地考试的情况 //if (randomExam.StartMode == PrjPub.START_MODE_NO_CONTROL && !PrjPub.IsServerCenter) //{ // IList<RandomExamResult> RandomExamResultsServer = // RandomExamResultBLL.GetRandomExamResultByExamineeIDFromServer(PrjPub.CurrentStudent.EmployeeID, // int.Parse(strExamId)); // nowCount = RandomExamResultsServer.Count; //} //else //{ // IList<RandomExamResult> RandomExamResults = RandomExamResultBLL.GetRandomExamResultByExamineeID(PrjPub.CurrentStudent.EmployeeID, int.Parse(strExamId)); // nowCount = RandomExamResults.Count; //} //如果是随到随考,需要往回复请求表加入一条记录 //if (randomExam.StartMode == PrjPub.START_MODE_NO_CONTROL) //{ RandomExamApplyBLL objApplyBll = new RandomExamApplyBLL(); RandomExamApply objNowApply = objApplyBll.GetRandomExamApplyByExamResultCurID(objResultCurrent.RandomExamResultId); if (objNowApply.RandomExamApplyID == 0) { RandomExamApply objApply = new RandomExamApply(); objApply.RandomExamID = Convert.ToInt32(strExamId); objApply.RandomExamResultCurID = objResultCurrent.RandomExamResultId; objApply.ApplyStatus = 1; objApply.CodeFlag = true; objApply.IPAddress = Pub.GetRealIP(); objApplyBll.AddRandomExamApply(objApply); } else { objNowApply.IPAddress = Pub.GetRealIP(); objApplyBll.UpdateRandomExamApply(objNowApply); } //} IList <RandomExamResult> RandomExamResults = RandomExamResultBLL.GetRandomExamResultByExamineeID(Convert.ToInt32(ViewState["EmployeeID"].ToString()), int.Parse(strExamId)); nowCount = RandomExamResults.Count; ViewState["NowStartMode"] = randomExam.StartMode.ToString(); HiddenFieldMaxCount.Value = (randomExam.MaxExamTimes - nowCount - 1).ToString(); //更新考试状态 UpdateResultToDB(strExamId); FillPage(strExamId); } } string strAnswer = Request.Form.Get("strreturnAnswer"); if (strAnswer != null && strAnswer != "") { ViewState["EndTime"] = DateTime.Now.ToString(); SaveAnswerToDB(strAnswer); //int examTime = Convert.ToInt32(ViewState["LastExamTime"].ToString()) + //GetSecondBetweenTwoDate(DateTime.Parse(ViewState["EndTime"].ToString()), // DateTime.Parse(ViewState["BeginTime"].ToString())); //ClientScript.RegisterStartupScript(GetType(), "jsHide", "<script>showProgressbar(" + // Request.QueryString.Get("id") + "," + // ViewState["RandomExamResultID"] + "," + // ViewState["EmployeeID"]+ "," + ViewState["OrgID"]+ // ",'" + // ViewState["EndTime"] + "'," + // examTime + ")</script>"); } }