public static List<LegaGladio.Entities.Coach> listCoach(Boolean active) { LegaGladioDS.coachDataTable cdt = new LegaGladioDS.coachDataTable(); LegaGladioDSTableAdapters.coachTableAdapter cta = new LegaGladioDSTableAdapters.coachTableAdapter(); cta.FillByActive(cdt, active); List<LegaGladio.Entities.Coach> coachList = new List<LegaGladio.Entities.Coach>(); foreach (LegaGladioDS.coachRow cr in cdt.Rows) { try { LegaGladio.Entities.Coach coach = new LegaGladio.Entities.Coach(); coach.Id = cr.id; coach.NafID = cr.nafID; coach.Name = cr.name; coach.Notes = cr.note; coach.Active = cr.active; coach.Value = cr.value; coach.ListTeam = Team.listTeam(coach.Id); coachList.Add(coach); } catch (Exception ex) { throw ex; } } cta = null; cdt = null; return coachList; }
public static LegaGladio.Entities.Coach getCoach(int id) { LegaGladio.Entities.Coach coach = null; LegaGladioDS.coachDataTable ctd = null; LegaGladioDSTableAdapters.coachTableAdapter cta = null; LegaGladioDS.coachRow coachRow = null; try { coach = new LegaGladio.Entities.Coach(); ctd = new LegaGladioDS.coachDataTable(); cta = new LegaGladioDSTableAdapters.coachTableAdapter(); cta.FillById(ctd, id); coachRow = (LegaGladioDS.coachRow)ctd.Rows[0]; coach.Id = coachRow.id; coach.ListTeam = Team.listTeam(coach.Id); coach.NafID = coachRow.nafID; coach.Name = coachRow.name; coach.Notes = coachRow.note; coach.Value = coachRow.value; } catch (Exception ex) { throw ex; } cta = null; ctd = null; return coach; }
public static Boolean updateCoach(LegaGladio.Entities.Coach coach, int oldID) { LegaGladioDSTableAdapters.coachTableAdapter cta = new LegaGladioDSTableAdapters.coachTableAdapter(); LegaGladioDS.coachDataTable cdt = new LegaGladioDS.coachDataTable(); LegaGladioDS.coachRow cr = (LegaGladioDS.coachRow)cdt.NewRow(); cr.id = oldID; cr.name = coach.Name; cr.active = coach.Active; cr.nafID = coach.NafID; cr.nafNick = coach.NafNick; cr.note = coach.Notes; cr.value = coach.Value; int result = cta.Update(cr); return result > 0; }