protected void Page_Load(object sender, EventArgs e) { string signkey = Request.QueryString["signkey"]; string uid = Request.QueryString["uid"]; string loginOkUrl = Request.QueryString["url"]; if (string.IsNullOrEmpty(loginOkUrl)) { loginOkUrl = "MainFunctionPage.aspx"; } if (LoginUserInfo != null) { Response.Redirect(loginOkUrl); return; } if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(signkey)) { Response.Redirect(LogoutUrl()); return; } string md5string = uid + cxKey + DateTime.UtcNow.ToString("yyyyMMddHH"); if (signkey == MD5Algorithm.GetMD5Str32(md5string)) { if (loginHandle(uid)) { Response.Redirect(loginOkUrl); } } Response.Redirect(loginOkUrl); }
/// <summary> /// 激活预约操作 /// </summary> /// <param name="cardNo"></param> void activeBespeak(string cardNo) { if (string.IsNullOrEmpty(cardNo)) { return; } ReaderInfo reader = EnterOutOperate.GetSimpleReaderInfo(cardNo); UserInfo user = Users_ALL.GetUserInfo(cardNo); if (user != null) { if (user.IsUsing == SeatManage.EnumType.LogStatus.Valid) //判断用户状态是否启用。 { ActivationClose formBespeakClose = new ActivationClose(); //启用中,则提示取消 this.countdown.Pause(); formBespeakClose.ShowDialog(); this.countdown.Start(); if (formBespeakClose.IsSure) { user.IsUsing = SeatManage.EnumType.LogStatus.Fail;// user.Remark = "终端刷卡注销"; Users_ALL.UpdateUserOnlyInfo(user); } } else {//如果读者用户状态是失效,则重新激活。 user.IsUsing = SeatManage.EnumType.LogStatus.Valid; user.Password = MD5Algorithm.GetMD5Str32(cardNo); user.Remark = "终端刷卡重新激活"; if (Users_ALL.UpdateUserOnlyInfo(user)) { ActivationSuccess successFrom = new ActivationSuccess(user.LoginId, cardNo); successFrom.ShowDialog(); } } } else { UserInfo newUser = new UserInfo(); newUser.IsUsing = SeatManage.EnumType.LogStatus.Valid; newUser.LoginId = cardNo; newUser.Password = MD5Algorithm.GetMD5Str32(cardNo); newUser.UserType = SeatManage.EnumType.UserType.Reader; newUser.UserName = reader == null ? "" : reader.Name; newUser.Remark = "在终端刷卡激活"; if (Users_ALL.AddNewUser(newUser)) { ActivationSuccess successFrom = new ActivationSuccess(newUser.LoginId, cardNo); successFrom.ShowDialog(); } } this.countdown.Stop(); this.Close(); }
/// <summary> /// 验证客户端连接权限 /// </summary> /// <param name="myHeader"></param> /// <param name="isCheckSchool"></param> /// <returns></returns> public bool CheckSoapHeader(MySoapHeader myHeader, bool isCheckSchool) { return(true); if (!myHeader.UserName.Equals(soapUserName) || !MD5Algorithm.GetMD5Str32(myHeader.PassWord).Equals(soapPwd)) { return(false); } if (!isCheckSchool) { return(true); } AMS.Model.AMS_School school = AMS.ServiceProxy.AMS_SchoolProxy.GetSchoolInfoByNum(myHeader.SchoolNum); return(school != null && school.AppOpen); }
/// <summary> /// 获取新旧list /// </summary> /// <param name="newDS"></param> /// <param name="userDS"></param> /// <param name="syncPW"></param> public void GetList(DataTable newDS, DataTable userDS, bool syncPW) { oldList = new List <UserInfo>(); newList = new List <UserInfo>(); foreach (DataRow dr in newDS.Rows) { int i = 1; UserInfo userInfo = new UserInfo(); userInfo.LoginId = dr["CardNo"].ToString(); if (string.IsNullOrEmpty(dr["Password"].ToString())) { continue; } userInfo.Password = syncPW ? dr["Password"].ToString() : MD5Algorithm.GetMD5Str32(dr["Password"].ToString()); userInfo.UserType = UserType.Reader; userInfo.UserName = dr["ReaderName"].ToString(); userInfo.IsUsing = LogStatus.Valid; userInfo.Remark = "同步程序自动激活"; userInfo.LockIPAdress = ""; newList.Add(userInfo); if ((i % 100 == 0 || i == newDS.Rows.Count) && DataProgress != null) { DataProgress(newList.Count); } i++; } foreach (DataRow dr in userDS.Rows) { int i = 1; UserInfo userInfo = new UserInfo(); userInfo.LoginId = dr["LoginID"].ToString(); userInfo.Password = dr["UsrPwd"].ToString(); userInfo.UserType = (UserType)int.Parse(dr["UsrType"].ToString()); userInfo.UserName = dr["UsrName"].ToString(); userInfo.IsUsing = (LogStatus)int.Parse(dr["UsrEnabled"].ToString()); userInfo.Remark = dr["Remark"].ToString(); if (dr["IPLockIPAdress"] != null) { userInfo.LockIPAdress = dr["IPLockIPAdress"].ToString(); } oldList.Add(userInfo); if ((i % 100 == 0 || i == userDS.Rows.Count) && DataProgress != null) { DataProgress(newList.Count); } i++; } }
/// <summary> /// 用户登录 /// </summary> /// <param name="loginId">登录账号</param> /// <param name="password">登录密码</param> /// <returns></returns> public string CheckUser(string loginId, string password) { AJM_HandleResult result = new AJM_HandleResult(); try { if (string.IsNullOrEmpty(loginId.Trim()) || string.IsNullOrEmpty(password.Trim())) { result.Result = false; result.Msg = "用户名或密码不能为空!"; return(JSONSerializer.Serialize(result)); } UserInfo userInfo = seatManageDateService.GetUserInfo(loginId); if (userInfo == null) { result.Result = false; result.Msg = "用户名或密码错误!"; return(JSONSerializer.Serialize(result)); } string md5Password = MD5Algorithm.GetMD5Str32(password); if (!md5Password.Equals(userInfo.Password)) { result.Result = false; result.Msg = "用户名或密码错误!"; return(JSONSerializer.Serialize(result)); } AJM_Reader ajmReader = new AJM_Reader { StudentNo = userInfo.LoginId, Name = userInfo.UserName }; result.Result = true; result.Msg = JSONSerializer.Serialize(ajmReader); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("登录出现异常:{0}", ex.Message)); result.Result = false; result.Msg = "执行登录操作遇到异常"; return(JSONSerializer.Serialize(result)); } }
public void ActiveBook() { try { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ActivationReadCard); if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule == HandleResult.Successed) { ClientObject.EnterOutLogData = new OperateResult.OperateResult(); ClientObject.EnterOutLogData.Student = EnterOutOperate.GetReaderInfo(PopupWindowsObject.GetInstance().Window.ViewModel.CardNo); if (ClientObject.EnterOutLogData.Student == null) { ClientObject.EnterOutLogData.Student = new SeatManage.ClassModel.ReaderInfo() { CardNo = PopupWindowsObject.GetInstance().Window.ViewModel.CardNo }; } SeatManage.ClassModel.UserInfo user = Users_ALL.GetUserInfo(PopupWindowsObject.GetInstance().Window.ViewModel.CardNo); if (user != null) { if (user.IsUsing == LogStatus.Valid)//判断用户状态是否启用。 { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.CancelActivationWarn); if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule == HandleResult.Successed) { user.IsUsing = LogStatus.Fail;// user.Remark = "终端刷卡注销"; Users_ALL.UpdateUserOnlyInfo(user); PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.CancelActivationSuccess); } } else {//如果读者用户状态是失效,则重新激活。 user.IsUsing = LogStatus.Valid; user.Password = MD5Algorithm.GetMD5Str32(PopupWindowsObject.GetInstance().Window.ViewModel.CardNo); user.Remark = "终端刷卡重新激活"; if (Users_ALL.UpdateUserOnlyInfo(user)) { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ActivationSuccess); } } } else { SeatManage.ClassModel.UserInfo newUser = new SeatManage.ClassModel.UserInfo(); newUser.IsUsing = LogStatus.Valid; newUser.LoginId = PopupWindowsObject.GetInstance().Window.ViewModel.CardNo; newUser.Password = MD5Algorithm.GetMD5Str32(PopupWindowsObject.GetInstance().Window.ViewModel.CardNo); newUser.UserType = UserType.Reader; newUser.UserName = ClientObject.EnterOutLogData.Student == null ? "" : ClientObject.EnterOutLogData.Student.Name; newUser.Remark = "在终端刷卡激活"; if (Users_ALL.AddNewUser(newUser)) { PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ActivationSuccess); } } //预约激活处理 } } catch (Exception ex) { WriteLog.Write("预约激活遇到异常" + ex.Message); PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception); } finally { ClientObject.EnterOutLogData = null; } }
public void ActiveBook() { try { ActivationWindow activationWindow = new ActivationWindow(); activationWindow.ShowDialog(); if (activationWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed) { clientObject.EnterOutLogData = new OperateResult.OperateResult(); clientObject.EnterOutLogData.Student = SeatManage.Bll.EnterOutOperate.GetReaderInfo(activationWindow.viewModel.CardNo); if (clientObject.EnterOutLogData.Student == null) { clientObject.EnterOutLogData.Student = new SeatManage.ClassModel.ReaderInfo() { CardNo = activationWindow.viewModel.CardNo }; } SeatManage.ClassModel.UserInfo user = SeatManage.Bll.Users_ALL.GetUserInfo(activationWindow.viewModel.CardNo); if (user != null) { if (user.IsUsing == SeatManage.EnumType.LogStatus.Valid) //判断用户状态是否启用。 { MessageWindow DeactivationComfrimWindow = new MessageWindow(MessageType.DeactivationComfrim); //启用中,则提示取消 DeactivationComfrimWindow.ShowDialog(); if (DeactivationComfrimWindow.viewModel.OperateResule == HandleResult.Successed) { user.IsUsing = SeatManage.EnumType.LogStatus.Fail;// user.Remark = "终端刷卡注销"; SeatManage.Bll.Users_ALL.UpdateUserOnlyInfo(user); MessageWindow activeCloseWindow = new MessageWindow(MessageType.DeactivationSuccess);//启用中,则提示取消 activeCloseWindow.ShowDialog(); } } else {//如果读者用户状态是失效,则重新激活。 user.IsUsing = SeatManage.EnumType.LogStatus.Valid; user.Password = MD5Algorithm.GetMD5Str32(activationWindow.viewModel.CardNo); user.Remark = "终端刷卡重新激活"; if (SeatManage.Bll.Users_ALL.UpdateUserOnlyInfo(user)) { MessageWindow activeSuccessWindow = new MessageWindow(MessageType.ActivationSuccess);//启用中,则提示取消 activeSuccessWindow.ShowDialog(); } } } else { SeatManage.ClassModel.UserInfo newUser = new SeatManage.ClassModel.UserInfo(); newUser.IsUsing = SeatManage.EnumType.LogStatus.Valid; newUser.LoginId = activationWindow.viewModel.CardNo; newUser.Password = MD5Algorithm.GetMD5Str32(activationWindow.viewModel.CardNo); newUser.UserType = SeatManage.EnumType.UserType.Reader; newUser.UserName = clientObject.EnterOutLogData.Student == null ? "" : clientObject.EnterOutLogData.Student.Name; newUser.Remark = "在终端刷卡激活"; if (SeatManage.Bll.Users_ALL.AddNewUser(newUser)) { MessageWindow activeSuccessWindow = new MessageWindow(MessageType.ActivationSuccess);//启用中,则提示取消 activeSuccessWindow.ShowDialog(); } } //预约激活处理 } } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write("预约激活遇到异常" + ex.Message); MessageWindow errorWindow = new MessageWindow(MessageType.Exception); errorWindow.ShowDialog(); } finally { clientObject.EnterOutLogData = null; } }