using MongoDB.Bson; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LolDataRequestLib.ResponseData { internal class 경기종료정보 : AResponseData { protected override DataTable buildDataForResponse(BsonDocument recvDocument) { BsonValue bufGameEndData = null; if (recvDocument != null) { bufGameEndData = recvDocument["eventDocument"]; } DataTable gameEndData = new DataTable(); try { gameEndData.TableName = DBDefine.요청데이터분류.경기종료정보.ToString(); gameEndData.Columns.Add("승리팀"); gameEndData.Columns.Add("경기시간"); DataRow bufRow = gameEndData.NewRow(); bufRow["승리팀"] = (DBDefine.팀구분)bufGameEndData["winningTeam"].ToInt32(); bufRow["경기시간"] = bufGameEndData["gameTime"].ToInt32() / 1000; gameEndData.Rows.Add(bufRow); } catch(Exception ex) { } return gameEndData; } protected override BsonDocument getDataFromMongo() { //var filter = Builders.Filter.Eq("RequestGameID", DataManager.getInstance().mPlatformGameID); var projection = Builders.Projection .Exclude("_id") .Include("eventDocument"); List documents = mEventDataBase.GetCollection("game_end") .Find(new BsonDocument()) //.Find(filter) .SortByDescending(x => x["sequenceIndex"]) .Project(projection) .Limit(1) .ToList(); return documents.Last(); } } }