protected override bool ConditionsIsEnough(IContextMessage contextMessage) { if (_dbConnection == null) { contextMessage.AddError("数据库连接对象为空。"); return(false); } try { _dbConnection.Open(); } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } try { _metadata = new BudGISMetadata(); } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } return(true); }
protected override bool ConditionsIsEnough(IContextMessage contextMessage) { if (string.IsNullOrEmpty(_filename)) { contextMessage.AddError("没有设置要创建的dbf文件名称。"); return(false); } if (_fieldDefs == null || _fieldDefs.Length == 0) { contextMessage.AddError("没有设置地段列表。"); return(false); } return(true); }
protected override bool ConditionsIsEnough(IContextMessage contextMessage) { if (string.IsNullOrEmpty(_shapefile)) { contextMessage.AddError("没有设置矢量文件名。"); return(false); } if (string.IsNullOrEmpty(_dbffile)) { contextMessage.AddError("没有设置目标dBase文件名。"); return(false); } if (_fieldMaps == null || _fieldMaps.Length == 0) { contextMessage.AddError("没有设置字段映射关系。"); return(false); } return(true); }
protected override bool Execute(IContextMessage contextMessage) { try { SpatialDbBuilder builder = new SpatialDbBuilder(_dbConnection); builder.Build(_dbConnection, _metadata, _tracker); return(true); } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } }
protected override bool Execute(IContextMessage contextMessage) { try { IUniversalVectorDataReader urd = VectorDataReaderFactory.GetUniversalDataReader(_filename); if (urd == null) { contextMessage.AddError("读取矢量文件\"" + _filename + "\"失败。"); return(false); } Feature[] fets = (urd as IVectorFeatureDataReader).Features; using (IDataImporter imp = new DataImporter()) { imp.Import(fets, _featureClassDef, _dbConnection, _tracker); } return(true); } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } }
protected override bool Execute(IContextMessage contextMessage) { IVectorFeatureDataReader vdr = null; OdbcConnection conn = null; OdbcCommand cmd = null; try { if (!ResFieldIsOK(out vdr)) { contextMessage.AddError("字段映射关系中源字段设置有错误。"); return(false); } if (!DesFieldIsOK(out conn, out cmd)) { contextMessage.AddError("字段映射关系中目标字段设置有错误。"); return(false); } ImportFeatures(conn, cmd, vdr); return(true); } finally { if (vdr != null) { vdr.Dispose(); } if (cmd != null) { cmd.Dispose(); } if (conn != null) { conn.Dispose(); } } }
protected override bool ConditionsIsEnough(IContextMessage contextMessage) { if (_inputDataSource == null) { contextMessage.AddError("要导入的数据对象没有设置。"); return(false); } if (_outputDataSource == null) { contextMessage.AddError("目标位置对象没有设置。"); return(false); } if (string.IsNullOrEmpty(_name)) { contextMessage.AddError("要素类名称没有输入。"); return(false); } if (string.IsNullOrEmpty(_displayName)) { contextMessage.AddError("显示名称没有输入。"); return(false); } return(true); }
protected override bool Execute(IContextMessage contextMessage) { try { using (IFetClassImporter imp = FetClassImporterFactory.GetImporter(_inputDataSource, _outputDataSource)) { if (imp != null) { imp.Import(_inputDataSource, _outputDataSource, _tracker, _tablename, _displayName, _description); return(true); } } } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } return(false); }
protected override bool ConditionsIsEnough(IContextMessage contextMessage) { if (_dbConnection == null) { contextMessage.AddError("数据库连接对象为空。"); return(false); } try { _dbConnection.Open(); } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } if (_filename == null) { contextMessage.AddError("矢量文件名为空。"); return(false); } try { if (!File.Exists(_filename)) { contextMessage.AddError("矢量文件\"" + _filename + "\"不存在。"); return(false); } } catch (Exception ex) { contextMessage.AddError(ex.Message); return(false); } if (string.IsNullOrEmpty(_tablename)) { contextMessage.AddError("要素类名称为空。"); return(false); } return(true); }