Example #1
0
 public override void ExecuteAction()
 {
     using (FdoFeatureService svc = _conn.CreateFeatureService())
     {
         using (IDelete del = svc.CreateCommand <IDelete>(OSGeo.FDO.Commands.CommandType.CommandType_Delete))
         {
             try
             {
                 del.SetFeatureClassName(_className);
                 if (!string.IsNullOrEmpty(_filter))
                 {
                     del.SetFilter(_filter);
                     Info("Deleting everything from class " + _className + " with filter: " + _filter);
                 }
                 else
                 {
                     Info("Deleting everything from class: " + _className);
                 }
                 int result = del.Execute();
                 Info(result + " features deleted from class: " + _className);
             }
             catch (OSGeo.FDO.Common.Exception ex)
             {
                 Error(ex, "Error occured executing delete");
             }
         }
     }
 }
Example #2
0
 /// <summary>
 /// Deletes a coordinate system from the database
 /// </summary>
 /// <param name="cs"></param>
 /// <returns></returns>
 public bool DeleteProjection(CoordinateSystemDefinition cs)
 {
     using (var conn = CreateSqliteConnection())
     {
         conn.Open();
         using (IDelete delete = (IDelete)conn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Delete))
         {
             delete.SetFeatureClassName("Projections");
             delete.SetFilter("Name = '" + cs.Name + "'");
             if (delete.Execute() == 1)
             {
                 LoggingService.InfoFormatted("Coordinate System {0} deleted from database", cs.Name);
                 _Projections.Remove(cs);
                 return(true);
             }
         }
         conn.Close();
     }
     return(false);
 }