Example #1
0
        /// <summary>
        /// Get score in table GameTextScore By GameID and TeamID.
        /// </summary>
        /// <param name="gameID">GameID</param>
        /// <param name="teamID">TeamID</param>
        /// <returns>Score if exists or 0 if not exist.</returns>
        public static ScoreGameInfo GetTeamInfoGTSByGameIDTeamIDVisitor(int gameID, int teamID)
        {
            MlbEntities mlb = new MlbEntities();
            var query = (from rgi in mlb.RealGameInfo
                         where rgi.GameID == gameID && rgi.VisitorTeamID == teamID
                         select new ScoreGameInfo
                         {
                             GameID = rgi.GameID,
                             TeamID = teamID,
                             Inning = null,
                             TB = null,
                             R = rgi.VisitorScore
                         }).FirstOrDefault();

            ScoreGameInfo scoreInfo = new ScoreGameInfo();
            if (query == null)
            {
                scoreInfo.GameID = gameID;
                scoreInfo.TeamID = teamID;
                scoreInfo.Inning = 0;
                scoreInfo.TB = 0;
                scoreInfo.R = 0;
                return scoreInfo;
            }
            else
            {
                return query;
            }
        }
Example #2
0
        /// <summary>
        /// Get score in table GameTextScore By GameID and TeamID.
        /// </summary>
        /// <param name="gameID">GameID</param>
        /// <param name="teamID">TeamID</param>
        /// <returns>Score if exists or 0 if not exist.</returns>
        public static ScoreGameInfo GetTeamInfoGTSByGameIDTeamID(int gameID, int teamID)
        {
            JlgEntities Jlg = new JlgEntities();
            var query = (from grl in Jlg.GameReportLG
                         join til in Jlg.TeamInfoLG on grl.GameReportLGId equals til.GameReportLGId
                         where grl.GameID == gameID && til.ID == teamID
                         select new ScoreGameInfo
                         {
                             GameID = grl.GameID,
                             TeamID = teamID,
                             R = til.Score

                         }).FirstOrDefault();

            ScoreGameInfo scoreInfo = new ScoreGameInfo();
            if (query == null)
            {
                scoreInfo.GameID = gameID;
                scoreInfo.TeamID = teamID;
                return scoreInfo;
            }
            else
            {
                return query;
            }
        }
Example #3
0
 /// <summary>
 /// Get score in table GameTextScore By GameID and TeamID.
 /// </summary>
 /// <param name="gameID">GameID</param>
 /// <param name="teamID">TeamID</param>
 /// <returns>Score if exists or 0 if not exist.</returns>
 public static ScoreGameInfo GetTeamInfoGTSByGameIDTeamID(int gameID, int teamID)
 {
     NpbEntities npb = new NpbEntities();
     var query = (from gi in npb.GameInfoGTS
                  join ti in npb.TeamInfoGTS on gi.GameInfoGTSId equals ti.GameInfoGTSId
                  where gi.GameID == gameID && ti.ID == teamID
                  select new ScoreGameInfo
                  {
                      GameID = gi.GameID,
                      TeamID = ti.ID,
                      Inning = gi.Inning == null ? 0 : gi.Inning,
                      TB = gi.TB == null ? 0 : gi.TB,
                      R = ti.R
                  }).FirstOrDefault();
     ScoreGameInfo scoreInfo = new ScoreGameInfo();
     if (query == null)
     {
         scoreInfo.GameID = gameID;
         scoreInfo.TeamID = teamID;
         scoreInfo.Inning = 0;
         scoreInfo.TB = 0;
         scoreInfo.R = 0;
         return scoreInfo;
     }
     else
     {
         return query;
     }
 }