/// <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(); }
public string CheckUser(string loginId, string password) { try { if (string.IsNullOrEmpty(loginId)) { return(null); } Users_ALL dalUser_All = new Users_ALL(); string strWhere = "LoginId=@loginId"; SqlParameter[] parameters = { new SqlParameter("@loginId", loginId) }; DataSet ds = dalUser_All.GetList(strWhere, parameters); if (ds.Tables[0].Rows.Count > 0) { ClassModel.UserInfo userInfo = new ClassModel.UserInfo(); userInfo.LoginId = ds.Tables[0].Rows[0]["LoginID"].ToString(); userInfo.Password = ds.Tables[0].Rows[0]["UsrPwd"].ToString(); userInfo.IsUsing = (LogStatus)int.Parse(ds.Tables[0].Rows[0]["UsrEnabled"].ToString()); if (userInfo.Password.Equals(SeatManageComm.MD5Algorithm.GetMD5Str32(password)) && userInfo.IsUsing == LogStatus.Valid) { return(userInfo.LoginId); } else { return(""); } } else { return(""); } } catch (Exception ex) { throw ex; } }
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; } }