/// <summary> /// 获取用户的基本信息 /// </summary> /// <param name="studentNo">学号</param> /// <returns></returns> public string GetUserInfo(string studentNo) { AJM_HandleResult result = new AJM_HandleResult(); try { ReaderInfo reader = seatManageDateService.GetReader(studentNo, false); if (reader == null) { result.Result = false; result.Msg = "对不起,不存在该读者信息!"; return(JSONSerializer.Serialize(result)); } AJM_Reader ajmReader = new AJM_Reader(); ajmReader.CardId = reader.CardID; ajmReader.StudentNo = reader.CardNo; ajmReader.Name = reader.Name; ajmReader.Sex = reader.Sex; ajmReader.Department = reader.Pro; ajmReader.ReaderType = reader.ReaderType; 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)); } }
/// <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)); } }
/// <summary> /// 获取读者信息 /// </summary> /// <param name="cardNo"></param> /// <param name="schoolNo"></param> /// <returns></returns> public AJM_Reader GetReaderInfo(string cardNo, string schoolNo) { try { IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo); string result = appService.GetUserInfo(cardNo); AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result); if (ajmResult == null) { throw new Exception("获取读者信息失败!"); } if (!ajmResult.Result) { throw new Exception(ajmResult.Msg); } AJM_Reader ajm_reader = JSONSerializer.Deserialize <AJM_Reader>(ajmResult.Msg); return(ajm_reader); } catch (Exception ex) { WriteLog.Write("获取读者信息失败:" + ex.Message); return(null); } }
/// <summary> /// 获取读者信息 /// </summary> /// <param name="loginId"></param> /// <param name="password"></param> /// <param name="schoolNo"></param> /// <returns></returns> public AJM_Reader CheckReader(string loginId, string password, string schoolNo) { try { IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo); string result = appService.CheckUser(loginId, password); AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result); if (ajmResult == null) { throw new Exception("验证读者信息失败!"); } if (!ajmResult.Result) { ajmResult = null; throw new Exception(ajmResult.Msg); } result = appService.GetUserInfo(loginId); ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result); if (ajmResult == null) { throw new Exception("验证读者信息失败!"); } if (!ajmResult.Result) { ajmResult = null; throw new Exception(ajmResult.Msg); } AJM_Reader ajmReader = JSONSerializer.Deserialize <AJM_Reader>(ajmResult.Msg); return(ajmReader); } catch (Exception ex) { WriteLog.Write("验证读者信息失败:" + ex.Message); return(null); } }