/// <summary> /// 登录验证密码 /// </summary> /// <param name="account"></param> /// <param name="passWord"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoCheckPsw(string account, string passWord, out string retmsg, out int StateCodeID) { int res = -1; //#if DEBUG // if (account == "1") // { // res = 0; // StateCodeID = 0; // Global.userMsgData.UserPermission = int.Parse(account); // retmsg = "调试状态,普通用户账号!"; // } // else if (account == "2") // { // res = 0; // StateCodeID = 0; // Global.userMsgData.UserPermission = int.Parse(account); // retmsg = "调试状态,管理员账号!"; // } // else // { // retmsg = "调试状态,无此账号!"; // StateCodeID = -1; // } // return res; //#endif try { StateCodeID = -1; WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.Login(account, passWord)); retmsg = retres.Description; StateCodeID = retres.StateCodeID; if (retres.IsOK) { try { Global.userMsgData.UserPermission = int.Parse(retres.ExtData); } catch { throw new Exception("用户权限解析错误"); } res = 0; } } catch (Exception ex) { retmsg = ex.Message; StateCodeID = -1; throw; } return(res); }
/// <summary> /// 注销登录 /// </summary> /// <param name="account"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoLogout(string account, out string retmsg) { int res = -1; try { WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.UpdateOnLineStatus(account)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 创建用户信息 /// </summary> /// <param name="data"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoDelUserInfo(string data, out string retmsg) { int res = -1; try { WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.DeleteAccount(data)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 创建用户信息 /// </summary> /// <param name="data"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoCreateUserInfo(CommonData.UserMsgData data, out string retmsg) { int res = -1; try { WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.CreateAccount(data.Account, data.PassWord, data.UserName, data.FailureDateTime.ToString(), data.UserTel, data.UserPermission.ToString(), data.StateCode.ToString(), data.FilePermission)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 修改密码 /// </summary> /// <param name="account"></param> /// <param name="oldpsd"></param> /// <param name="newpsd"></param> /// <param name="retmsg"></param> /// <returns></returns> public static int DoChangePsd(string account, string oldpsd, string newpsd, out string retmsg) { int res = -1; try { WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.ChangePassword(account, oldpsd, newpsd)); retmsg = retres.Description; if (retres.IsOK) { res = 0; } } catch (Exception ex) { retmsg = ex.Message; throw; } return(res); }
/// <summary> /// 根据账号获取用户信息(若账号为空,获取全部用户信息) /// </summary> /// <param name="account"></param> /// <param name="retmsg"></param> /// <param name="userList">返回的用户信息列表</param> /// <returns></returns> public static int DoGetInfoByAccount(string account, out string retmsg, out List <CommonData.UserMsgData> userList) { int res = -1; try { WRLogin.LoginWebService ws = new WRLogin.LoginWebService(); RecvRes retres = TransRes(ws.GetInfoByAccount(account)); retmsg = retres.Description; //userList = null; if (retres.IsOK) { if (!string.IsNullOrEmpty(retres.ExtData)) { string jsondata = retres.ExtData; userList = JsonDeal.JsonData2UserMsgListData(jsondata); res = 0; } else { throw new Exception("accpect extData is null"); } res = 0; } else { userList = null; } } catch (Exception ex) { retmsg = ex.Message; userList = null; throw; } return(res); }