Example #1
0
        public RaceEntry(t_Race Race)
        {
            InformationPool.PilotList.Clear();
            foreach (t_Pilot p in InformationPool.Client.GetPilots())
            {
                InformationPool.PilotList.Add(p);
            }
            this.ID = Race.ID;
            this.Name = Race.Name;
            if (Race.ID_Pilot_0 > 0) this.PilotA = (int)Race.ID_Pilot_0;
            if (Race.ID_Pilot_1 > 0) this.PilotB = (int)Race.ID_Pilot_1;
            if (Race.ID_Pilot_2 > 0) this.PilotC = (int)Race.ID_Pilot_2;
            if (Race.ID_Pilot_3 > 0) this.PilotD = (int)Race.ID_Pilot_3;

            this.Polygons = new PolygonGroup();
            Polygons.ID = (int)Race.ID_PolygonGroup;
            Polygons.Name = Race.ID_PolygonGroup.ToString();
            this.StartTime = (DateTime)Race.TimeStart;
            DateTime EndTime = (DateTime)Race.TimeEnd;
            this.Duration = (decimal)(EndTime - StartTime).TotalMinutes;
        }
Example #2
0
 public RaceLst(t_Race r)
 {
     this.r = r;
 }
Example #3
0
 private void btnSaveRace_Click(object sender, EventArgs e)
 {
     t_Race r = new t_Race();
     r.Name = CurrentRace.Name;
     if (CurrentRace.PilotA != 0)
     {
         r.t_Pilot = new t_Pilot();
         r.t_Pilot.ID = CurrentRace.PilotA;
     }
     if (CurrentRace.PilotB != 0)
     {
         r.t_Pilot1 = new t_Pilot();
         r.t_Pilot1.ID = CurrentRace.PilotB;
     }
     if (CurrentRace.PilotC != 0)
     {
         r.t_Pilot2 = new t_Pilot();
         r.t_Pilot2.ID = CurrentRace.PilotC;
     }
     if (CurrentRace.PilotD != 0)
     {
         r.t_Pilot3 = new t_Pilot();
         r.t_Pilot3.ID = CurrentRace.PilotD;
     }
     r.ID_PolygonGroup = CurrentRace.Polygons.ID;
     r.t_PolygonGroup = new t_PolygonGroup();
     r.t_PolygonGroup.Name = CurrentRace.Polygons.Name;
     r.t_PolygonGroup.t_Polygons = new List<t_Polygon>();
     foreach (Polygon p in CurrentRace.Polygons.Polygons)
     {
         t_Polygon poly = new t_Polygon();
         poly.t_PolygonPoints = new List<t_PolygonPoint>();
         poly.Type = (int)p.Type;
         foreach (PolygonPoint pp in p.Points)
         {
             t_PolygonPoint temp_poly_point = new t_PolygonPoint();
             temp_poly_point.altitude = pp.Altitude;
             temp_poly_point.latitude = pp.Latitude;
             temp_poly_point.longitude = pp.Longitude;
             poly.t_PolygonPoints.Add(temp_poly_point);
         }
         r.t_PolygonGroup.t_Polygons.Add(poly);
     }
     r.t_PolygonGroup.ID = CurrentRace.Polygons.ID;
     r.TimeStart = CurrentRace.StartTime;
     r.TimeEnd = CurrentRace.StartTime.Add(new TimeSpan(0,(int)CurrentRace.Duration,0));
     InformationPool.Client.AddRace(r);
     LoadRaces();
     CurrentRace = new RaceEntry();
     SyncRace();
 }