public static List<LegaGladio.Entities.Team> listTeam(int coachId) { LegaGladioDS.teamDataTable tdt = new LegaGladioDS.teamDataTable(); LegaGladioDSTableAdapters.teamTableAdapter tta = new LegaGladioDSTableAdapters.teamTableAdapter(); tta.FillByCoachId(tdt, coachId); List<LegaGladio.Entities.Team> teamList = new List<LegaGladio.Entities.Team>(); foreach (LegaGladioDS.teamRow tr in tdt.Rows) { LegaGladio.Entities.Team team = new LegaGladio.Entities.Team(); team.Id = tr.id; team.AssistantCoach = tr.assistantCoach; team.Cheerleader = tr.cheerleader; team.coachName = Coach.getCoachName(team.Id); //team.ListPlayer = Player.listPlayer(team.Id); team.Name = tr.name; team.Race = Race.getRaceByTeamId(team.Id); team.Reroll = tr.reroll; team.Value = tr.value; team.Active = tr.active; teamList.Add(team); } tta = null; tdt = null; return teamList; }
public static List<LegaGladio.Entities.Team> listTeam(Boolean active) { LegaGladioDS.teamDataTable tdt = new LegaGladioDS.teamDataTable(); LegaGladioDSTableAdapters.teamTableAdapter tta = new LegaGladioDSTableAdapters.teamTableAdapter(); tta.FillByActive(tdt, active); List<LegaGladio.Entities.Team> teamList = new List<LegaGladio.Entities.Team>(); foreach (LegaGladioDS.teamRow tr in tdt.Rows) { try { LegaGladio.Entities.Team team = new LegaGladio.Entities.Team(); team.Id = tr.id; team.AssistantCoach = tr.assistantCoach; team.Cheerleader = tr.cheerleader; team.coachName = Coach.getCoachName(team.Id); //team.ListPlayer = Player.listPlayer(team.Id); team.Name = tr.name; team.Race = Race.getRaceByTeamId(team.Id); team.Reroll = tr.reroll; team.Value = tr.value; team.Active = tr.active; teamList.Add(team); } catch(Exception ex) { Console.WriteLine(ex.StackTrace); } } tta = null; tdt = null; return teamList; }
public static LegaGladio.Entities.Team getTeam(int id) { LegaGladio.Entities.Team team = null; LegaGladioDS.teamDataTable ttd = null; LegaGladioDSTableAdapters.teamTableAdapter tta = null; LegaGladioDS.teamRow teamRow = null; try { team = new LegaGladio.Entities.Team(); ttd = new LegaGladioDS.teamDataTable(); tta = new LegaGladioDSTableAdapters.teamTableAdapter(); tta.FillById(ttd, id); teamRow = (LegaGladioDS.teamRow)ttd.Rows[0]; team.Id = teamRow.id; team.AssistantCoach = teamRow.assistantCoach; team.Cheerleader = teamRow.cheerleader; team.coachName = Coach.getCoachName(team.Id); team.ListPlayer = Player.listPlayer(team.Id); team.Name = teamRow.name; team.Race = Race.getRace(team.Id); team.Reroll = teamRow.reroll; team.Active = teamRow.active; team.Value = teamRow.value; } catch (Exception ex) { throw ex; } tta = null; ttd = null; return team; }