public string CopyToAfter(MapControlTools mapControlTools)
        {
            // copy the current hazard map to hazardmapafter
            using (DB.ResTBContext db = new DB.ResTBContext())
            {
                HazardMap hm = db.HazardMaps.Include(m => m.Project).Include(m => m.NatHazard).OrderByDescending(u => u.ID).FirstOrDefault();
                if (hm.Project.Id == Project)
                {
                    string copySQL = "insert into \"HazardMap\" (\"Index\",\"BeforeAction\", \"NatHazard_ID\" , \"Project_Id\" , geometry ) " +
                                     "select \"Index\" , false, \"NatHazard_ID\" , \"Project_Id\" , geometry from " +
                                     "\"HazardMap\" where \"ID\" = " + hm.ID;
                    db.Database.ExecuteSqlCommand(copySQL);


                    ResTBHazardMapLayer hazard = new ResTBHazardMapLayer(
                        Project, false, NatHazard, Index);

                    if (!mapControlTools.Layers.Where(m => m.Name.Equals(hazard.Name)).Any())
                    {
                        mapControlTools.AddProjectLayer(hazard);
                    }

                    return(hazard.Name);
                }
            }
            return("");
        }
 public bool StartEditingLayer(ResTBHazardMapLayer hazardMapLayer, bool saveAndStopWhenFinish = false)
 {
     if (!MapControlTools.Layers.Where(m => m.Name.Equals(hazardMapLayer.Name)).Any())
     {
         MapControlTools.AddProjectLayer(hazardMapLayer);
     }
     return(StartEditingLayer(MapControlTools.Layers.Where(m => m.Name.Equals(hazardMapLayer.Name)).Select(m => m.Name).First(), saveAndStopWhenFinish));
 }