Beispiel #1
0
        public ManagerTeam(Manager manager, TeamSheetTeam teamSheetTeam = null) : this()
        {
            ManagerId   = manager.ManagerId;
            ManagerName = manager.Name;

            manager.GoalKeepers = manager.GoalKeepers.OrderBy(x => x.Team.Name).ToList();
            manager.Players     = manager.Players.OrderBy(x => x.Player.Position).ThenBy(x => x.Player.LastNameFirstName).ToList();

            if (teamSheetTeam != null)
            {
                teamSheetTeam.GoalKeepers = teamSheetTeam.GoalKeepers.OrderBy(x => x.Team).ToList();
                teamSheetTeam.Players     = teamSheetTeam.Players.OrderBy(x => x.Position).ThenBy(x => x.Name).ToList();
            }

            for (int i = 0; i < 2; i++)
            {
                TeamGoalKeeper teamGoalKeeperA;
                TeamGoalKeeper teamGoalKeeperB = null;

                if (manager.GoalKeepers != null && i < manager.GoalKeepers.Count)
                {
                    teamGoalKeeperA = new TeamGoalKeeper(manager.GoalKeepers[i].TeamId, manager.GoalKeepers[i].Team.Name, manager.GoalKeepers[i].Substitute);
                }
                else
                {
                    teamGoalKeeperA = new TeamGoalKeeper();
                }

                if (teamSheetTeam != null && i < teamSheetTeam.GoalKeepers.Count)
                {
                    teamGoalKeeperB = new TeamGoalKeeper(0, teamSheetTeam.GoalKeepers[i].Team, teamSheetTeam.GoalKeepers[i].Substitute);
                }

                TeamGoalKeeperGroup teamGoalKeeperGroup = new TeamGoalKeeperGroup(teamGoalKeeperA, teamGoalKeeperB);

                TeamGoalKeeperGroups.Add(teamGoalKeeperGroup);
            }

            for (int i = 0; i < 13; i++)
            {
                TeamPlayer teamPlayerA;
                TeamPlayer teamPlayerB = null;

                if (manager.Players != null && i < manager.Players.Count)
                {
                    teamPlayerA = new TeamPlayer(manager.Players[i].PlayerId, manager.Players[i].Player.Details, manager.Players[i].Substitute);
                }
                else
                {
                    teamPlayerA = new TeamPlayer();
                }

                if (teamSheetTeam != null && i < teamSheetTeam.Players.Count)
                {
                    teamPlayerB = new TeamPlayer(0, teamSheetTeam.Players[i].Name, teamSheetTeam.Players[i].Substitute);
                }

                TeamPlayerGroup teamPlayerGroup = new TeamPlayerGroup(teamPlayerA, teamPlayerB);

                TeamPlayerGroups.Add(teamPlayerGroup);
            }
        }
Beispiel #2
0
 public TeamPlayerGroup(TeamPlayer teamPlayerA, TeamPlayer teamPlayerB = null) : this()
 {
     TeamPlayerA = teamPlayerA;
     TeamPlayerB = teamPlayerB;
 }