public ActionResult SaveParsedObjects(int eventId, List <string> styleInfo) { long sessionID = sessionService.GetSessionID(this.HttpContext, true, true); string errMsg = "Please check input information"; bool ret = styleInfo == null ? false : styleInfo.Count == 0 ? false : verifyTypeAndStyle(styleInfo, out errMsg); // if succed deletion, process insertion. if (ret && DeleteEventObjects(eventId)) { Polygons poly = Polygons.GetInstance(); // save styleUrl MySqlBulkInsert.InsertStyleUrl(poly, eventId); // -> retrieve styleUrl to link type's styleUrl poly.AddStyle(styles.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); // set type's styleUrl updateType_idStyleUrl(eventId, styleInfo); // -> retrieve siteType to link placeinmap's siteType poly.AddType(types.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); // -> build site's siteType poly.MakeSiteRelation(eventId); // save placeinmap MySqlBulkInsert.InsertPlaceInMap(poly, eventId); // -> retrieve placeinmap to link coordinate's placeinmap poly.AddSite(places.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); // set coord's placeId poly.SetPlaceIdInCoords(); // save coordinates MySqlBulkInsert.InsertCoordinates(poly); // -> retrieve coordinate to change init=true poly.AddCoordinates(coords.GetQueryable().Where(x => x.idIPMEvent == eventId).ToList()); // update placeinmap with isRVSite MySqlBulkInsert.UpdateIsRVSite_PlaceInMap(poly); //poly.Initialized = true; //poly.eventId = eventId; // reset msg with no error errMsg = ""; } // return return(Json(new { success = ret, msg = errMsg }, JsonRequestBehavior.AllowGet)); }
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; } }
// partial view of DigitizeMap() public ActionResult SiteUrl(long eventId) { Polygons poly = Polygons.GetInstance(); if (poly.Styles.Count == 0 || poly.Styles[0].eventId != eventId) { poly.AddStyle(styles.GetQueryable().Where(x => x.idIPMEvent == eventId).OrderByDescending(x => x.ID).ToList()); } var _urls = poly.Styles.Where(x => x.eventId == eventId).ToList(); ViewBag.styleCount = _urls.Count; ViewBag.eventId = eventId; ViewBag.types = typeRates.GetQueryable().Where(x => x.eventId == eventId).ToList(); return(PartialView("SiteUrl", _urls)); }