示例#1
0
        public void GetFilteredTeamDetails(int entity, string teamName)
        {
            var db         = new BoardSquaresRepository();
            var playerList = db.GetUserTeamPlayersByGame(entity).Select(r => r.PlayerID).ToList();
            var tieBreaker = db.GetTieBreakerPlayers(entity);//db.Context.TieBreakerPlayers.Where(r => r.UserTeamID == entity).Select(r => r.PlayerID).ToList();

            SelectedTeam   = teamName;
            SelectedTeamID = entity;
            //var playerList = temp.Select(r => r.PlayerID).ToList();
            var tiebreakerList = tieBreaker.Select(r => r.PlayerID).ToList();

            //var regularPlayerList = playerList.Where(r => !tiebreakerList.Contains(r)).ToList();
            GetPlayerScoringTotalsByRound(playerList);
            GetTieBreakerScoringTotalsByRound(tiebreakerList, SelectedTeamID);
        }
        private void EditMode(int p)
        {
            BoardSquaresRepository db = new BoardSquaresRepository();

            Entity          = Get(p);
            UserTeamPlayers = db.GetUserTeamPlayersByGame(Entity.UserTeamID);
            if (UserTeamPlayers.Any())
            {
                foreach (var userTeamPlayer in UserTeamPlayers)
                {
                    var player = db.Context.Players.Find(userTeamPlayer.PlayerID);
                    switch (player.PlayerPosition)
                    {
                    case "QB":
                        if (QB1Player.PlayerID == 0)
                        {
                            QB1Player = player;
                        }
                        QB2Player = player;
                        break;

                    case "K":
                        KPlayer = player;
                        break;

                    case "DEF":
                        DEFPlayer = player;
                        break;

                    case "TE":
                        TEPlayer = player;
                        break;

                    case "RB":
                        if (RB1Player.PlayerID == 0)
                        {
                            RB1Player = player;
                        }
                        else
                        {
                            if (RB2Player.PlayerID == 0)
                            {
                                RB2Player = player;
                            }
                            else
                            {
                                if (RB3Player.PlayerID == 0)
                                {
                                    RB3Player = player;
                                }
                                RB4Player = player;
                            }
                        }
                        break;

                    case "WR":
                        if (WR1Player.PlayerID == 0)
                        {
                            WR1Player = player;
                        }
                        else
                        {
                            if (WR2Player.PlayerID == 0)
                            {
                                WR2Player = player;
                            }
                            else
                            {
                                if (WR3Player.PlayerID == 0)
                                {
                                    WR3Player = player;
                                }
                                else
                                {
                                    if (WR4Player.PlayerID == 0)
                                    {
                                        WR4Player = player;
                                    }
                                    WR5Player = player;
                                }
                            }
                        }
                        break;
                    }
                }
                var tb = db.GetTieBreakerPlayers(Entity.UserTeamID);
                TieBreakerPlayer1 = tb.First();
                TieBreakerPlayer2 = tb.Last();
            }
            IsTeamDetailVisible   = true;
            IsNewTeamAreaVisible  = false;
            IsTeamListAreaVisible = false;
            IsPlayerDetailVisible = false;
        }