public Race() : base() { competitors = new CompetitorCollection(); competitorGroups = new CompetitorGroupCollection(); flights = new FlightCollection(); }
private void compUpdateGrid() { if (race != null) { dataGridCompetitors.Columns.Clear(); dataGridCompetitors.Columns.Add("CompetitionNumber", "Start No."); dataGridCompetitors.Columns.Add("AcCallsign", "AC Callsign"); dataGridCompetitors.Columns.Add("PilotName", "Pilot Name"); dataGridCompetitors.Columns.Add("PilotFirstName", "Pilot Firstname"); dataGridCompetitors.Columns.Add("NavigatorName", "Navigator Name"); dataGridCompetitors.Columns.Add("NavigatorFirstName", "Navigator Firstname"); dataGridCompetitors.Columns.Add("Country", "County"); dataGridCompetitors.Rows.Clear(); CompetitorCollection availableCompetitors = new CompetitorCollection(); availableCompetitors.AddRange(race.Competitors); foreach (CompetitorGroup cg in race.CompetitorGroups) { foreach(CompetitorRouteAssignment cra in cg.CompetitorRouteAssignmentCollection) { availableCompetitors.Remove(cra.Competitor); } } foreach (Competitor c in availableCompetitors) { int index = dataGridCompetitors.Rows.Add(new object[] { c.CompetitionNumber, c.AcCallsign, c.PilotName, c.PilotFirstName, c.NavigatorName, c.NavigatorFirstName, c.Country }); dataGridCompetitors.Rows[index].Tag = c; } } }
public Competition() : base() { this.mapCollection = new MapCollection(); this.competitorCollection = new CompetitorCollection(); this.raceCollection = new RaceCollection(); date = new DateTime(); }
public CompetitorGroup() : base() { id = Guid.NewGuid(); competitors = new CompetitorCollection(); startingTime = new DateTime(); parcoursTime = new TimeSpan(); competitorRouteAssignmentCollection = new CompetitorRouteAssignmentCollection(); }
public Race(string filename) : base() { competitors = new CompetitorCollection(); competitorGroups = new CompetitorGroupCollection(); flights = new FlightCollection(); map = new Map(); this.loadRace(filename); }
public void moveUp(int index) { if (index > 0 - 1) { CompetitorCollection tempList = new CompetitorCollection(); for (int i = competitors.Count - 1; i > 1; i--) { if (i == index) { tempList.Add(this.competitors[i-1]); tempList.Add(this.competitors[i]); i -= 2; } else { tempList.Add(this.competitors[i]); i--; } } this.competitors = tempList; } }
public void moveDown(int index) { if (index < this.competitors.Count - 1) { CompetitorCollection tempList = new CompetitorCollection(); for (int i = 0; i < competitors.Count - 1; i++) { if (i == index) { tempList.Add(this.competitors[i+1]); tempList.Add(this.competitors[i]); i += 2; } else { tempList.Add(this.competitors[i]); i++; } } this.competitors = tempList; } }
private void compUpdateGrid() { if (competition != null) { dataGridCompetitors.Columns.Clear(); dataGridCompetitors.Columns.Add("CompetitionNumber", "Start No."); dataGridCompetitors.Columns.Add("AcCallsign", "AC Callsign"); dataGridCompetitors.Columns.Add("PilotName", "Pilot Name"); dataGridCompetitors.Columns.Add("PilotFirstName", "Pilot Firstname"); dataGridCompetitors.Columns.Add("NavigatorName", "Navigator Name"); dataGridCompetitors.Columns.Add("NavigatorFirstName", "Navigator Firstname"); dataGridCompetitors.Columns.Add("Country", "County"); dataGridCompetitors.Rows.Clear(); CompetitorCollection avilableCompetitors = new CompetitorCollection(); foreach(Competitor comp in competition.CompetitorCollection) { avilableCompetitors.Add(comp); } foreach (CompetitorGroup grp in race.CompetitorGroups) { foreach (Competitor comp in grp.Competitors) { avilableCompetitors.Remove(comp); } } foreach (Competitor c in competition.CompetitorCollection) { int index = dataGridCompetitors.Rows.Add(new object[] { c.CompetitionNumber, c.AcCallsign, c.PilotName, c.PilotFirstName, c.NavigatorName, c.NavigatorFirstName, c.Country }); dataGridCompetitors.Rows[index].Tag = c; } } }
private void UpdateGridCompetitors(CompetitorCollection collection) { dataGridCompetitors.Rows.Clear(); foreach (Competitor c in collection) { bool isSetMemberOfRace; if (race.Competitors.Count == 0) { isSetMemberOfRace = true; } else { isSetMemberOfRace = false; } if (race.Competitors.Contains(c)) { isSetMemberOfRace = true; } int index = dataGridCompetitors.Rows.Add(new object[] { isSetMemberOfRace, null ,c.CompetitionNumber, c.AcCallsign, c.PilotName, c.PilotFirstName, c.NavigatorName, c.NavigatorFirstName, c.Country }); dataGridCompetitors.Rows[index].Tag = c; } }
private void Submit() { selectedCompetitors = new CompetitorCollection(); foreach (DataGridViewRow row in dataGridCompetitors.Rows) { if ((bool)(row.Cells["selected"]).Value) { selectedCompetitors.Add((Competitor)row.Tag); } } SubmitButtonClick(this, new EventArgs()); this.Close(); }
public void AddRange(CompetitorCollection itemCollection) { foreach (Competitor item in itemCollection) { items.Add(item); } }
public void loadRace(string filename) { BinaryFormatter binaryFormatter = new BinaryFormatter(); Stream fStream = File.OpenRead(filename); Race r = (Race)binaryFormatter.Deserialize(fStream); this.competitors = r.Competitors; this.competitorGroups = r.CompetitorGroups; this.flights = r.Flights; this.map = r.map; }