示例#1
0
 public static async Task<SeasonsResponse> GetPopulatedSeasons(Team team)
 {
     string seasons = await MakeApiCallGet(String.Format(ServiceAccessor.URL_SERVICE_GET_SEASONS_BY_TEAM, team.teamID), true);
     if (!string.IsNullOrEmpty(seasons) && seasons != NO_CONNECTION)
     {
         try
         {
             BindableCollection<Season> seasonsList = new BindableCollection<Season>();
             List<CategoryDTO> obj = JsonConvert.DeserializeObject<List<CategoryDTO>>(seasons);
             foreach (CategoryDTO cat in obj)
             {
                 seasonsList.Add(new Season(cat, team));
             }
             return new SeasonsResponse { status = SERVICE_RESPONSE.SUCCESS, Seasons = seasonsList };
         }
         catch (Exception)
         {
             return new SeasonsResponse { status = SERVICE_RESPONSE.DESERIALIZATION };
         }
     }
     else if (seasons == NO_CONNECTION)
     {
         return new SeasonsResponse { status = SERVICE_RESPONSE.NO_CONNECTION };
     }
     else
     {
         return new SeasonsResponse { status = SERVICE_RESPONSE.NULL_RESPONSE };
     }
 }
示例#2
0
 public async Task<BindableCollection<Season>> GetPopulatedSeasons(Team team)
 {
     SeasonsResponse response = await ServiceAccessor.GetPopulatedSeasons(team);
     if (response.status == SERVICE_RESPONSE.SUCCESS)
     {
         return response.Seasons;
     }
     return null;
 }
示例#3
0
 public static Season FromDTO(SeasonDTO seasonDTO, Team team)
 {
     Season s = new Season();
     s.owningTeam = team;
     s.name = seasonDTO.Name;
     s.seasonId = seasonDTO.SeasonId;
     s.year = seasonDTO.Year;
     return s;
 }
示例#4
0
 public static Team FromDTO(TeamDTO teamDTO)
 {
     Team team = new Team();
     team.name = teamDTO.Name;
     team.school = teamDTO.School.Name;
     team.teamID = teamDTO.TeamId;
     foreach (SeasonDTO seasonDTO in teamDTO.Seasons)
     {
         team.seasons.Add(Season.FromDTO(seasonDTO, team));
     }
     return team;
 }
示例#5
0
        public Season(CategoryDTO cat, Team team)
        {
            seasonId = cat.CategoryId;
            owningTeam = team;

            //this method of making a season doesn't have a year, so we just choose the first year listed in the name
            int yearInt;
            int.TryParse(cat.Name.Substring(0, 4), out yearInt);
            year = yearInt;

            name = cat.Name;
            games = new BindableCollection<Game>();
            foreach (CategoryDTO subCat in cat.SubCategories)
            {
                games.Add(Game.FromDTO(subCat));
            }
        }