コード例 #1
0
 private string GetTeamDesc(int clubId, string teamCode, ClubEntity[] clubs)
 {
     if (clubId == Constants.OwnClubId)
     {
         return "Erembodegem " + teamCode;
     }
     var club = clubs.Single(x => x.Id == clubId);
     return club.Naam + " " + teamCode;
 }
コード例 #2
0
        public static TeamsExcelCreator CreateFormation(TeamEntity[] teams, List<MatchEntity> matches, PlayerEntity[] players, ClubEntity[] clubs)
        {
            var result = new List<TeamExcelModel>();
            foreach (var team in teams.OrderByDescending(x => x.Competition).ThenBy(x => x.TeamCode))
            {
                var teamModel = new TeamExcelModel(team.Competition + " " + team.TeamCode);

                foreach (var teamPlayer in team.Players)
                {
                    var player = players.First(x => x.Id == teamPlayer.PlayerId);
                    teamModel.Players.Add(new TeamPlayerExcelModel(player.NaamKort, teamPlayer.PlayerType));
                }

                foreach (var match in matches.Where(x => x.FrenoyDivisionId == team.FrenoyDivisionId).OrderBy(x => x.Date))
                {
                    var teamMatch = new TeamMatchExcelModel(match, clubs);
                    foreach (var matchPlayer in match.Players.Where(x => x.Status != PlayerMatchStatus.Captain && x.Status != PlayerMatchStatus.Major))
                    {
                        if (!teamMatch.PlayerDecisions.ContainsKey(matchPlayer.Name))
                        {
                            teamMatch.PlayerDecisions.Add(matchPlayer.Name, matchPlayer.Status);
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(match.Block))
                    {
                        foreach (var matchPlayer in match.Players.Where(x => x.Status == match.Block))
                        {
                            if (!teamMatch.CaptainDecisions.Contains(matchPlayer.Name))
                            {
                                teamMatch.CaptainDecisions.Add(matchPlayer.Name);
                            }
                        }
                    }

                    teamModel.Matches.Add(teamMatch);
                }

                result.Add(teamModel);
            }

            return new TeamsExcelCreator(result);
        }
コード例 #3
0
 public TeamMatchExcelModel(MatchEntity match, ClubEntity[] clubs)
 {
     Match = match;
     Home = GetTeamDesc(match.HomeClubId, match.HomeTeamCode, clubs);
     Out = GetTeamDesc(match.AwayClubId, match.AwayTeamCode, clubs);
     PlayerDecisions = new Dictionary<string, string>();
     CaptainDecisions = new List<string>();
 }
コード例 #4
0
        private ClubEntity CreateClub(string frenoyClubCode)
        {
            Debug.Assert(_isVttl, "or need to write an if");
            var frenoyClub = _frenoy.GetClubs(new GetClubs
            {
                Club = frenoyClubCode,
                Season = _settings.FrenoySeason.ToString()
            });
            Debug.Assert(frenoyClub.ClubEntries.Count() == 1);

            var club = new ClubEntity
            {
                CodeVttl = frenoyClubCode,
                Actief = 1,
                Naam = frenoyClub.ClubEntries.First().LongName,
                Douche = 0
            };
            _db.Clubs.Add(club);
            CommitChanges();

            foreach (var frenoyLokaal in frenoyClub.ClubEntries.First().VenueEntries)
            {
                var lokaal = new ClubLokaal
                {
                    ClubId = club.Id,
                    Telefoon = frenoyLokaal.Phone,
                    Lokaal = frenoyLokaal.Name,
                    Adres = frenoyLokaal.Street,
                    Postcode = int.Parse(frenoyLokaal.Town.Substring(0, frenoyLokaal.Town.IndexOf(" "))),
                    Gemeente = frenoyLokaal.Town.Substring(frenoyLokaal.Town.IndexOf(" ") + 1),
                    Hoofd = 1
                };
                _db.ClubLokalen.Add(lokaal);
            }

            return club;
        }