/// <summary> /// 得到所有模块信息 /// </summary> /// <returns>模块数据集</returns> public Message GM_QueryAll(int index, int pageSize) { GMLogAPI logAPI = new GMLogAPI(); DataSet ds = null; try { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_ModuleInfoAPI_ModuleList, LanguageAPI.API_Display + LanguageAPI.API_ModuleInfoAPI_ModuleList); logAPI.writeContent(LanguageAPI.API_GameInfoAPI_ModuleID, LanguageAPI.API_GameInfoAPI_ModuleTitle, LanguageAPI.API_GameInfoAPI_ModuleClass, LanguageAPI.API_GameInfoAPI_ModuleDesp); ds = GMModuleInfo.SelectAll(); if (ds.Tables[0].Rows.Count <= 0) { return(Message.COMMON_MES_RESP(LanguageAPI.API_ModuleInfoAPI_NoModuleList, Msg_Category.MODULE_ADMIN, ServiceKey.MODULE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } else { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure(7); strut.AddTagKey(TagName.GameID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Module_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[1])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.GameName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.ModuleName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[4]); strut.AddTagKey(TagName.ModuleClass, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.ModuleContent, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[1].ToString(), ds.Tables[0].Rows[i].ItemArray[2].ToString(), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.MODULE_ADMIN, ServiceKey.MODULE_QUERY_RESP, 7)); } } catch (SqlException ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(ex.Message, Msg_Category.MODULE_ADMIN, ServiceKey.MODULE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 得到所有游戏信息 /// </summary> /// <returns>游戏数据集</returns> public Message GM_QueryAll() { GMLogAPI logAPI = new GMLogAPI(); DataSet ds = null; try { ds = GMGameInfo.SelectAll(); logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_GameInfoAPI_GameList, LanguageAPI.API_Display + LanguageAPI.API_GameInfoAPI_GameList); logAPI.writeContent(LanguageAPI.API_GameInfoAPI_GameID, LanguageAPI.API_GameInfoAPI_GameTitle, LanguageAPI.API_GameInfoAPI_GameDesp); Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0]); strut.AddTagKey(TagName.GameID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.GameName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.GameContent, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); structList[i] = strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[0].ToString(), ds.Tables[0].Rows[i].ItemArray[1].ToString(), ds.Tables[0].Rows[i].ItemArray[2].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.GAME_ADMIN, ServiceKey.GAME_QUERY_RESP, 3)); } catch (Common.Logic.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
/// <summary> /// 请求所有游戏服务器IP列表 /// </summary> /// <returns></returns> public Message packCreateServerInfoResp() { int result = -1; int operateUserID = 0; int gameID = 0; int gameDBID = 0; string gameIP = null; string gameCity = null; int gameFlag = 0; GMLogAPI logAPI = new GMLogAPI(); try { TLV_Structure strut = new TLV_Structure(TagName.UserByID, 4, message.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); operateUserID = (int)strut.toInteger(); strut = new TLV_Structure(TagName.ServerInfo_GameID, 4, message.m_packet.m_Body.getTLVByTag(TagName.ServerInfo_GameID).m_bValueBuffer); gameID = (int)strut.toInteger(); strut = new TLV_Structure(TagName.ServerInfo_GameDBID, 4, message.m_packet.m_Body.getTLVByTag(TagName.ServerInfo_GameDBID).m_bValueBuffer); gameDBID = (int)strut.toInteger(); gameIP = System.Text.Encoding.Default.GetString(message.m_packet.m_Body.getTLVByTag(TagName.ServerInfo_IP).m_bValueBuffer); gameCity = System.Text.Encoding.Default.GetString(message.m_packet.m_Body.getTLVByTag(TagName.ServerInfo_City).m_bValueBuffer); userName = System.Text.Encoding.Default.GetString(message.m_packet.m_Body.getTLVByTag(TagName.UserName).m_bValueBuffer); PassWord = System.Text.Encoding.Default.GetString(message.m_packet.m_Body.getTLVByTag(TagName.PassWord).m_bValueBuffer); strut = new TLV_Structure(TagName.ServerInfo_GameFlag, 4, message.m_packet.m_Body.getTLVByTag(TagName.ServerInfo_GameFlag).m_bValueBuffer); gameFlag = (int)strut.toInteger(); result = CommonInfo.LinkServerIP_Create(operateUserID, gameIP, UserName, PassWord, gameCity, gameID, gameDBID, gameFlag); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Add + LanguageAPI.API_CommonAPI_NewServer, LanguageAPI.API_Add + LanguageAPI.API_CommonAPI_NewServer + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_CommonAPI_GameID, LanguageAPI.API_CommonAPI_ServerIP, LanguageAPI.API_CommonAPI_GameCity); logAPI.writeContent(Convert.ToString(gameID), gameIP, gameCity); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("SUCESS", Msg_Category.COMMON, ServiceKey.LINK_SERVERIP_CREATE_RESP)); } else { logAPI.writeTitle(LanguageAPI.API_Add + LanguageAPI.API_CommonAPI_NewServer, LanguageAPI.API_Add + LanguageAPI.API_CommonAPI_NewServer + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_CommonAPI_GameID, LanguageAPI.API_CommonAPI_ServerIP, LanguageAPI.API_CommonAPI_GameCity); logAPI.writeContent(Convert.ToString(gameID), gameIP, gameCity); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.COMMON, ServiceKey.LINK_SERVERIP_CREATE_RESP)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.COMMON, ServiceKey.LINK_SERVERIP_CREATE_RESP)); } }
/// <summary> /// 更新一个模块信息 /// </summary> public Message GM_UpdateModuleInfo() { int result = -1; int moduleID = 0; int gameID = 0; int operateUserID = 0; string moduleName = null; string moduleClass = null; string moduleContent = null; GMModuleInfo moduleInfo = null; GMLogAPI logAPI = new GMLogAPI(); try { TLV_Structure tlvStrut = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); operateUserID = (int)tlvStrut.toInteger(); tlvStrut = new TLV_Structure(TagName.GameID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.GameID).m_bValueBuffer); gameID = (int)tlvStrut.toInteger(); tlvStrut = new TLV_Structure(TagName.Module_ID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.Module_ID).m_bValueBuffer); moduleID = (int)tlvStrut.toInteger(); moduleName = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.ModuleName).m_bValueBuffer); moduleClass = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.ModuleClass).m_bValueBuffer); moduleContent = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.ModuleContent).m_bValueBuffer); moduleInfo = new GMModuleInfo(gameID, moduleID, moduleName, moduleClass, moduleContent); result = moduleInfo.updateRow(operateUserID, moduleID); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Delete + LanguageAPI.API_ModuleInfoAPI_ModuleInfo, LanguageAPI.API_Delete + LanguageAPI.API_ModuleInfoAPI_ModuleInfo + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_GameInfoAPI_GameID, LanguageAPI.API_GameInfoAPI_ModuleTitle, LanguageAPI.API_GameInfoAPI_ModuleClass, LanguageAPI.API_GameInfoAPI_ModuleDesp); logAPI.writeContent(Convert.ToString(gameID), moduleName, moduleClass, moduleContent); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.Common_MODULE_UPDATE_RESP("SUCESS")); } else { logAPI.writeTitle(LanguageAPI.API_Delete + LanguageAPI.API_ModuleInfoAPI_ModuleInfo, LanguageAPI.API_Delete + LanguageAPI.API_ModuleInfoAPI_ModuleInfo + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_GameInfoAPI_GameID, LanguageAPI.API_GameInfoAPI_ModuleTitle, LanguageAPI.API_GameInfoAPI_ModuleClass, LanguageAPI.API_GameInfoAPI_ModuleDesp); logAPI.writeContent(Convert.ToString(gameID), moduleName, moduleClass, moduleContent); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.Common_MODULE_UPDATE_RESP("FAILURE")); } } catch (SqlException ex) { Console.WriteLine(ex.Message); return(Message.Common_MODULE_UPDATE_RESP("FAILURE")); } }
/// <summary> /// 更新一个游戏信息 /// </summary> public Message GM_UpdateGameInfo() { int result = -1; int userByID = 0; int gameID = 0; string gameName = null; string gameContent = null; GMGameInfo gameInfo = null; GMLogAPI logAPI = new GMLogAPI(); try { TLV_Structure strut = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); userByID = (int)strut.toInteger(); strut = new TLV_Structure(TagName.GameID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.GameID).m_bValueBuffer); gameID = (int)strut.toInteger(); gameName = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.GameName).m_bValueBuffer); gameContent = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.GameContent).m_bValueBuffer); gameInfo = new GMGameInfo(gameID, gameName, gameContent); result = gameInfo.updateRow(userByID, gameID, gameName, gameContent); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_GameInfoAPI_GameInfo, LanguageAPI.API_Update + LanguageAPI.API_GameInfoAPI_GameInfo + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_GameInfoAPI_GameTitle, LanguageAPI.API_GameInfoAPI_GameDesp); logAPI.writeData(Convert.ToString(userByID), gameName, gameContent); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("SUCESS", Msg_Category.GAME_ADMIN, ServiceKey.GAME_UPDATE_RESP)); } else { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_GameInfoAPI_GameInfo, LanguageAPI.API_Update + LanguageAPI.API_GameInfoAPI_GameInfo + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_GameInfoAPI_GameTitle, LanguageAPI.API_GameInfoAPI_GameDesp); logAPI.writeData(Convert.ToString(userByID), gameName, gameContent); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.GAME_ADMIN, ServiceKey.GAME_UPDATE_RESP)); } } catch (Common.Logic.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(ex.Message, Msg_Category.GAME_ADMIN, ServiceKey.GAME_UPDATE_RESP)); } }
/// <summary> /// 得到游戏信息类 /// </summary> /// <param name="gameID">游戏ID</param> /// <returns>游戏信息类</returns> public Message GM_QueryModuleInfo(int gameID) { System.Data.DataSet ds = null; GMLogAPI logAPI = new GMLogAPI(); try { ds = GMModuleInfo.SelectAll(); if (ds.Tables[0].Rows.Count <= 0) { return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.GAME_ADMIN, ServiceKey.GAME_MODULE_QUERY_RESP)); } else { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_GameInfoAPI_GameModuleList, LanguageAPI.API_Display + LanguageAPI.API_GameInfoAPI_GameModuleList); logAPI.writeContent(LanguageAPI.API_GameInfoAPI_ModuleID, LanguageAPI.API_GameInfoAPI_ModuleTitle, LanguageAPI.API_GameInfoAPI_ModuleClass, LanguageAPI.API_GameInfoAPI_ModuleDesp); Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); strut.AddTagKey(TagName.Module_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[1])); strut.AddTagKey(TagName.GameID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.GameName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.ModuleName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[4]); strut.AddTagKey(TagName.ModuleClass, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.ModuleContent, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); structList[i] = strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[1].ToString(), ds.Tables[0].Rows[i].ItemArray[2].ToString(), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.GAME_ADMIN, ServiceKey.GAME_MODULE_QUERY_RESP, 6)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
/// <summary> /// 更新一个模块信息 /// </summary> public Message GM_UpdateDepartInfo() { int result = -1; int deptID = 0; int operateUserID = 0; string deptName = null; string deptRemark = null; string gameID = null; GMLogAPI logAPI = new GMLogAPI(); try { TLV_Structure tlvStrut = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); operateUserID = (int)tlvStrut.toInteger(); tlvStrut = new TLV_Structure(TagName.DepartID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.DepartID).m_bValueBuffer); deptID = (int)tlvStrut.toInteger(); deptName = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.DepartName).m_bValueBuffer); deptRemark = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.DepartRemark).m_bValueBuffer); gameID = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.GameContent).m_bValueBuffer); result = GMDepartmentInfo.updateRow(operateUserID, deptID, deptName, deptRemark, gameID); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_DepartmentAPI_DepInfo, LanguageAPI.API_Update + LanguageAPI.API_DepartmentAPI_DepInfo + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_DepID, LanguageAPI.API_DepartmentAPI_DepTitle, LanguageAPI.API_DepartmentAPI_DepDesp); logAPI.writeContent(Convert.ToString(deptID), deptName, deptRemark); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("SUCESS", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_UPDATE_RESP, TagName.Status, TagFormat.TLV_STRING)); } else { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_DepartmentAPI_DepInfo, LanguageAPI.API_Update + LanguageAPI.API_DepartmentAPI_DepInfo + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_DepID, LanguageAPI.API_DepartmentAPI_DepTitle, LanguageAPI.API_DepartmentAPI_DepDesp); logAPI.writeContent(Convert.ToString(deptID), deptName, deptRemark); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_UPDATE_RESP, TagName.Status, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_UPDATE_RESP, TagName.Status, TagFormat.TLV_STRING)); } }
/// <summary> /// 根据用户ID得到模块信息类 /// </summary> /// <param name="userID">用户ID</param> /// <returns>模块类</returns> public Message GM_getModuleInfo(int userID) { GMLogAPI logAPI = new GMLogAPI(); System.Data.DataSet ds = null; try { //打印标题 logAPI.writeTitle(LanguageAPI.API_UserModuleAPI_UserAuth, LanguageAPI.API_Display + userID + LanguageAPI.API_ModuleInfoAPI_ModuleInfo); //打印名称 logAPI.writeContent(LanguageAPI.API_GameInfoAPI_ModuleID, LanguageAPI.API_GameInfoAPI_GameTitle, LanguageAPI.API_GameInfoAPI_ModuleTitle, LanguageAPI.API_GameInfoAPI_ModuleClass); //将模块信息存入DATASET ds = GMModuleInfo.getModuleInfo(userID); //构造一个模块信息类 Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); strut.AddTagKey(TagName.GameID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Module_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[1])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.GameName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.ModuleName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[4]); strut.AddTagKey(TagName.ModuleClass, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.ModuleContent, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); structList[i] = strut; //打印具体信息 logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[1].ToString(), ds.Tables[0].Rows[i].ItemArray[2].ToString(), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.USER_MODULE_ADMIN, ServiceKey.USER_MODULE_QUERY_RESP, 6)); } catch (System.Exception) { return(Message.COMMON_MES_RESP(LanguageAPI.API_UserModuleAPI_NoRecord, Msg_Category.USER_MODULE_ADMIN, ServiceKey.USER_MODULE_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 修改密码信息 /// </summary> public Message GM_ModifPassWd() { GMLogAPI logAPI = new GMLogAPI(); int result = -1; int userID = 0; int userByID = 0; string passWd = null; try { TLV_Structure strut1 = new TLV_Structure(TagName.User_ID,4,msg.m_packet.m_Body.getTLVByTag(TagName.User_ID).m_bValueBuffer); userID =(int)strut1.toInteger(); TLV_Structure strut2 = new TLV_Structure(TagName.UserByID,4,msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); userByID =(int)strut2.toInteger(); passWd =Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.PassWord).m_bValueBuffer); result = GMUserInfo.UpdateRow(userByID,userID,passWd); if(result==1) { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_NewPassword); logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),passWd); Console.WriteLine(logAPI.Buffer.ToString()); return Message.COMMON_MES_RESP("SUCESS",Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP); } else { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_Update + LanguageAPI.API_UserInfoAPI_Password + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID,LanguageAPI.API_UserInfoAPI_UserID,LanguageAPI.API_UserInfoAPI_NewPassword); logAPI.writeData(Convert.ToString(userByID),Convert.ToString(userID),passWd); Console.WriteLine(logAPI.Buffer.ToString()); return Message.COMMON_MES_RESP("FAILURE",Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP); } } catch(SqlException ex) { Console.WriteLine(ex.Message); return Message.COMMON_MES_RESP(ex.Message,Msg_Category.USER_ADMIN,ServiceKey.USER_PASSWD_MODIF_RESP); } }
/// <summary> /// 得到该用户所在部门的所拥有的游戏 /// </summary> /// <returns></returns> public Message GM_QueryDepartRelateGameInfo() { int userID = 0; System.Data.DataSet ds = null; GMLogAPI logAPI = new GMLogAPI(); try { TLV_Structure tlvStrut = new TLV_Structure(TagName.User_ID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.User_ID).m_bValueBuffer); userID = (int)tlvStrut.toInteger(); SqlHelper.log.WriteLog(LanguageAPI.API_DepartmentAPI_HoldGame); Console.WriteLine(DateTime.Now + " - " + LanguageAPI.API_DepartmentAPI_HoldGame); ds = GMDepartmentInfo.getDepartRelateGameInfo(userID); if (ds != null && ds.Tables[0].Rows.Count > 0) { Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); strut.AddTagKey(TagName.GameID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.GameName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); structList[i] = strut; } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.USER_ADMIN, ServiceKey.DEPART_RELATE_GAME_QUERY_RESP, 2)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_DepartmentAPI_NoDepInfo, Msg_Category.USER_ADMIN, ServiceKey.DEPART_RELATE_GAME_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP(LanguageAPI.API_DepartmentAPI_NoDepInfo, Msg_Category.USER_ADMIN, ServiceKey.DEPART_RELATE_GAME_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
/// <summary> /// 得到部门信息 /// </summary> /// <returns></returns> public Message GM_QueryDepartInfo() { System.Data.DataSet ds = null; GMLogAPI logAPI = new GMLogAPI(); try { ds = GMDepartmentInfo.getDepartInfo(); if (ds != null && ds.Tables[0].Rows.Count > 0) { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_DepartmentAPI_DepInfo, LanguageAPI.API_Display + LanguageAPI.API_DepartmentAPI_DepInfo); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_DepID, LanguageAPI.API_DepartmentAPI_DepTitle, LanguageAPI.API_DepartmentAPI_DepDesp); Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); strut.AddTagKey(TagName.DepartID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.DepartName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.DepartRemark, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); structList[i] = strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[0].ToString(), ds.Tables[0].Rows[i].ItemArray[1].ToString(), ds.Tables[0].Rows[i].ItemArray[2].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.USER_ADMIN, ServiceKey.DEPART_QUERY_RESP, 3)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_DepartmentAPI_NoDepInfo, Msg_Category.USER_ADMIN, ServiceKey.DEPART_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
/// <summary> /// 给用户添加模块 /// </summary> /// <returns></returns> public Message GM_UserModuleAdmin() { GMLogAPI logAPI = new GMLogAPI(); int result = -1; int userByID = 0; int userID = 0; string moduleList = null; TLV_Structure tlv1 = new TLV_Structure(TagName.User_ID, 3, msg.m_packet.m_Body.getTLVByTag(TagName.User_ID).m_bValueBuffer); userID = (int)tlv1.toInteger(); TLV_Structure tlv2 = new TLV_Structure(TagName.UserByID, 3, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); userByID = (int)tlv2.toInteger(); moduleList = Encoding.Default.GetString(msg.m_packet.m_Body.getTLVByTag(TagName.ModuleList).m_bValueBuffer); result = GMUserModule.UserModuleAdmin(userID, moduleList); //打印标题 logAPI.writeTitle(LanguageAPI.API_UserModuleAPI_UserAuth, userID + LanguageAPI.API_UserModuleAPI_UserModule); //打印名称 logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_UserInfoAPI_UserID, LanguageAPI.API_ModuleInfoAPI_ModuleList); logAPI.writeData(Convert.ToString(userByID), Convert.ToString(userID), moduleList); Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("SUCESS", Msg_Category.USER_MODULE_ADMIN, ServiceKey.USER_MODULE_CREATE_RESP)); }
/// <summary> /// 删除一个模块信息 /// </summary> public Message GM_DelModuleInfo() { GMLogAPI logAPI = new GMLogAPI(); int result = -1; int moduleID = 0; int userByID = 0; try { TLV_Structure strut1 = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); userByID = (int)strut1.toInteger(); TLV_Structure strut2 = new TLV_Structure(TagName.Module_ID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.Module_ID).m_bValueBuffer); moduleID = (int)strut2.toInteger(); result = GMModuleInfo.deleteRow(userByID, moduleID); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo, LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_GameInfoAPI_ModuleID, LanguageAPI.API_GameInfoAPI_ModuleDesp); logAPI.writeContent(Convert.ToString(userByID), Convert.ToString(moduleID), LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.Common_MODULE_DELETE_RESP(moduleID, "SUCESS")); } else { logAPI.writeTitle(LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo, LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_GameInfoAPI_ModuleID, LanguageAPI.API_GameInfoAPI_ModuleDesp); logAPI.writeContent(Convert.ToString(userByID), Convert.ToString(moduleID), LanguageAPI.API_Update + LanguageAPI.API_ModuleInfoAPI_ModuleInfo); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.Common_MODULE_DELETE_RESP(moduleID, "FAILURE")); } } catch (SqlException ex) { Console.WriteLine(ex.Message); return(Message.Common_MODULE_DELETE_RESP(moduleID, "FAILURE")); } }
/// <summary> /// 删除一个模块信息 /// </summary> public Message GM_DelDepartInfo() { GMLogAPI logAPI = new GMLogAPI(); int result = -1; int deptID = 0; int userByID = 0; try { TLV_Structure strut1 = new TLV_Structure(TagName.UserByID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.UserByID).m_bValueBuffer); userByID = (int)strut1.toInteger(); TLV_Structure strut2 = new TLV_Structure(TagName.DepartID, 4, msg.m_packet.m_Body.getTLVByTag(TagName.DepartID).m_bValueBuffer); deptID = (int)strut2.toInteger(); result = GMDepartmentInfo.deleteRow(userByID, deptID); if (result == 1) { logAPI.writeTitle(LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo, LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo + LanguageAPI.API_Success + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_DepartmentAPI_DepTitle, LanguageAPI.API_DepartmentAPI_DepDesp); logAPI.writeContent(Convert.ToString(userByID), Convert.ToString(deptID), LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("SUCESS", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_DELETE_RESP, TagName.Status, TagFormat.TLV_STRING)); } else { logAPI.writeTitle(LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo, LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo + LanguageAPI.API_Failure + "!"); logAPI.writeContent(LanguageAPI.API_DepartmentAPI_OperatorID, LanguageAPI.API_DepartmentAPI_DepTitle, LanguageAPI.API_DepartmentAPI_DepDesp); logAPI.writeContent(Convert.ToString(userByID), Convert.ToString(deptID), LanguageAPI.API_Delete + LanguageAPI.API_DepartmentAPI_DepInfo); Console.WriteLine(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_DELETE_RESP, TagName.Status, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(Message.COMMON_MES_RESP("FAILURE", Msg_Category.USER_ADMIN, ServiceKey.DEPARTMENT_DELETE_RESP, TagName.Status, TagFormat.TLV_STRING)); } }
/// <summary> /// 得到所有GM帐号信息 /// </summary> /// <returns>返回GM帐号信息的消息包</returns> public Message GM_QueryAll(int userID) { GMLogAPI logAPI = new GMLogAPI(); ArrayList rowList = new ArrayList(); DataSet ds = null; try { ds = GMUserInfo.SelectAll(userID); if(ds.Tables[0].Rows.Count<=0) { return Message.COMMON_MES_RESP("FAILURE",Msg_Category.USER_ADMIN,ServiceKey.USER_QUERY_ALL); } else { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_UserInfoAPI_AccountInfo,LanguageAPI.API_Display + LanguageAPI.API_UserInfoAPI_AccountInfo + LanguageAPI.API_Success + " !"); Query_Structure[] structList = new Query_Structure[ds.Tables[0].Rows.Count]; logAPI.writeContent(LanguageAPI.Logic_UserValidate_User,LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_UserInfoAPI_MAC); for(int i=0;i<ds.Tables[0].Rows.Count;i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length); strut.AddTagKey(TagName.User_ID,TagFormat.TLV_INTEGER,4,TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER,ds.Tables[0].Rows[i].ItemArray[0])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING,ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.UserName,TagFormat.TLV_STRING,(uint)bytes.Length,bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING,ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.PassWord,TagFormat.TLV_STRING,(uint)bytes.Length,bytes); string mac; if(ds.Tables[0].Rows[i].IsNull(3)==false) mac = ds.Tables[0].Rows[i].ItemArray[3].ToString(); else mac = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING,mac); strut.AddTagKey(TagName.MAC,TagFormat.TLV_STRING,(uint)bytes.Length,bytes); //使用时效 object limit; if(ds.Tables[0].Rows[i].IsNull(8)==false) limit = ds.Tables[0].Rows[i].ItemArray[8]; else limit = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_DATE,limit); strut.AddTagKey(TagName.Limit,TagFormat.TLV_DATE,(uint)bytes.Length,bytes); //状态 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER,ds.Tables[0].Rows[i].ItemArray[7]); strut.AddTagKey(TagName.User_Status,TagFormat.TLV_INTEGER,(uint)bytes.Length,bytes); string realName; if(ds.Tables[0].Rows[i].IsNull(4)==false) realName = ds.Tables[0].Rows[i].ItemArray[4].ToString(); else realName = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING,realName); strut.AddTagKey(TagName.RealName,TagFormat.TLV_STRING,(uint)bytes.Length,bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[10]); strut.AddTagKey(TagName.SysAdmin, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i]=strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[1].ToString().Trim(),ds.Tables[0].Rows[i].ItemArray[2].ToString().Trim(),ds.Tables[0].Rows[i].ItemArray[3].ToString().Trim()); } Console.WriteLine(logAPI.Buffer.ToString()); return Message.COMMON_MES_RESP(structList,Msg_Category.USER_ADMIN,ServiceKey.USER_QUERY_ALL,7); } } catch(SqlException ex) { Console.WriteLine(ex.Message); return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoUserList,Msg_Category.USER_ADMIN,ServiceKey.USER_QUERY_ALL,TagName.ERROR_Msg,TagFormat.TLV_STRING); } catch(System.Exception ex1) { Console.WriteLine(ex1.Message); return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoUserList,Msg_Category.USER_ADMIN,ServiceKey.USER_QUERY_ALL,TagName.ERROR_Msg,TagFormat.TLV_STRING); } }
/// <summary> /// 得到所有GM帐号信息 /// </summary> /// <returns>返回GM帐号信息的消息包</returns> public Message GM_QueryList(int index,int pageSize,int userID) { GMLogAPI logAPI = new GMLogAPI(); ArrayList rowList = new ArrayList(); DataSet ds = null; try { if (userID == 0) { ds = GMUserInfo.SelectAll(); } else { ds = GMUserInfo.SelectAll(userID); } if (ds.Tables[0].Rows.Count <= 0) { return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoUserList, Msg_Category.USER_ADMIN, ServiceKey.USER_QUERY_RESP,TagName.ERROR_Msg,TagFormat.TLV_STRING); } else { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else pageCount = ds.Tables[0].Rows.Count / pageSize; //分页显示 if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } logAPI.writeTitle(LanguageAPI.API_UserInfoAPI_AccountInfo,LanguageAPI.API_UserInfoAPI_AccountInfo + LanguageAPI.API_Success + " !"); Query_Structure[] structList = new Query_Structure[pageSize]; logAPI.writeContent(LanguageAPI.Logic_UserValidate_User,LanguageAPI.API_UserInfoAPI_Password,LanguageAPI.API_UserInfoAPI_MAC); for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure(12); strut.AddTagKey(TagName.User_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.UserName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.PassWord, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); string mac; if (ds.Tables[0].Rows[i].IsNull(3) == false) mac = ds.Tables[0].Rows[i].ItemArray[3].ToString(); else mac = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, mac); strut.AddTagKey(TagName.MAC, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //使用时效 object limit; if (ds.Tables[0].Rows[i].IsNull(8) == false) limit = ds.Tables[0].Rows[i].ItemArray[8]; else limit = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_DATE, limit); strut.AddTagKey(TagName.Limit, TagFormat.TLV_DATE, (uint)bytes.Length, bytes); //真实姓名 object realName; if (ds.Tables[0].Rows[i].IsNull(4) == false) realName = ds.Tables[0].Rows[i].ItemArray[4]; else realName = ""; bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, realName); strut.AddTagKey(TagName.RealName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //部门ID bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.DepartID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //部门名称 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[6]); strut.AddTagKey(TagName.DepartName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //状态 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[7]); strut.AddTagKey(TagName.User_Status, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); //在线状态 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[9]); strut.AddTagKey(TagName.OnlineActive, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[10]); strut.AddTagKey(TagName.SysAdmin, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); structList[i - index] = strut; logAPI.writeData(ds.Tables[0].Rows[i].ItemArray[1].ToString().Trim(), ds.Tables[0].Rows[i].ItemArray[2].ToString().Trim(), ds.Tables[0].Rows[i].ItemArray[3].ToString().Trim()); } Console.WriteLine(logAPI.Buffer.ToString()); return Message.COMMON_MES_RESP(structList, Msg_Category.USER_ADMIN, ServiceKey.USER_QUERY_RESP, 12); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); return Message.COMMON_MES_RESP(LanguageAPI.API_UserInfoAPI_NoUserList, Msg_Category.USER_ADMIN, ServiceKey.USER_QUERY_RESP,TagName.ERROR_Msg,TagFormat.TLV_STRING); } }
public Message Notes_TransferInfo_Resp(int index, int pageSize) { GMLogAPI logAPI = new GMLogAPI(); try { System.Data.DataSet ds; logAPI.writeTitle(LanguageAPI.API_NotesInfoAPI_NotesEmailList, LanguageAPI.API_Display + LanguageAPI.API_NotesInfoAPI_NotesEmailList); logAPI.writeContent(LanguageAPI.API_NotesInfoAPI_EmailID, LanguageAPI.API_NotesInfoAPI_EmailSubject, LanguageAPI.API_NotesInfoAPI_EmailContent, LanguageAPI.API_NotesInfoAPI_EmailSender); ds = GMNotesInfo.SelectAll(); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure(7); //邮件ID strut.AddTagKey(TagName.Letter_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); //邮件发件人 byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.Letter_Sender, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件收件人 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.Letter_Receiver, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件主题 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[3]); strut.AddTagKey(TagName.Letter_Subject, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件内容 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[4]); strut.AddTagKey(TagName.Letter_Text, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //发送日期 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.Send_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; logAPI.writeData(Convert.ToString(ds.Tables[0].Rows[i].ItemArray[0]), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString(), ds.Tables[0].Rows[i].ItemArray[1].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSFER_RESP, 7)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_NotesInfoAPI_NoDealWithEmail, Msg_Category.COMMON, ServiceKey.NOTES_LETTER_TRANSFER_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(ex.Message, Msg_Category.COMMON, ServiceKey.NOTES_LETTER_TRANSFER_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }
public Message Notes_TransmitInfo_Resp(int userByID, int index, int pageSize) { GMLogAPI logAPI = new GMLogAPI(); System.Data.DataSet ds; try { logAPI.writeTitle(LanguageAPI.API_Display + LanguageAPI.API_NotesInfoAPI_NotesTransEmailList, LanguageAPI.API_Display + LanguageAPI.API_NotesInfoAPI_NotesTransEmailList); logAPI.writeContent(LanguageAPI.API_NotesInfoAPI_EmailID, LanguageAPI.API_NotesInfoAPI_EmailSubject, LanguageAPI.API_NotesInfoAPI_EmailContent, LanguageAPI.API_NotesInfoAPI_EmailSender); ds = GMNotesInfo.SelectTransmitLetter(userByID); if (ds != null && ds.Tables[0].Rows.Count > 0) { //总页数 int pageCount = 0; pageCount = ds.Tables[0].Rows.Count % pageSize; if (pageCount > 0) { pageCount = ds.Tables[0].Rows.Count / pageSize + 1; } else { pageCount = ds.Tables[0].Rows.Count / pageSize; } if (index + pageSize > ds.Tables[0].Rows.Count) { pageSize = ds.Tables[0].Rows.Count - index; } Query_Structure[] structList = new Query_Structure[pageSize]; for (int i = index; i < index + pageSize; i++) { Query_Structure strut = new Query_Structure((uint)ds.Tables[0].Rows[i].ItemArray.Length + 1); //邮件ID strut.AddTagKey(TagName.Letter_ID, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[0])); //邮件发件人 byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[1]); strut.AddTagKey(TagName.Letter_Sender, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件收件人 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[2]); strut.AddTagKey(TagName.Letter_Receiver, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件主题 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[3])); strut.AddTagKey(TagName.Letter_Subject, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //邮件内容 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, UserValidate.validData(ds.Tables[0].Rows[i].ItemArray[4])); strut.AddTagKey(TagName.Letter_Text, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //发送日期 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[5]); strut.AddTagKey(TagName.Send_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //处理日期 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, ds.Tables[0].Rows[i].ItemArray[7]); strut.AddTagKey(TagName.Process_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); //处理标志 strut.AddTagKey(TagName.Is_Process, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, ds.Tables[0].Rows[i].ItemArray[9])); //处理人姓名 bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, ds.Tables[0].Rows[i].ItemArray[11]); strut.AddTagKey(TagName.RealName, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //处理理由 object reason; if (ds.Tables[0].Rows[i].IsNull(10) == false) { reason = ds.Tables[0].Rows[i].ItemArray[10]; } else { reason = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, reason); strut.AddTagKey(TagName.Process_Reason, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); //总页数 strut.AddTagKey(TagName.PageCount, TagFormat.TLV_INTEGER, 4, TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, pageCount)); structList[i - index] = strut; logAPI.writeData(Convert.ToString(ds.Tables[0].Rows[i].ItemArray[0]), ds.Tables[0].Rows[i].ItemArray[3].ToString(), ds.Tables[0].Rows[i].ItemArray[4].ToString(), ds.Tables[0].Rows[i].ItemArray[1].ToString()); } Console.Write(logAPI.Buffer.ToString()); return(Message.COMMON_MES_RESP(structList, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, 11)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_NotesInfoAPI_NoTransDealWithEmail, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(LanguageAPI.API_NotesInfoAPI_NoTransDealWithEmail, Msg_Category.NOTES_ADMIN, ServiceKey.NOTES_LETTER_TRANSMIT_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }