partial void Deletet_PolygonGroup(t_PolygonGroup instance);
partial void Updatet_PolygonGroup(t_PolygonGroup instance);
/// <summary> /// Return a list of all Racecs /// </summary> /// <returns>List of Racecs</returns> public List<t_PolygonGroup> GetPolygonGroup() { try { LogManager.AddLog(DB_PATH, 4, "ANRLDataService.svc.cs:GetParcours", ""); DatabaseDataContext dataContext = new DatabaseDataContext(DB_PATH); List<t_PolygonGroup> tmp = new List<t_PolygonGroup>(); foreach (t_PolygonGroup pg in dataContext.t_PolygonGroups) { t_PolygonGroup tmppg = new t_PolygonGroup(); tmppg.ID = pg.ID; tmppg.Name = pg.Name; tmp.Add(tmppg); } return tmp; } catch (Exception ex) { LogManager.AddLog(DB_PATH, 0, "ANRLDataService.svc.cs:GetPolygonGroup", ex.ToString()); } return null; }
partial void Insertt_PolygonGroup(t_PolygonGroup instance);
/// <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()); } }