Exemplo n.º 1
0
        private void determinatePoints(string sectionResult, SoccerTeam local, SoccerTeam visitant)
        {
            string [] marker = sectionResult.Split('-');

            int goalsLocal    = int.Parse(marker[0]);
            int goalsVisitant = int.Parse(marker[1]);

            determinateAddToList(local);
            determinateAddToList(visitant);

            SoccerTeam teamLocal    = findTeam(local.Team);
            SoccerTeam teamVisitant = findTeam(visitant.Team);

            if (goalsLocal > goalsVisitant)
            {
                teamLocal.Points += 3;
            }
            else if (goalsLocal < goalsVisitant)
            {
                teamVisitant.Points += 3;
            }
            else
            {
                teamLocal.Points    += 1;
                teamVisitant.Points += 1;
            }
        }
Exemplo n.º 2
0
 private void determinateAddToList(SoccerTeam team)
 {
     if (searchTeam(team))
     {
     }
     else
     {
         Teams.Add(team);
     }
 }
Exemplo n.º 3
0
 private Boolean searchTeam(SoccerTeam teamSearch)
 {
     if (Teams.Exists(team => team.Team == teamSearch.Team))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        private SoccerTeam findTeam(string nameOfTeam)
        {
            SoccerTeam teamFind = Teams.Find(team => team.Team.Contains(nameOfTeam));

            if (teamFind != null)
            {
                return(teamFind);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 private void fillSoccerTeamList(string line)
 {
     if (line != string.Empty)
     {
         string[]   sections  = line.Split(',');
         string     local     = getNameOfTeam(sections[2]);
         string     visitant  = getNameOfTeam(sections[5]);
         SoccerTeam teamLocal = new SoccerTeam();
         teamLocal.Team = local;
         SoccerTeam teamVisitant = new SoccerTeam();
         teamVisitant.Team = visitant;
         determinatePoints(sections[3], teamLocal, teamVisitant);
     }
     else
     {
         Console.WriteLine("El argumento esta vacio");
     }
 }
Exemplo n.º 6
0
        private void fillGameList(string line)
        {
            if (line != string.Empty)
            {
                SoccerTeam localTeam    = new SoccerTeam();
                SoccerTeam visitantTeam = new SoccerTeam();
                string []  sections     = line.Split(',');
                localTeam.Team    = getNameOfTeam(sections[2]);
                visitantTeam.Team = getNameOfTeam(sections[5]);
                DateTime      date   = formatTheDate(sections[1]);
                ResultOfMatch result = determinateResult(sections[3]);
                Game          game   = new Game();
                game.Local          = localTeam;
                game.Visitant       = visitantTeam;
                game.Date           = date;
                game.fullTimeResult = result;

                Games.Add(game);
            }
        }