public Message BUGList_Query(int index, int pageSize) { DataSet ds = null; try { SqlHelper.log.WriteLog(LanguageAPI.API_CommonAPI_BugInfo); Console.WriteLine(DateTime.Now + " - " + LanguageAPI.API_CommonAPI_BugInfo); ds = CommonInfo.BugList_Query(); 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); byte[] bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[0])); strut.AddTagKey(TagName.Bug_ID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); string bugSubject; if (ds.Tables[0].Rows[i].IsNull(1) == false) { bugSubject = ds.Tables[0].Rows[i].ItemArray[1].ToString(); } else { bugSubject = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, bugSubject); strut.AddTagKey(TagName.Bug_Subject, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); 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); string BugContext; if (ds.Tables[0].Rows[i].IsNull(4) == false) { BugContext = ds.Tables[0].Rows[i].ItemArray[4].ToString(); } else { BugContext = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, BugContext); strut.AddTagKey(TagName.Bug_Context, TagFormat.TLV_STRING, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_TIMESTAMP, Convert.ToDateTime(ds.Tables[0].Rows[i].ItemArray[5])); strut.AddTagKey(TagName.Bug_Date, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[6])); strut.AddTagKey(TagName.User_ID, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); string bugSender; if (ds.Tables[0].Rows[i].IsNull(7) == false) { bugSender = ds.Tables[0].Rows[i].ItemArray[7].ToString(); } else { bugSender = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, bugSender); strut.AddTagKey(TagName.RealName, TagFormat.TLV_TIMESTAMP, (uint)bytes.Length, bytes); bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_INTEGER, Convert.ToInt32(ds.Tables[0].Rows[i].ItemArray[8])); strut.AddTagKey(TagName.Bug_Process, TagFormat.TLV_INTEGER, (uint)bytes.Length, bytes); string bugResult; if (ds.Tables[0].Rows[i].IsNull(9) == false) { bugResult = ds.Tables[0].Rows[i].ItemArray[9].ToString(); } else { bugResult = ""; } bytes = TLV_Structure.ValueToByteArray(TagFormat.TLV_STRING, bugResult); strut.AddTagKey(TagName.Bug_Result, 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; } return(Message.COMMON_MES_RESP(structList, Msg_Category.COMMON, ServiceKey.GMTOOLS_BUGLIST_QUERY_RESP, 11)); } else { return(Message.COMMON_MES_RESP(LanguageAPI.API_CommonAPI_NoBugInfo, Msg_Category.COMMON, ServiceKey.GMTOOLS_BUGLIST_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } } catch (System.Exception ex) { return(Message.COMMON_MES_RESP(LanguageAPI.API_CommonAPI_NoBugInfo, Msg_Category.COMMON, ServiceKey.GMTOOLS_BUGLIST_QUERY_RESP, TagName.ERROR_Msg, TagFormat.TLV_STRING)); } }