protected void btnDelete_Click(object sender, EventArgs e) { SystemUserLoginBLL objbll = new SystemUserLoginBLL(); objbll.DeleteSystemUserLogin(); BindGrid(); }
protected void Callback1_Callback(object sender, CallBackEventArgs 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(e.Parameters[0])); }
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) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } if (PrjPub.HasEditRight("登录信息")) { HfUpdateRight.Value = "True"; } else { HfUpdateRight.Value = "False"; } if (PrjPub.HasDeleteRight("登录信息")) { HfDeleteRight.Value = "True"; } else { HfDeleteRight.Value = "False"; } hfIsServer.Value = PrjPub.IsServerCenter.ToString(); hfSuitRange.Value = PrjPub.CurrentLoginUser.SuitRange.ToString(); BindGrid(); } string strDel = Request.Form.Get("deleteid"); if (strDel != "" && strDel != null) { SystemUserLoginBLL objbll = new SystemUserLoginBLL(); objbll.DeleteSystemUserLogin(Convert.ToInt32(strDel)); BindGrid(); } }
protected void btnExit_Click(object sender, EventArgs e) { if (PrjPub.CurrentStudent != null) { string strCacheKey = PrjPub.CurrentStudent.EmployeeID.ToString(); string strUser = Convert.ToString(Cache[strCacheKey]); if (strUser != string.Empty) { Cache.Remove(strCacheKey); SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); objloginBll.DeleteSystemUserLogin(Convert.ToInt32(strCacheKey)); } } PrjPub.CurrentStudent = null; PrjPub.WelcomeInfo = string.Empty; PrjPub.StudentID = string.Empty; Session.Remove("StudentOrdID"); ddlOrg.Visible = true; lblOrgName.Visible = false; //控件显示 lblUserName.Text = "用户名"; txtUserName.Text = string.Empty; lblPassword.Text = "密 码"; txtUserName.Visible = true; lblOrg.Visible = false; txtPassword.Visible = true; lblEmployeeName.Visible = false; ImageButtonLogin.Visible = true; btnExit.Visible = false; btnModifyPsw.Visible = false; btnResult.Visible = false; Response.Write("<script> top.returnValue = 'true';window.close();</script>"); }
protected void ImageButtonLogin_Click(object sender, EventArgs e) { #region 验证服务器端狗信息 ET99FullClass et99 = new ET99FullClass(); Random random = new Random((int)(DateTime.Now.Ticks >> 32)); string strServerRandomData = string.Empty; string strServerRandomResult = string.Empty; string strServerPid = string.Empty; string strServerUserpin = string.Empty; //string strServerSn = string.Empty; string strServerKey = string.Empty; for (int i = 0; i < 20; i++) { strServerRandomData += random.Next(9).ToString(); } try { strServerPid = ConfigurationManager.AppSettings["PID"]; et99.FindToken(strServerPid); } catch { SessionSet.PageMessage = "服务器端未检测到加密锁!"; return; } try { et99.OpenToken(strServerPid, 1); } catch { SessionSet.PageMessage = "服务器端打开加密锁失败!"; et99.CloseToken(); return; } try { strServerUserpin = ConfigurationManager.AppSettings["USERPIN"]; et99.VerifyPIN(0, strServerUserpin); } catch { SessionSet.PageMessage = "服务器端加密锁USERPIN不正确!"; et99.CloseToken(); return; } try { strServerKey = ConfigurationManager.AppSettings["KEY1"]; strServerRandomResult = et99.MD5HMAC(1, strServerRandomData, 20).ToString(); if (strServerRandomResult != et99.Soft_MD5HMAC(1, strServerRandomData, strServerKey).ToString()) { SessionSet.PageMessage = "服务器端加密锁密钥不正确!"; return; } } catch { SessionSet.PageMessage = "服务器端验证加密锁密钥出错!"; return; } #endregion if (ddlOrg.SelectedValue == "0") { SessionSet.PageMessage = "请选择单位!"; return; } LoginUserBLL loginUserBLL = new LoginUserBLL(); LoginUser loginUser; if (PrjPub.IsServerCenter) { loginUser = loginUserBLL.GetLoginUserByOrgID(Convert.ToInt32(ddlOrg.SelectedValue), txtUserName.Text, txtPassword.Text, 0); } else { loginUser = loginUserBLL.GetLoginUserByOrgID(Convert.ToInt32(ddlOrg.SelectedValue), txtUserName.Text, txtPassword.Text, 1); } if (loginUser == null) { SessionSet.PageMessage = "您输入的用户名或密码不正确!"; return; } string strUser = string.Empty; string strCacheKey = loginUser.EmployeeID.ToString(); strUser = Convert.ToString(Cache[strCacheKey]); SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); IList <SystemUserLogin> objList = objloginBll.GetSystemUserLogin(loginUser.EmployeeID); if (strUser == string.Empty || objList.Count == 0) { TimeSpan SessTimeOut = new TimeSpan(0, 0, System.Web.HttpContext.Current.Session.Timeout, 0, 0); Cache.Insert(strCacheKey, strCacheKey, null, DateTime.MaxValue, SessTimeOut, CacheItemPriority.NotRemovable, null); Session["User"] = strCacheKey; if (objList.Count == 0) { SystemUserLogin objLogin = new SystemUserLogin(); objLogin.EmployeeID = loginUser.EmployeeID; objLogin.IPAddress = Pub.GetRealIP(); objloginBll.DeleteSystemUserLogin(loginUser.EmployeeID); objloginBll.AddSystemUserLogin(objLogin); } } else { SessionSet.PageMessage = "该用户已经登录,不能重复登录!"; return; } PrjPub.CurrentLoginUser = loginUser; PrjPub.CurrentStudent = loginUser; PrjPub.WelcomeInfo = loginUser.OrgName + ":" + loginUser.EmployeeName + ",您好!"; PrjPub.StudentID = loginUser.EmployeeID.ToString(); hfEmployeeID.Value = loginUser.EmployeeID.ToString(); Session["StudentOrdID"] = loginUser.OrgID; SessionSet.UserID = loginUser.UserID; SessionSet.EmployeeID = loginUser.EmployeeID; SessionSet.EmployeeName = loginUser.EmployeeName; SessionSet.OrganizationID = loginUser.OrgID; SessionSet.OrganizationName = loginUser.OrgName; SessionSet.StationOrgID = loginUser.StationOrgID; EmployeeBLL objEmployeeBll = new EmployeeBLL(); OrganizationBLL objOrgBll = new OrganizationBLL(); //控件显示 lblUserName.Text = "姓 名:"; lblOrgName.Text = objOrgBll.GetOrganization(loginUser.StationOrgID).ShortName; lblPassword.Text = "工资编号:"; lblOrg.Text = objEmployeeBll.GetEmployee(loginUser.EmployeeID).WorkNo; lblEmployeeName.Text = loginUser.EmployeeName; lbl.Visible = true; lblPost.Visible = true; lblPost.Text = loginUser.PostName; if (Request.QueryString.Get("Type") == "middle") { ddlOrg.Visible = false; lblOrgName.Visible = true; txtUserName.Visible = false; txtPassword.Visible = false; ImageButtonLogin.Visible = false; btnExit.Visible = true; lblOrg.Visible = true; lblEmployeeName.Visible = true; btnModifyPsw.Visible = true; btnExam.Visible = true; //ClientScript.RegisterStartupScript(GetType(), // "jsSelectFirstNode", // @"ShowExamList();", // true); //ClientScript.RegisterStartupScript(GetType(), "import", "inputCallback.callback('middle');", true); } else if (Request.QueryString.Get("Type") == "right") { ddlOrg.Visible = false; lblOrgName.Visible = true; txtUserName.Visible = false; txtPassword.Visible = false; ImageButtonLogin.Visible = false; btnExit.Visible = true; lblOrg.Visible = true; lblEmployeeName.Visible = true; btnModifyPsw.Visible = true; btnResult.Visible = true; //ClientScript.RegisterStartupScript(GetType(), // "jsSelectFirstNode", // @"ShowResultList();", // true); //ClientScript.RegisterStartupScript(GetType(), "import", "inputCallback.callback('right');", true); } else if (Request.QueryString.Get("Type") == "left") { //将此人的登录次数+1 EmployeeBLL objEmpBll = new EmployeeBLL(); Employee employee = objEmpBll.GetEmployee(loginUser.EmployeeID); employee.LoginCount = employee.LoginCount + 1; if (PrjPub.IsServerCenter) { objEmpBll.UpdateEmployee(employee); } else { objEmpBll.UpdateEmployeeInStation(employee); } ddlOrg.Visible = false; lblOrgName.Visible = true; txtUserName.Visible = false; txtPassword.Visible = false; ImageButtonLogin.Visible = false; btnExit.Visible = true; lblOrg.Visible = true; lblEmployeeName.Visible = true; btnModifyPsw.Visible = true; btnExam.Visible = false; btnStudy.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { string type = Request.QueryString.Get("type1"); if (type == "StudySelected") { this.btnStudy.Visible = false; } else { if (Request.QueryString.Get("Type") == "middle" && Request.QueryString.Get("IsFinger") == "1")//!PrjPub.IsServerCenter && { string errorMessage = ""; string mac_dest = ""; try { mac_dest = GetCustomerMac(GetClientIP()); } catch { errorMessage = "无法获取客户端MAC地址!"; mac_dest = ""; } //errorMessage = mac_dest; //mac_dest = ""; string employeeId = ""; string examId = ""; lblMAC.Text = mac_dest; if (!string.IsNullOrEmpty(mac_dest)) { string strSql = "select * from Computer_Room_Detail" + " where MAC_Address='" + mac_dest + "'"; OracleAccess db = new OracleAccess(); DataSet ds = db.RunSqlDataSet(strSql); if (ds.Tables[0].Rows.Count > 0) { string computerId = ds.Tables[0].Rows[0]["Computer_Room_ID"].ToString(); string computerSeat = ds.Tables[0].Rows[0]["Computer_Room_Seat"].ToString(); strSql = "select * from Random_Exam_Result_Detail_Temp " + " where Computer_Room_ID=" + computerId + " and Computer_Room_Seat=" + computerSeat + " and FingerPrint is not null and Is_Remove=0"; DataSet dsResult = db.RunSqlDataSet(strSql); if (dsResult.Tables[0].Rows.Count > 0) { employeeId = dsResult.Tables[0].Rows[0]["Employee_ID"].ToString(); examId = dsResult.Tables[0].Rows[0]["Random_Exam_ID"].ToString(); strSql = "select a.* from System_User a " + " inner join Employee b on a.Employee_ID=b.Employee_ID " + " where a.Employee_ID=" + employeeId; DataSet dsSystem = db.RunSqlDataSet(strSql); LoginUserBLL loginUserBLL = new LoginUserBLL(); LoginUser loginUser; if (dsSystem.Tables[0].Rows.Count > 0) { loginUser = loginUserBLL.GetLoginUser(dsSystem.Tables[0].Rows[0]["User_ID"].ToString(), dsSystem.Tables[0].Rows[0]["Password"].ToString(), 1); } else { strSql = "select * from Employee " + " where Employee_ID=" + employeeId; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; string strUserId; if (dr["Work_No"] == DBNull.Value) { strUserId = dr["Identity_CardNo"].ToString(); } else { strUserId = dr["Work_No"].ToString(); } strSql = "insert into System_User values(" + "'" + strUserId + "','111111'," + employeeId + ",0,null)"; db.ExecuteNonQuery(strSql); //strSql = "begin dbms_mview.refresh('System_User','?'); end;"; //db.ExecuteNonQuery(strSql); loginUser = loginUserBLL.GetLoginUser(strUserId, "111111", 1); } if (string.IsNullOrEmpty(Request.QueryString.Get("type1"))) { string strUser = string.Empty; string strCacheKey = loginUser.EmployeeID.ToString(); strUser = Convert.ToString(Cache[strCacheKey]); SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); IList <SystemUserLogin> objList = objloginBll.GetSystemUserLogin(loginUser.EmployeeID); if (strUser == string.Empty || objList.Count == 0) { TimeSpan SessTimeOut = new TimeSpan(0, 0, System.Web.HttpContext.Current.Session.Timeout, 0, 0); Cache.Insert(strCacheKey, strCacheKey, null, DateTime.MaxValue, SessTimeOut, CacheItemPriority.NotRemovable, null); Session["User"] = strCacheKey; if (objList.Count == 0) { SystemUserLogin objLogin = new SystemUserLogin(); objLogin.EmployeeID = loginUser.EmployeeID; objLogin.IPAddress = Pub.GetRealIP(); objloginBll.DeleteSystemUserLogin(loginUser.EmployeeID); objloginBll.AddSystemUserLogin(objLogin); } } } PrjPub.CurrentStudent = loginUser; PrjPub.WelcomeInfo = loginUser.OrgName + ":" + loginUser.EmployeeName + ",您好!"; PrjPub.StudentID = loginUser.EmployeeID.ToString(); hfEmployeeID.Value = loginUser.EmployeeID.ToString(); Session["StudentOrdID"] = loginUser.OrgID; SessionSet.UserID = loginUser.UserID; SessionSet.EmployeeID = loginUser.EmployeeID; SessionSet.EmployeeName = loginUser.EmployeeName; SessionSet.OrganizationID = loginUser.OrgID; SessionSet.OrganizationName = loginUser.OrgName; SessionSet.StationOrgID = loginUser.StationOrgID; OrganizationBLL objOrgBll = new OrganizationBLL(); //控件显示 lblUserName.Text = "姓 名:" + DateTime.Now; lblOrg.Text = objOrgBll.GetOrganization(loginUser.StationOrgID).ShortName; lblPassword.Text = "单 位:"; lblEmployeeName.Text = loginUser.EmployeeName; trCard.Visible = false; lbl.Visible = true; lblPost.Visible = true; lblPost.Text = loginUser.PostName; txtUserName.Visible = false; txtPassword.Visible = false; ImageButtonLogin.Visible = false; btnExit.Visible = true; lblOrg.Visible = true; lblEmployeeName.Visible = true; //btnModifyPsw.Visible = true; btnExam.Visible = true; } } //else //{ // errorMessage = "系统中不存在当前客户端的MAC地址!"; //} } ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"ShowStudentExam('" + errorMessage + "','" + employeeId + "','" + examId + "');", true); } } lbl1.Text = "员工编码:"; }
private void SaveAnswerToDB(string strAnswer) { string strId = Request.QueryString.Get("id"); RandomExamItemBLL randomItemBLL = new RandomExamItemBLL(); RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL(); RailExam.Model.RandomExamResultCurrent objResultCurrent = objResultCurrentBll.GetNowRandomExamResultInfo(Convert.ToInt32(ViewState["EmployeeID"].ToString()), Convert.ToInt32(strId)); //更新考试成绩表时传入的主键应为站段的成绩表的主键ID objResultCurrent.RandomExamResultId = int.Parse(ViewState["RandomExamResultID"].ToString()); objResultCurrent.RandomExamId = int.Parse(strId); objResultCurrent.AutoScore = 0; objResultCurrent.CurrentDateTime = DateTime.Parse(ViewState["EndTime"].ToString()); objResultCurrent.ExamTime = Convert.ToInt32(ViewState["LastExamTime"].ToString()) + GetSecondBetweenTwoDate(DateTime.Parse(ViewState["EndTime"].ToString()), DateTime.Parse(ViewState["BeginTime"].ToString())); objResultCurrent.EndDateTime = DateTime.Parse(ViewState["EndTime"].ToString()); objResultCurrent.Score = 0; objResultCurrent.OrganizationId = int.Parse(ViewState["OrgID"].ToString()); objResultCurrent.Memo = ""; objResultCurrent.StatusId = 2; objResultCurrent.AutoScore = 0; objResultCurrent.CorrectRate = 0; objResultCurrent.ExamineeId = int.Parse(ViewState["EmployeeID"].ToString()); string[] str1 = strAnswer.Split(new char[] { '$' }); RandomExamResultAnswerCurrentBLL randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL(); //randomExamResultAnswerBLL.DeleteExamResultAnswerCurrent(Convert.ToInt32(ViewState["RandomExamResultID"].ToString())); //IList<RandomExamResultAnswerCurrent> randomExamResultAnswers = new List<RandomExamResultAnswerCurrent>(); int randomExamResultId = int.Parse(ViewState["RandomExamResultID"].ToString()); for (int n = 0; n < str1.Length; n++) { string str2 = str1[n].ToString(); string[] str3 = str2.Split(new char[] { '|' }); string strPaperItemId = str3[0].ToString(); string strTrueAnswer = str2.ToString().Substring(strPaperItemId.Length + 1); RandomExamResultAnswerCurrent randomExamResultAnswer = new RandomExamResultAnswerCurrent(); randomExamResultAnswer.RandomExamResultId = randomExamResultId; randomExamResultAnswer.RandomExamItemId = int.Parse(strPaperItemId); randomExamResultAnswer.JudgeStatusId = 0; randomExamResultAnswer.JudgeRemark = string.Empty; randomExamResultAnswer.ExamTime = 0; randomExamResultAnswer.Answer = strTrueAnswer; //randomExamResultAnswers.Add(randomExamResultAnswer); randomExamResultAnswerBLL.UpdateExamResultAnswerCurrent(randomExamResultAnswer); } try { //将更新答卷信息 //randomExamResultAnswerBLL.AddExamResultAnswerCurrentSave(randomExamResultId, randomExamResultAnswers); //更新实时考试记录 objResultCurrentBll.UpdateRandomExamResultCurrent(objResultCurrent); //获取最后考试成绩 //RandomExamResultCurrent randomExamResultCurrent = objResultCurrentBll.GetRandomExamResult(Convert.ToInt32(ViewState["RandomExamResultID"].ToString())); //decimal nowScore = randomExamResultCurrent.Score; //将实时考试记录(临时表)转存到正式考试成绩表和答卷表 RandomExamResultBLL objResultBll = new RandomExamResultBLL(); //int randomExamResultID = objResultBll.RemoveResultAnswer(Convert.ToInt32(ViewState["RandomExamResultID"].ToString())); //将实时考试记录(临时表)转存到中间考试成绩表和答卷表 int randomExamResultID = objResultBll.RemoveResultAnswerCurrent(Convert.ToInt32(ViewState["RandomExamResultID"].ToString())); //删除登录信息 SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); objloginBll.DeleteSystemUserLogin(Convert.ToInt32(ViewState["EmployeeID"].ToString())); Response.Write("<script>window.parent.parent.location = '/RailExamBao/Online/Exam/ExamSuccess.aspx?ExamType=1&ExamResultID=" + randomExamResultID + "'</script>"); } catch { SystemUserLoginBLL objloginBll = new SystemUserLoginBLL(); objloginBll.DeleteSystemUserLogin(Convert.ToInt32(ViewState["EmployeeID"].ToString())); string strSql = "update Random_Exam_Result_Current set Exam_Time=Exam_Time-180 where Random_Exam_ID=" + strId + " and Examinee_ID=" + ViewState["EmployeeID"]; OracleAccess db = new OracleAccess(); db.ExecuteNonQuery(strSql); Response.Write("<script>window.parent.parent.location = '/RailExamBao/Common/OtherError.aspx?error=提交试卷失败,请重新进入考试再次进行提交'</script>"); } //如果在站段是随到随考考试,成绩自动上传至路局 //if(ViewState["NowStartMode"].ToString() == PrjPub.START_MODE_NO_CONTROL.ToString() && !PrjPub.IsServerCenter) //{ // objResultBll.RemoveRandomExamResultToServer(Convert.ToInt32(strId), Convert.ToInt32(ConfigurationManager.AppSettings["StationID"])); //} }