/// <summary> /// 得到GM帐号信息类 /// </summary> /// <param name="userID">用户ID</param> /// <returns>GM帐号类</returns> public Message GM_QuerySysAdminInfo(int userID) { //int sysAdmin = -1; System.Data.DataSet ds = null; try { //将GM帐号信息存入DATASET ds = GMUserInfo.getUserInfo(userID); Query_Structure[] structList = new Query_Structure[1]; if(ds!=null && ds.Tables[0].Rows.Count>0) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[0].ItemArray.Length); strut.AddTagKey(TagName.SysAdmin,TagFormat.TLV_INTEGER,4,TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER,ds.Tables[0].Rows[0].ItemArray[9])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER,ds.Tables[0].Rows[0].ItemArray[5]); strut.AddTagKey(TagName.DepartID,TagFormat.TLV_INTEGER,(uint)bytes.Length,bytes); structList[0] = strut; return Message.COMMON_MES_RESP(structList,Msg_Category.USER_ADMIN,ServiceKey.USER_SYSADMIN_QUERY_RESP,2); } else { return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoAdmin,Msg_Category.USER_ADMIN,ServiceKey.USER_SYSADMIN_QUERY_RESP,TagName.ERROR_Msg,TagFormat.TLV_STRING); } } catch(System.Exception ex) { return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoAdmin,Msg_Category.USER_ADMIN,ServiceKey.USER_SYSADMIN_QUERY_RESP,TagName.ERROR_Msg,TagFormat.TLV_STRING); } }
/// <summary> /// 验证GM帐号有效性 /// </summary> /// <param name="userName">用户名</param> /// <param name="password">密码</param> public int GM_ValidateUser(string userName,string password,string MAC) { int result = -1; try { result = GMUserInfo.getUserInfo(userName,password,MAC); } catch(System.Exception) { } return result; }
/// <summary> /// 得到GM帐号信息类 /// </summary> /// <param name="userID">用户ID</param> /// <returns>GM帐号类</returns> public GMUserInfo GM_QueryUserInfo(int userID) { System.Data.DataSet ds = null; GMUserInfo userInfo = null; try { //将GM帐号信息存入DATASET ds = GMUserInfo.getUserInfo(userID); //构造一个用户名和密码的信息类 userInfo = new GMUserInfo(ds.Tables[0].Rows[0].ItemArray[0].ToString(),ds.Tables[0].Rows[0].ItemArray[1].ToString()); } catch(System.Exception ex) { Console.WriteLine(ex.Message); } return userInfo; }