public static void InsertCoordinates(Polygons poly) { StringBuilder sCommand = new StringBuilder("INSERT INTO coordinates ( idIPMEvent, idPlaceInMap, seqCoordinate, longitude, latitude, createDate, lastUpdate ) VALUES "); List<string> Rows = new List<string>(); for (int i = 0; i < poly.Coords.Count; i++) { Rows.Add(string.Format("({0},{1},{2},'{3}','{4}', current_time(), current_time() )", poly.Coords[i].eventId, (int)poly.Coords[i].placeId, poly.Coords[i].seqCoordinate, poly.Coords[i].y, poly.Coords[i].x)); } sCommand.Append(string.Join(",", Rows)); sCommand.Append(";"); ExecuteQuery(sCommand); }
public static void InsertPlaceInMap(Polygons poly, long eventId ) { StringBuilder sCommand = new StringBuilder("INSERT INTO placeinmap( idIPMEvent, tag, site, idSiteType, createDate, lastUpdate, isRVSite ) Values"); List<string> Rows = new List<string>(); for (int i = 0; i < poly.Sites.Count; i++) { Rows.Add(string.Format("({0},'{1}','{2}',{3}, current_time(), current_time(), 1 )", poly.Sites[i].eventId, poly.Sites[i].tag, poly.Sites[i].name, poly.Sites[i].typeId )); } sCommand.Append(string.Join(",", Rows)); sCommand.Append(";"); ExecuteQuery(sCommand); }
public static void UpdateIsRVSite_PlaceInMap(Polygons poly) { StringBuilder sCommand = new StringBuilder("Update placeinmap set isRVSite = 0 Where ID in ("); List<string> Rows = new List<string>(); for (int i = 0; i < poly.Sites.Count; i++) { if( !poly.Sites[i].isSite ) Rows.Add(string.Format("{0}",poly.Sites[i].id)); } sCommand.Append(string.Join(",", Rows)); sCommand.Append(");"); ExecuteQuery(sCommand); }
public static void InsertSiteType(Polygons poly, long eventId) { StringBuilder sCommand = new StringBuilder("INSERT INTO sitetype( idIPMEvent, idSiteSize, idService, createDate, lastUpdate, idStyleUrl ) Values"); List<string> Rows = new List<string>(); for (int i = 0; i < poly.Types.Count; i++) { Rows.Add(string.Format("({0},{1},{2}, current_time(), current_time(), {3} )", poly.Types[i].eventId, poly.Types[i].sizeId, poly.Types[i].serviceId, poly.Types[i].styleId)); } sCommand.Append(string.Join(",", Rows)); sCommand.Append(";"); ExecuteQuery(sCommand); }
public static void InsertStyleUrl(Polygons poly, long eventId) { StringBuilder sCommand = new StringBuilder("INSERT INTO styleurl( styleUrl, backgroundColor, idIPMEvent, createDate, lastUpdate ) Values"); List<string> Rows = new List<string>(); for (int i = 0; i < poly.Styles.Count; i++) { Rows.Add(string.Format("('{0}','{1}',{2}, curdate(), curdate() )", poly.Styles[i].styleUrl, poly.Styles[i].poly_color, eventId)); } sCommand.Append(string.Join(",", Rows)); sCommand.Append(";"); ExecuteQuery(sCommand); }
static public Polygons GetInstance() { if (_instance == null) _instance = new Polygons(); return _instance; }
public KMLParser() { polys = Polygons.GetInstance(); }
public void resetPolygons(Polygons poly, long eventId, long year) { if (poly.eventId != eventId || !poly.Initialized) { poly.AddSize(sizes.GetAll()); poly.AddService(services.GetAll()); poly.AddStyle(styles.GetQueryable().Where(x => x.idIPMEvent == eventId).OrderByDescending(x => x.ID).ToList()); poly.AddType(types.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); poly.AddSite(places.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); poly.AddCoordinates(coords.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); poly.UpdateSite(status.GetQueryable().Where(x => x.Year == year).ToList()); poly.Initialized = true; poly.eventId = eventId; } }