Exemple #1
0
 partial void Deletet_Race(t_Race instance);
Exemple #2
0
 partial void Insertt_Race(t_Race instance);
Exemple #3
0
 partial void Updatet_Race(t_Race instance);
Exemple #4
0
		private void detach_t_Races(t_Race entity)
		{
			this.SendPropertyChanging();
			entity.t_PolygonGroup = null;
		}
Exemple #5
0
		private void detach_t_Races3(t_Race entity)
		{
			this.SendPropertyChanging();
			entity.t_Pilot3 = null;
		}
Exemple #6
0
		private void attach_t_Races3(t_Race entity)
		{
			this.SendPropertyChanging();
			entity.t_Pilot3 = this;
		}
Exemple #7
0
 /// <summary>
 /// Return a list of all Racecs
 /// </summary>
 /// <returns>List of Racecs</returns>
 public List<t_Race> GetRaces()
 {
     try
     {
         LogManager.AddLog(DB_PATH, 4, "ANRLDataService.svc.cs:GetRaces", "");
         DatabaseDataContext dataContext = new DatabaseDataContext(DB_PATH);
         List<t_Race> tmp = new List<t_Race>();
         foreach (t_Race r in dataContext.t_Races)
         {
             t_Race race = new t_Race();
             race.ID = r.ID;
             race.ID_Pilot_0 = r.ID_Pilot_0;
             race.ID_Pilot_1 = r.ID_Pilot_1;
             race.ID_Pilot_2 = r.ID_Pilot_2;
             race.ID_Pilot_3 = r.ID_Pilot_3;
             race.ID_PolygonGroup = r.ID_PolygonGroup;
             race.Name = r.Name;
             race.TimeEnd = r.TimeEnd;
             race.TimeStart = r.TimeStart;
             tmp.Add(race);
         }
         return tmp;
     }
     catch (Exception ex)
     {
         LogManager.AddLog(DB_PATH, 0, "ANRLDataService.svc.cs:GetRaces", ex.ToString());
     }
     return null;
 }
Exemple #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Race"></param>
        public void AddRace(t_Race Race)
        {
            try
            {
                LogManager.AddLog(DB_PATH, 4, "ANRLDataService.svc.cs:AddRace", "");
                DatabaseDataContext dataContext = new DatabaseDataContext(DB_PATH);
                t_PolygonGroup PolygonGroup = new t_PolygonGroup();

                #region Polygongroup & Polygons & PolygonPoints
                if (Race.t_PolygonGroup != null)
                {
                    if (Race.ID_PolygonGroup == 0)
                    {
                        PolygonGroup.Name = Race.t_PolygonGroup.Name;
                        dataContext.t_PolygonGroups.InsertOnSubmit(PolygonGroup);
                        dataContext.SubmitChanges();

                        if (Race.t_PolygonGroup.t_Polygons.Count > 0)
                        {
                            foreach (t_Polygon poly in Race.t_PolygonGroup.t_Polygons)
                            {
                                t_Polygon tmp_poly = new t_Polygon();
                                tmp_poly.Type = poly.Type;
                                tmp_poly.ID_PolygonGroup = PolygonGroup.ID;
                                dataContext.t_Polygons.InsertOnSubmit(tmp_poly);
                                dataContext.SubmitChanges();
                                foreach (t_PolygonPoint pp in poly.t_PolygonPoints)
                                {
                                    t_PolygonPoint tmpPoint = new t_PolygonPoint();
                                    tmpPoint.ID_Polygon = tmp_poly.ID;
                                    tmpPoint.longitude = pp.longitude;
                                    tmpPoint.latitude = pp.latitude;
                                    tmpPoint.altitude = pp.altitude;
                                    dataContext.t_PolygonPoints.InsertOnSubmit(tmpPoint);
                                }
                            }
                        }
                    }
                    else
                    {
                        PolygonGroup.ID = (int)Race.ID_PolygonGroup;
                    }
                    dataContext.SubmitChanges();
                }
                #endregion
                t_Race r = new t_Race();
                if (Race.ID_Pilot_0 != 0) r.ID_Pilot_0 = Race.ID_Pilot_0;
                if (Race.ID_Pilot_1 != 0) r.ID_Pilot_1 = Race.ID_Pilot_1;
                if (Race.ID_Pilot_2 != 0) r.ID_Pilot_2 = Race.ID_Pilot_2;
                if (Race.ID_Pilot_3 != 0) r.ID_Pilot_3 = Race.ID_Pilot_3;
                if (Race.ID_PolygonGroup != 0)
                {
                    r.ID_PolygonGroup = Race.ID_PolygonGroup;
                }
                else
                {
                    r.ID_PolygonGroup = PolygonGroup.ID;
                }
                r.Name = Race.Name;
                r.TimeEnd = Race.TimeEnd;
                r.TimeStart = Race.TimeStart;
                dataContext.t_Races.InsertOnSubmit(r);
                dataContext.SubmitChanges();
                LogManager.AddLog(DB_PATH, 4, "ANRLDataService.svc.cs:AddRace", "Sucessfull Added " + r.ID);
            }
            catch (Exception ex)
            {
                LogManager.AddLog(DB_PATH, 0, "ANRLDataService.svc.cs:AddRace", ex.ToString());
            }
        }