Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. List<TeamModel> teams = teamFileName.FullFilePath().LoadFile().ConvertToTeamModels(peopleFileName);
  2.  
  3. List<PrizeModel> prizes = prizeFileName.FullFilePath().LoadFile().ConvertToPrizeModels();
  4.  
  5. List<MatchupModel> matchups = GlobalConfig.MatchupFile.FullFilePath().LoadFile().ConvertToMatchupModels();
  6.  
  7. foreach (string line in lines)
  8. {
  9. string[] cols = line.Split(',');
  10.  
  11. TournamentModel tm = new TournamentModel();
  12. tm.Id = int.Parse(cols[0]);
  13. tm.TournamentName = cols[1];
  14. tm.EntryFee = decimal.Parse(cols[2]);
  15.  
  16. string[] teamIds = cols[3].Split('|');
  17.  
  18. foreach (string id in teamIds)
  19. {
  20. tm.EnteredTeams.Add(teams.Where(x => x.Id == int.Parse(id)).First());
  21. }
  22.  
  23. string[] prizeIds = cols[4].Split('|');
  24. foreach (string id in prizeIds)
  25. {
  26. tm.Prizes.Add(prizes.Where(x => x.Id == int.Parse(id)).First());
  27. }
  28.  
  29. string[] rounds = cols[5].Split('|');
  30. List<MatchupModel> ms = new List<MatchupModel>();
  31.  
  32. foreach (string round in rounds)
  33. {
  34. string[] msText = round.Split('^');
  35.  
  36. foreach (string matchupModelTextId in msText)
  37. {
  38. ms.Add(matchups.Where(x => x.Id == int.Parse(matchupModelTextId)).First());
  39. }
  40. tm.Rounds.Add(ms);
  41. }
  42.  
  43. output.Add(tm);
  44. }
  45.  
  46. return output;
  47. }
  48.  
  49. tm.EnteredTeams.Add(teams.Where(x => id != "null" && x.Id == int.Parse(id)).First());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement