public static ChatTimeLine[] GetRoomChatListByUserid(int roomId, int maxId, int userid) { DataTable dt = DBHelper.GetDataTable(" select * from dbo.chat_list where audit_state = 1 and chat_room_id=" + roomId + " and [id] in (select parent_id from dbo.chat_list where parent_id>0) and [id] > " + maxId + " order by [id] ", Util.ConnectionString.Trim()); ChatTimeLine[] chatTimeLineArr = new ChatTimeLine[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { chatTimeLineArr[i] = new ChatTimeLine(); chatTimeLineArr[i]._fields = dt.Rows[i]; } return chatTimeLineArr; }
public static ChatTimeLine[] GetRoomChatList(int roomId, DateTime maxId, int parentId, int state, string expertlist) { string sql = "select * from chat_list where audit_state = 1 and chat_room_id = " + roomId; if (parentId >= 0) sql += " and parent_id = " + parentId; if (state == 0) sql += " and state = 0"; else if (state > 0) sql += " and state > 0"; if (expertlist.Trim() != "") sql += " and user_id not in (" + expertlist + ")"; sql += " and update_date > '" + maxId + "' order by update_date"; DataTable dt = DBHelper.GetDataTable(sql, Util.ConnectionString.Trim()); ChatTimeLine[] chatTimeLineArr = new ChatTimeLine[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { chatTimeLineArr[i] = new ChatTimeLine(); chatTimeLineArr[i]._fields = dt.Rows[i]; } return chatTimeLineArr; }