public void UpdateRandomExamApply(RandomExamApply exam) { Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_Random_Exam_Apply_U"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_random_exam_apply_Id", DbType.Int32, exam.RandomExamApplyID); db.AddInParameter(dbCommand, "p_random_exam_id", DbType.Int32, exam.RandomExamID); db.AddInParameter(dbCommand, "p_random_exam_result_cur_id", DbType.Int32, exam.RandomExamResultCurID); db.AddInParameter(dbCommand, "p_code_flag", DbType.Int32, exam.CodeFlag ? 1 : 0); db.AddInParameter(dbCommand, "p_apply_status", DbType.Int32, exam.ApplyStatus); db.AddInParameter(dbCommand, "p_random_exam_result_id", DbType.Int32, exam.ApplyStatus); db.AddInParameter(dbCommand, "p_ip_address", DbType.String, exam.IPAddress); DbConnection connection = db.CreateConnection(); connection.Open(); DbTransaction transaction = connection.BeginTransaction(); try { db.ExecuteNonQuery(dbCommand, transaction); transaction.Commit(); } catch (System.SystemException ex) { transaction.Rollback(); throw ex; } connection.Close(); }
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 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; }
public RandomExamApply GetRandomExamApplyByExamResultCurID(int examresultID) { RandomExamApply obj = new RandomExamApply(); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("USP_Random_EXAM_Apply_G_CurID"); db.AddInParameter(dbCommand, "p_exam_result_id", DbType.String, examresultID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = CreateModelObject(dataReader); } } return(obj); }
public IList <RandomExamApply> GetRandomExamApplyByIPAddress(string strIP) { IList <RandomExamApply> objList = new List <RandomExamApply>(); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("USP_Random_EXAM_Apply_G_IP"); db.AddInParameter(dbCommand, "p_ip_address", DbType.String, strIP); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { RandomExamApply obj = CreateModelObject(dataReader); obj.IsChecked = false; objList.Add(obj); } } return(objList); }
public RandomExamApply GetRandomExamApply(int applyID) { RandomExamApply obj = new RandomExamApply(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_Random_Exam_Apply_G"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_random_exam_apply_Id", DbType.Int32, applyID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { obj = CreateModelObject(dataReader); } } return(obj); }
public IList <RandomExamApply> GetRandomExamApplyByOrgID(int orgID, string serverNo) { IList <RandomExamApply> objList = new List <RandomExamApply>(); Database db = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("USP_Random_EXAM_Apply_S_ALL"); db.AddInParameter(dbCommand, "p_org_id", DbType.Int32, orgID); db.AddInParameter(dbCommand, "p_server_no", DbType.String, serverNo); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { RandomExamApply obj = CreateModelObject(dataReader); obj.IsChecked = false; obj.ExamName = dataReader[GetMappingFieldName("ExamName")].ToString(); obj.RandomExamCode = dataReader[GetMappingFieldName("RandomExamCode")].ToString(); objList.Add(obj); } } return(objList); }
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(); } }
public void UpdateRandomExamApply(RandomExamApply exam) { dal.UpdateRandomExamApply(exam); }
public int AddRandomExamApply(RandomExamApply exam) { int id = dal.AddRandomExamApply(exam); return(id); }
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>"); } }