public void loadMoveFiles(string inFileName) { List <base_move> myMoveSites = new List <base_move>(); IFeatureSet fs = FeatureSet.Open(inFileName); DataTable dt = fs.DataTable; for (int i = 0; i < dt.Rows.Count; i++) { base_move move = new base_move(); IFeature f = fs.Features[i]; move.geom = DbGeometry.FromText(f.BasicGeometry.ToString()); move.CROSSING = GetNullableDouble(dt.Rows[i], "CROSSING"); move.ENERGYUSED = GetNullableDouble(dt.Rows[i], "ENERGYUSED"); move.MSL = GetLong(dt.Rows[i], "MSL"); move.MVL = GetNullableDouble(dt.Rows[i], "MVL"); move.PR_X = GetNullableDouble(dt.Rows[i], "PR_X"); myMoveSites.Add(move); } using (me = new MapEntites()) { me.Database.ExecuteSqlCommand("Truncate Table [base_move]"); me.base_move.AddRange(myMoveSites); me.SaveChanges(); } }
public base_move GetMoveSite(DbGeometry inLocation) { base_move bm = null; using (DataMapsEntities me = new DataMapsEntities()) { bm = me.base_move.Where(f => f.geom.Contains(inLocation)).FirstOrDefault() as base_move; } return(bm); }