コード例 #1
0
 public PlayersController()
 {
     _entities = new KSULaxEntities();
     _playerBL = new PlayerBL(_entities);
     _gameBL   = new GameBL(_entities);
     _awardBL  = new AwardBL(_entities);
 }
コード例 #2
0
        public void UpdateGames(List <GameBE> games)
        {
            using (var ent = new KSULaxEntities())
            {
                foreach (GameBE gbe in games)
                {
                    var game = ((from g in ent.GameSet
                                 where g.id == gbe.ID
                                 select g) as ObjectQuery <GameEntity>)
                               .Take <GameEntity>(1)
                               .FirstOrDefault <GameEntity>();

                    if (null == game)
                    {
                        ent.GameSet.AddObject(GetGameEntity(gbe));
                    }

                    else
                    {
                        game.away_team_score = gbe.AwayTeamScore;
                        game.away_team_slug  = gbe.AwayTeamSlug.Trim();
                        game.game_datetime   = gbe.Datetime;
                        game.game_season_id  = (short)gbe.SeasonID;
                        game.game_status     = gbe.Status.Trim();
                        game.game_type       = gbe.Type.Trim();
                        game.home_team_score = gbe.HomeTeamScore;
                        game.home_team_slug  = gbe.HomeTeamSlug.Trim();
                        game.id    = (short)gbe.ID;
                        game.venue = gbe.Venue.Trim();
                    }
                }

                ent.SaveChanges();
            }
        }
コード例 #3
0
        public void UpdatePoll(TeamRankingBE poll)
        {
            using (var ent = new KSULaxEntities())
            {
                var pe = ((from p in ent.PollSet
                           where p.pollsource_id == poll.pollSource &&
                           p.date == poll.Date
                           select p) as ObjectQuery <PollEntity>)
                         .Take <PollEntity>(1)
                         .FirstOrDefault <PollEntity>();

                if (null == pe)
                {
                    ent.PollSet.AddObject(GetPollEntity(poll));
                }

                else
                {
                    pe.rank = poll.Rank;
                    pe.url  = poll.Url;
                }

                ent.SaveChanges();
            }
        }
コード例 #4
0
        /// <summary>
        /// Updates the game stats per game. Only use to update stats for entire games. All stats for included games are cleared out prior to update.
        /// </summary>
        /// <param name="gsbeLst">List of Game Stats to Update</param>
        public void UpdateGameStatByGame(List <GameStatBE> gsbeLst)
        {
            using (var ent = new KSULaxEntities())
            {
                var games =
                    from n in gsbeLst
                    group n by n.GameID into nGroup
                    select nGroup.Key;

                foreach (var game in games)
                {
                    var pge = ((from g in ent.GameSet
                                where g.id == (short)game
                                select g) as ObjectQuery <GameEntity>)
                              .Include("PlayerGames")
                              .Take <GameEntity>(1)
                              .FirstOrDefault <GameEntity>();

                    pge.PlayerGames.Clear();
                }

                ent.SaveChanges();

                foreach (GameStatBE gsbe in gsbeLst)
                {
                    var pge = ((from pg in ent.PlayerGameSet
                                where pg.game_id == gsbe.GameID &&
                                pg.player_id == gsbe.PlayerID
                                select pg) as ObjectQuery <PlayerGameEntity>)
                              .Take <PlayerGameEntity>(1)
                              .FirstOrDefault <PlayerGameEntity>();

                    if (null == pge)
                    {
                        ent.PlayerGameSet.AddObject(GetPlayerGameEntity(gsbe));
                    }

                    else
                    {
                        pge.assists   = (short)gsbe.Assists;
                        pge.ga        = (short)gsbe.GoalsAgainst;
                        pge.game_id   = (short)gsbe.GameID;
                        pge.goals     = (short)gsbe.Goals;
                        pge.player_id = (short)gsbe.PlayerID;
                        pge.saves     = (short)gsbe.Saves;
                    }
                }

                ent.SaveChanges();
            }
        }
コード例 #5
0
        public void UpdatePlayers(List <PlayerBE> players)
        {
            using (var ent = new KSULaxEntities())
            {
                foreach (PlayerBE pbe in players)
                {
                    var player = ((from p in ent.PlayerSet
                                   where p.id == pbe.PlayerID
                                   select p) as ObjectQuery <PlayerEntity>)
                                 .Include("PlayerSeason")
                                 .Take <PlayerEntity>(1)
                                 .FirstOrDefault <PlayerEntity>();

                    if (null == player)
                    {
                        ent.PlayerSet.AddObject(GetPlayerEntity(pbe));
                    }

                    else
                    {
                        player.first      = pbe.FirstName.Trim();
                        player.highschool = pbe.HighSchool.Trim();
                        player.homestate  = pbe.HomeState.Trim();
                        player.hometown   = pbe.Hometown.Trim();
                        player.last       = pbe.LastName.Trim();
                        player.major      = pbe.Major.Trim();
                        player.middle     = pbe.MiddleName.Trim();

                        var playerseason = player.PlayerSeason.Single(x => x.season_id.Equals((short)pbe.SeasonID));

                        if (null != playerseason)
                        {
                            playerseason.@class      = pbe.ClassYr.Trim();
                            playerseason.eligibility = pbe.EligibilityYr.Trim();
                            playerseason.height      = (short)pbe.Height;
                            playerseason.jersey      = (short)pbe.JerseyNum;
                            playerseason.position    = pbe.Position.Trim();
                            playerseason.weight      = (short)pbe.Weight;
                            playerseason.team        = pbe.Team.Trim();
                        }

                        player.PlayerSeason.Add(playerseason);
                    }
                }

                ent.SaveChanges();
            }
        }
コード例 #6
0
 public GameBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #7
0
 public GamesController()
 {
     _entities = new KSULaxEntities();
     _gamesBL  = new GameBL(_entities);
     _photoBL  = new PhotoBL(_entities);
 }
コード例 #8
0
 public ScheduleController()
 {
     _entities = new KSULaxEntities();
 }
コード例 #9
0
 public SponsorsController()
 {
     _entities = new KSULaxEntities();
     _gamesBL  = new GameBL(_entities);
 }
コード例 #10
0
 public RosterController()
 {
     _entities = new KSULaxEntities();
 }
コード例 #11
0
 public PlayerBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #12
0
 public DataBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #13
0
 public AwardBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #14
0
 public NewsController()
 {
     _entities = new KSULaxEntities();
     _newsBL   = new NewsBL(_entities);
 }
コード例 #15
0
 public NationalRankingController()
 {
     _entities = new KSULaxEntities();
     _dataBL   = new DataBL(_entities);
     _gameBL   = new GameBL(_entities);
 }
コード例 #16
0
 public MediaBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #17
0
 public PhotoBL(KSULaxEntities entitity)
 {
     _entities = entitity;
 }
コード例 #18
0
 public NewsBL(KSULaxEntities entitity)
 {
     _entities = entitity;
     _gameBL   = new GameBL(entitity);
 }
コード例 #19
0
 public HomeController()
 {
     _entities = new KSULaxEntities();
     _newsBL   = new NewsBL(_entities);
     _gameBL   = new GameBL(_entities);
 }
コード例 #20
0
 public MediaController()
 {
     _entities = new KSULaxEntities();
     _mediaBL  = new MediaBL(_entities);
 }