示例#1
0
        /// <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);
        }