public SiteSurvey Result(ref Site s) { SiteSurvey survey = new SiteSurvey(); survey.Coord = Coord; survey.Region = Region; survey.Shielding = Shielding; survey.MzCat = MzCat; // TerrainCategory; survey.Topographic = Topographic; survey.Vsit = Vsit; // for DB write back s.Structure = (int)StructureTypes.Residential; s.Region = Region; s.DesignSpeed = Vsit; s.Shielding = Shielding; s.TerrainCategory = Maps.TerrainCategoryAsDouble(TerrainCategory); s.Topography = MzCat; s.Date = DateTime.Now; // write out location data point string point = string.Format("POINT({0} {1})", Coord.longitude, Coord.latitude); s.Location = System.Data.Spatial.DbGeography.PointFromText(point, 4326); return(survey); }
public ActionResult Create(SiteViewModel model) { if (ModelState.IsValid) { SiteCoord sc = Maps.GetLocForAddress(model.Address); string region = Maps.GetRegion(sc); //Mapper.Map<Site>(model); Site s = new Site() { Address = model.Address, Height = model.Height }; try { DesignWindCalculation calc = new DesignWindCalculation(); double designSpeed = calc.For(s); SiteSurvey survey = new SiteSurvey(); survey = calc.Result(ref s); } catch(Exception e) { } db.Sites.Add(s); db.SaveChanges(); return RedirectToAction("Edit", new { id = s.Id } ); } return View(model); }
public SiteSurvey Result(ref Site s) { SiteSurvey survey = new SiteSurvey(); survey.Coord = Coord; survey.Region = Region; survey.Shielding = Shielding; survey.MzCat = MzCat; // TerrainCategory; survey.Topographic = Topographic; survey.Vsit = Vsit; // for DB write back s.Structure = (int)StructureTypes.Residential; s.Region = Region; s.DesignSpeed = Vsit; s.Shielding = Shielding; s.TerrainCategory = Maps.TerrainCategoryAsDouble(TerrainCategory); s.Topography = MzCat; s.Date = DateTime.Now; // write out location data point string point = string.Format("POINT({0} {1})", Coord.longitude, Coord.latitude); s.Location = System.Data.Spatial.DbGeography.PointFromText(point, 4326); return survey; }