static public bool IncludeAttributeList(IAttributeListContainer Including, IAttributeListContainer Included, string ListName, bool Initialize) { bool res = false; if (Including == null || Included == null) { return(res); } IAttributeList toAdd = Included.GetList(ListName); IAttributeList addTo = Including.GetList(ListName); if (toAdd == null || addTo == null) { return(res); } for (int i = 0; i < toAdd.Count; i++) { INamedAttribute na = toAdd.Item(i); if (addTo.Find(na.Name) == null) { addTo.Add(na); res = true; } } if (res) { UpdateLists(Including, false); } return(res); }
internal SchemaElement(XmlSchemaElement element) { thisSchemaElement = element; thisSchemaTypeName = null; thisSubstitutionGroup = null; thisUnhandledAttributes = null; }
internal Node(XmlNode node) { thisNode = node; thisAttributeList = null; thisChildNodeList = null; thisParentNode = null; thisFirstChild = null; }
static public bool CloneAttributeList(IAttributeListContainer From, IAttributeListContainer To, string ListName, bool Initialize) { IAttributeList toAdd = null; if (From != null) { toAdd = From.GetList(ListName); if (toAdd != null) { toAdd = toAdd.Clone(); } } if (toAdd == null) { switch (ListName) { case "ColorList": toAdd = new ColorList(); break; case "LayerList": toAdd = new LayerList(); break; case "HatchStyleList": toAdd = new HatchStyleList(); break; case "DimensionStyleList": toAdd = new DimensionStyleList(); break; case "LineWidthList": toAdd = new LineWidthList(); break; case "LinePatternList": toAdd = new LinePatternList(); break; case "StyleList": toAdd = new StyleList(); break; default: return(false); } if (Initialize) { toAdd.Initialize(); } } To.Add(ListName, toAdd); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="AttributeListMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The agencySchemeMutable target. /// </param> public AttributeListMutableCore(IAttributeList objTarget) : base(objTarget) { this._attributes = new List<IAttributeMutableObject>(); if (objTarget.Attributes != null) { foreach (IAttributeObject currentAttribute in objTarget.Attributes) { this._attributes.Add(new AttributeMutableCore(currentAttribute)); } } }
/// <summary> /// Tests the attributes in the list against the attributes in another /// list for equality. /// </summary> /// <param name="otherAttributeList"> /// The other attribute list to compare against thie list. /// </param> /// <param name="containingFragment"> /// The fragment containing the attributes. /// </param> /// <returns> /// True if the attribute lists are equal; false otherwise. /// </returns> public bool StructureEquals(IAttributeList otherAttributeList, XbrlFragment containingFragment) { if (otherAttributeList == null) { return(false); } if (this.Count != otherAttributeList.Count) { return(false); } foreach (var currentAttribute in thisAttributeList) { var matchingAttribute = otherAttributeList[currentAttribute.Name]; if (matchingAttribute == null) { return(false); } if (currentAttribute.TypedValueEquals(matchingAttribute, containingFragment) == false) { return(false); } } return(true); }
/// <summary> /// 执行检查 /// </summary> /// <param name="AppHk"></param> public void ExcuteCheck(Plugin.Application.IAppGISRef AppHk) { Plugin.Application.IAppFormRef pAppForm = AppHk as Plugin.Application.IAppFormRef; ISchemeProject m_pProject = null; //数据库结构文件对象 int m_DBScale = 0; //默认比例尺 int m_DSScale = 0; //数据集比例尺 ///从图层上获取所有的要素类 /// IMap CurMap = AppHk.MapControl.Map as IMap; //获得当前地图对象 Dictionary <string, ILayer> pLayerDic = new Dictionary <string, ILayer>(); //记录加载到map上的图层对象 for (int i = 0; i < CurMap.LayerCount; i++) { ILayer player = CurMap.get_Layer(i); //如果是图层组,则退出不做检查 if (player is IGroupLayer) { ICompositeLayer pComLayer = player as ICompositeLayer; for (int k = 0; k < pComLayer.Count; k++) { ILayer mmLayer = pComLayer.get_Layer(k); if (mmLayer == null) { continue; } IFeatureLayer mmFeaLyer = mmLayer as IFeatureLayer; if (mmFeaLyer == null) { continue; } IDataset mDT = mmFeaLyer.FeatureClass as IDataset; string tempName = mDT.Name; if (tempName.Contains(".")) { tempName = tempName.Substring(tempName.IndexOf('.') + 1); } if (!pLayerDic.ContainsKey(tempName)) { pLayerDic.Add(tempName, mmLayer); } } continue; } IFeatureLayer pFeatlayer = player as IFeatureLayer; if (pFeatlayer == null) { continue; } IDataset pdataset = pFeatlayer.FeatureClass as IDataset; string tempNm = pdataset.Name; if (tempNm.Contains(".")) { tempNm = tempNm.Substring(tempNm.IndexOf('.') + 1); } if (player != null && !pLayerDic.ContainsKey(tempNm)) { pLayerDic.Add(tempNm, player); } } ///读取配置方案到对象 /// m_pProject = new SchemeProjectClass(); //创建实例 m_pProject.Load(this._DBSchemaDocPath, e_FileType.GO_SCHEMEFILETYPE_MDB); //加载schema文件 if (m_pProject != null) { #region 获得比例尺信息 string DBScale = m_pProject.get_MetaDataValue("Scale") as string; //获取比例尺信息(总工程中的默认比例尺) string[] DBPScaleArayy = DBScale.Split(':'); m_DBScale = Convert.ToInt32(DBPScaleArayy[1]); #endregion IChildItemList pProjects = m_pProject as IChildItemList; //获取属性库集合信息 ISchemeItem pDBList = pProjects.get_ItemByName("ATTRDB"); IChildItemList pDBLists = pDBList as IChildItemList; //遍历属性库集合 long DBNum = pDBLists.GetCount(); for (int i = 0; i < DBNum; i++) { m_DSScale = 0; //比例尺信息 //取得属性库信息 ISchemeItem pDB = pDBLists.get_ItemByIndex(i); ///获取数据集的比例尺信息,如果获取失败则,取默认比例尺信息 IAttribute pa = pDB.AttributeList.get_AttributeByName("Scale") as IAttribute; if (pa == null) { m_DSScale = m_DBScale; } else { string[] DBScaleArayy = pa.Value.ToString().Split(':'); m_DSScale = Convert.ToInt32(DBScaleArayy[1]); } IChildItemList pDBs = pDB as IChildItemList; string pDatasetName = pDB.Name; ////遍历属性表 int TabNum = pDBs.GetCount(); for (int j = 0; j < TabNum; j++) { //获取属性表信息 ISchemeItem pTable = pDBs.get_ItemByIndex(j); //获取属性表对象 string pFeatureClassName = pTable.Name; //要素类名称 ///检查图层是否存在 if (!pLayerDic.ContainsKey(pFeatureClassName)) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "要素类缺失"; this._StructErrorEventArgs.ErrDescription = "该要素类在标准中存在,却在当前数据中不存在"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); this.OnProgressStep(AppHk, j + 1, TabNum); continue; } #region 检查要素类类型是否与配置方案一致 string pFeatureClassType = pTable.Value as string; //要素类类型 ///检查图层类型是否一致 /// ILayer player; bool GetlyrSeccess = pLayerDic.TryGetValue(pFeatureClassName, out player); if (GetlyrSeccess) { IFeatureLayer pFeatureLayer = player as IFeatureLayer; switch (pFeatureClassType) { case "ANNO": if (pFeatureLayer.FeatureClass.FeatureType != esriFeatureType.esriFTAnnotation) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "要素类类型不一致"; this._StructErrorEventArgs.ErrDescription = "该要素类在标准中被定义为注记类型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "POINT": if (pFeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "要素类类型不一致"; this._StructErrorEventArgs.ErrDescription = "该要素类在标准中被定义为点要素类型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "LINE": if (pFeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "要素类类型不一致"; this._StructErrorEventArgs.ErrDescription = "该要素类在标准中被定义为线要素类型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "AREA": if (pFeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "要素类类型不一致"; this._StructErrorEventArgs.ErrDescription = "该要素类在标准中被定义为面要素类型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; default: break; } } else { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "获取要素类失败"; this._StructErrorEventArgs.ErrDescription = "获取图层失败"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); this.OnProgressStep(AppHk, j + 1, TabNum); continue; } #endregion //遍历字段 IAttributeList pAttrs = pTable.AttributeList; long FNum = pAttrs.GetCount(); //检查非GIS平台定义的字段 IFeatureLayer pChecklyr = player as IFeatureLayer; IFeatureClass pFeatureClass = pChecklyr.FeatureClass; IFields fields = pFeatureClass.Fields; //循环属性表中的字段,添加到arcgis的字段对象中 for (int k = 0; k < FNum; k++) { //添加自定义属性字段 CheckFields(pAttrs, k, fields, pFeatureClassName, AppHk); } this.OnProgressStep(AppHk, j + 1, TabNum); } } } else { SetCheckState.Message(pAppForm, "提示", "加载配置方案失败!"); } }
/// <summary> /// 根据输入的字段属性对象,检查属性字段是否与标准中定义的一致 /// </summary> /// <param name="pAttrs"></param> /// <param name="k"></param> /// <param name="fields"></param> private void CheckFields(IAttributeList pAttrs, int k, IFields fields, string pFeatureClassName, Plugin.Application.IAppGISRef AppHk) { //获取基本属性信息 IAttribute pAttr = pAttrs.get_AttributeByIndex(k); //获取扩展属性信息 IAttributeDes pAttrDes = pAttr.Description; ///检查是否存在该名称的字段 /// int i = fields.FindField(pAttr.Name); if (i < 0) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段缺失"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中不存在 " + pAttr.Name + " 字段,而该字段已经在标准中定义"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); return; } IField pField = fields.get_Field(i); #region 字段类型检查 ///检查字段类型是否一致 /// string pfieldType = pAttr.Type.ToString(); switch (pfieldType) { case "GO_VALUETYPE_STRING": if (pField.Type != esriFieldType.esriFieldTypeString) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段类型不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段类型被定义为字符串型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "GO_VALUETYPE_LONG": if (pField.Type != esriFieldType.esriFieldTypeInteger) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段类型不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段类型被定义为长整形型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "GO_VALUETYPE_BOOL": break; case "GO_VALUETYPE_DATE": if (pField.Type != esriFieldType.esriFieldTypeDate) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段类型不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段类型被定义为日期型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "GO_VALUETYPE_FLOAT": if (pField.Type != esriFieldType.esriFieldTypeSingle) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段类型不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段类型被定义为浮点型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; case "GO_VALUETYPE_DOUBLE": if (pField.Type != esriFieldType.esriFieldTypeDouble) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "属性字段类型不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段类型被定义为双精度型"; this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } break; default: break; } #endregion #region 字段长度检查 if (pfieldType != "GO_VALUETYPE_DOUBLE") { if (pField.Length != Convert.ToInt32(pAttrDes.InputWidth)) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "字段扩展属性不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段的长度属性在标准中的定义为" + pAttrDes.InputWidth.ToString(); this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } } #endregion #region 字段可否为空检查 if (pField.IsNullable != pAttrDes.AllowNull) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "字段扩展属性不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段的是否可为空属性在标准中的定义为" + pAttrDes.AllowNull.ToString(); this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } #endregion #region 字段是否必须存在检查 if (pField.Required != bool.Parse(pAttrDes.Necessary.ToString())) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "字段扩展属性不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段的是否为必须属性在标准中的定义为" + pAttrDes.Necessary.ToString(); this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } #endregion #region 字段是否可编辑检查 #endregion #region 字段值域是否可变检查 #endregion #region 字段精度检查 //双精度类型不可设置精度(在PDB和GDB中不会出现错误,但是在SDE中会抛出“无效的列”错误) if (pfieldType != "GO_VALUETYPE_DOUBLE") { if (pField.Precision != Convert.ToInt32(pAttrDes.PrecisionEx)) { ///触发错误事件 this._StructErrorEventArgs.ErrorName = "字段扩展属性不一致"; this._StructErrorEventArgs.ErrDescription = "在目标要素类中 " + pAttr.Name + " 字段的精度属性在标准中的定义为" + pAttrDes.PrecisionEx.ToString(); this._StructErrorEventArgs.FeatureClassName = pFeatureClassName; this.OnErrorFind(AppHk, this._StructErrorEventArgs); } } #endregion }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="AttributeObjectCore"/> class. /// </summary> /// <param name="attribute"> /// The attributeObject. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> /// /// /// <exception cref="SdmxNotImplementedException"> /// Throws Unsupported Exception. /// </exception> public AttributeObjectCore( Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.AttributeType attribute, IAttributeList parent) : base( attribute, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataAttribute), attribute.Annotations, attribute.codelist, attribute.concept, parent) { this.dimensionReferences = new List<string>(); this.conceptRoles = new List<ICrossReference>(); if (attribute.AttachmentGroup != null) { if (attribute.AttachmentGroup.Count > 1) { throw new SdmxSemmanticException( ExceptionCode.Unsupported, "Attribute with more then one group attachment"); } if (attribute.AttachmentGroup.Count == 1) { this.attachmentGroup = attribute.AttachmentGroup[0]; } } AttributeAttachmentLevel attachmentLevel0 = default(AttributeAttachmentLevel); var parentDsd = (IDataStructureObject)this.MaintainableParent; switch (attribute.attachmentLevel) { case Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.AttachmentLevelTypeConstants.DataSet: attachmentLevel0 = AttributeAttachmentLevel.DataSet; break; case Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.AttachmentLevelTypeConstants.Group: attachmentLevel0 = AttributeAttachmentLevel.Group; break; case Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.AttachmentLevelTypeConstants.Observation: attachmentLevel0 = AttributeAttachmentLevel.Observation; this.primaryMeasureReference = parentDsd.PrimaryMeasure.Id; break; case Org.Sdmx.Resources.SdmxMl.Schemas.V10.structure.AttachmentLevelTypeConstants.Series: attachmentLevel0 = AttributeAttachmentLevel.DimensionGroup; { foreach (IDimension currentDimension in parentDsd.GetDimensions(SdmxStructureEnumType.Dimension)) { if (!this.dimensionReferences.Contains(currentDimension.Id)) { this.dimensionReferences.Add(currentDimension.Id); } } } break; default: throw new SdmxNotImplementedException(ExceptionCode.Unsupported, "Attachment:" + attribute.attachmentLevel); } this.attachmentLevel = attachmentLevel0; this.assignmentStatus = attribute.assignmentStatus; try { this.ValidateAttributeAttributes(); } catch (Exception th) { throw new SdmxSemmanticException("IsError creating structure: " + this.ToString(), th); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="AttributeObjectCore"/> class. /// </summary> /// <param name="attribute"> /// The attributeObject. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public AttributeObjectCore(AttributeType attribute, IAttributeList parent) : base(attribute, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.DataAttribute), parent) { this.dimensionReferences = new List<string>(); this.conceptRoles = new List<ICrossReference>(); if (attribute.AttributeRelationship != null) { AttributeRelationshipType attRelationShip = attribute.AttributeRelationship; if (attRelationShip.Group != null) { // FUNC - this can also be attached to a dimension list this.attachmentGroup = RefUtil.CreateLocalIdReference(attRelationShip.Group); this.attachmentLevel = AttributeAttachmentLevel.Group; } else if (ObjectUtil.ValidCollection(attRelationShip.Dimension)) { // DEFAULT TO DIMENSION GROUP this.attachmentLevel = AttributeAttachmentLevel.DimensionGroup; foreach (LocalDimensionReferenceType dim in attRelationShip.Dimension) { this.dimensionReferences.Add(RefUtil.CreateLocalIdReference(dim)); } var parentDsd = (IDataStructureObject)this.MaintainableParent; foreach (IDimension currentDimension in parentDsd.GetDimensions()) { if (this.dimensionReferences.Contains(currentDimension.Id)) { if (currentDimension.TimeDimension) { // REFERENCING THE TIME DIMENSION THEREFOR OBSERVATION LEVEL this.attachmentLevel = AttributeAttachmentLevel.Observation; break; } } } if (ObjectUtil.ValidCollection(attRelationShip.AttachmentGroup)) { this.attachmentGroup = RefUtil.CreateLocalIdReference(attRelationShip.AttachmentGroup.First()); this.attachmentLevel = AttributeAttachmentLevel.Group; } } else if (attRelationShip.PrimaryMeasure != null) { this.primaryMeasureReference = RefUtil.CreateLocalIdReference(attRelationShip.PrimaryMeasure); this.attachmentLevel = AttributeAttachmentLevel.Observation; } else { this.attachmentLevel = AttributeAttachmentLevel.DataSet; } } this.assignmentStatus = attribute.assignmentStatus; if (attribute.ConceptRole != null) { foreach (ConceptReferenceType conceptRef in attribute.ConceptRole) { this.conceptRoles.Add(RefUtil.CreateReference(this, conceptRef)); } } try { this.ValidateAttributeAttributes(); } catch (Exception th) { throw new SdmxSemmanticException("IsError creating structure: " + this.ToString(), th); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECTS ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="AttributeObjectCore"/> class. /// </summary> /// <param name="attribute"> /// The attributeObject. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public AttributeObjectCore(IAttributeMutableObject attribute, IAttributeList parent) : base(attribute, parent) { this.dimensionReferences = new List<string>(); this.conceptRoles = new List<ICrossReference>(); try { this.attachmentLevel = attribute.AttachmentLevel; this.assignmentStatus = attribute.AssignmentStatus; this.attachmentGroup = attribute.AttachmentGroup; if (attribute.DimensionReferences != null) { this.dimensionReferences = new List<string>(attribute.DimensionReferences); } if (attribute.ConceptRoles != null) { foreach (IStructureReference currentConceptRole in attribute.ConceptRoles) { this.conceptRoles.Add(new CrossReferenceImpl(this, currentConceptRole)); } } this.primaryMeasureReference = attribute.PrimaryMeasureReference; this.ValidateAttributeAttributes(); } catch (Exception th) { throw new SdmxSemmanticException("IsError creating structure: " + this.ToString(), th); } }
public CheckedAttributes(string resourceId, IAttributeList attributeList, Filter filter) { base.resourceId = resourceId; this.attributeList = attributeList; this.filter = filter; }
public void OnDataCheck() { if (Hook == null) { return; } IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet; if (dataCheckParaSet == null) { return; } if (dataCheckParaSet.Workspace == null) { return; } //获取所有数据集 SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); List <IDataset> featureDatasets = sysGisDataSet.GetAllFeatureClass(); ISchemeProject m_pProject = null; //数据库结构文件对象 int m_DBScale = 0; //默认比例尺 int m_DSScale = 0; //数据集比例尺 Dictionary <string, IFeatureClass> pLayerDic = new Dictionary <string, IFeatureClass>(); //记录加载到map上的图层对象 foreach (IDataset var in featureDatasets) { string FCName = var.Name; if (FCName.Contains(".")) { FCName = FCName.Substring(FCName.IndexOf('.') + 1); } IFeatureClass FC = var as IFeatureClass; if (FC != null && !pLayerDic.ContainsKey(FCName)) { pLayerDic.Add(FCName, FC); } } ///读取配置方案到对象 /// m_pProject = new SchemeProjectClass(); //创建实例 m_pProject.Load(GeoDataChecker.DBSchemaPath, e_FileType.GO_SCHEMEFILETYPE_MDB); //加载schema文件 if (m_pProject != null) { #region 获得比例尺信息 string DBScale = m_pProject.get_MetaDataValue("Scale") as string; //获取比例尺信息(总工程中的默认比例尺) string[] DBPScaleArayy = DBScale.Split(':'); m_DBScale = Convert.ToInt32(DBPScaleArayy[1]); #endregion IChildItemList pProjects = m_pProject as IChildItemList; //获取属性库集合信息 ISchemeItem pDBList = pProjects.get_ItemByName("ATTRDB"); IChildItemList pDBLists = pDBList as IChildItemList; //遍历属性库集合 long DBNum = pDBLists.GetCount(); for (int i = 0; i < DBNum; i++) { m_DSScale = 0; //比例尺信息 //取得属性库信息 ISchemeItem pDB = pDBLists.get_ItemByIndex(i); ///获取数据集的比例尺信息,如果获取失败则,取默认比例尺信息 IAttribute pa = pDB.AttributeList.get_AttributeByName("Scale") as IAttribute; if (pa == null) { m_DSScale = m_DBScale; } else { string[] DBScaleArayy = pa.Value.ToString().Split(':'); m_DSScale = Convert.ToInt32(DBScaleArayy[1]); } IChildItemList pDBs = pDB as IChildItemList; string pDatasetName = pDB.Name; ////遍历属性表 int TabNum = pDBs.GetCount(); for (int j = 0; j < TabNum; j++) { //获取属性表信息 ISchemeItem pTable = pDBs.get_ItemByIndex(j); //获取属性表对象 string pFeatureClassName = pTable.Name; //要素类名称 ///检查图层是否存在 if (!pLayerDic.ContainsKey(pFeatureClassName)) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.目标要素类缺失.GetHashCode(), "要素类在标准中存在,却在目标数据集中未找到", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); continue; } #region 检查要素类类型是否与配置方案一致 string pFeatureClassType = pTable.Value as string; //要素类类型 ///检查图层类型是否一致 /// IFeatureClass pfeatureclass; bool GetlyrSeccess = pLayerDic.TryGetValue(pFeatureClassName, out pfeatureclass); if (GetlyrSeccess) { //IFeatureLayer pFeatureLayer = player as IFeatureLayer; switch (pFeatureClassType) { case "ANNO": if (pfeatureclass.FeatureType != esriFeatureType.esriFTAnnotation) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.要素类类型不一致.GetHashCode(), "目标要素类应为 注记 类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "POINT": if (pfeatureclass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.要素类类型不一致.GetHashCode(), "目标要素类应为 点 类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "LINE": if (pfeatureclass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.要素类类型不一致.GetHashCode(), "目标要素类应为 线 类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "AREA": if (pfeatureclass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.要素类类型不一致.GetHashCode(), "目标要素类应为 面 类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; default: break; } } else { continue; } #endregion //遍历字段 IAttributeList pAttrs = pTable.AttributeList; long FNum = pAttrs.GetCount(); //检查非GIS平台定义的字段 IFields fields = pfeatureclass.Fields; //循环属性表中的字段,添加到arcgis的字段对象中 for (int k = 0; k < FNum; k++) { //添加自定义属性字段 CheckFields(pAttrs, k, fields, pFeatureClassName, dataCheckParaSet); } } } } else { return; } }
/// <summary> /// 根据输入的字段属性对象,检查属性字段是否与标准中定义的一致 /// </summary> /// <param name="pAttrs"></param> /// <param name="k"></param> /// <param name="fields"></param> private void CheckFields(IAttributeList pAttrs, int k, IFields fields, string pFeatureClassName, IArcgisDataCheckParaSet dataCheckParaSet) { //获取基本属性信息 IAttribute pAttr = pAttrs.get_AttributeByIndex(k); //获取扩展属性信息 IAttributeDes pAttrDes = pAttr.Description; ///检查是否存在该名称的字段 /// int i = fields.FindField(pAttr.Name); if (i < 0) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段缺失.GetHashCode(), "目标要素类的 " + pAttr.Name + " 字段缺失", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); return; } IField pField = fields.get_Field(i); #region 字段类型检查 ///检查字段类型是否一致 /// string pfieldType = pAttr.Type.ToString(); switch (pfieldType) { case "GO_VALUETYPE_STRING": if (pField.Type != esriFieldType.esriFieldTypeString) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段类型不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段应为字符串类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "GO_VALUETYPE_LONG": if (pField.Type != esriFieldType.esriFieldTypeInteger) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段类型不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段应为长整类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "GO_VALUETYPE_BOOL": break; case "GO_VALUETYPE_DATE": if (pField.Type != esriFieldType.esriFieldTypeDate) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段类型不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段应为日期类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "GO_VALUETYPE_FLOAT": if (pField.Type != esriFieldType.esriFieldTypeSingle) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段类型不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段应为浮点类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; case "GO_VALUETYPE_DOUBLE": if (pField.Type != esriFieldType.esriFieldTypeDouble) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.属性字段类型不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段应为双精度类型", 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } break; default: break; } #endregion #region 字段长度检查 if (pfieldType != "GO_VALUETYPE_DOUBLE") { if (pField.Length != Convert.ToInt32(pAttrDes.InputWidth)) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.字段扩展属性不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段长度应" + Convert.ToInt32(pAttrDes.InputWidth).ToString(), 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } } #endregion #region 字段可否为空检查 if (pField.IsNullable != pAttrDes.AllowNull) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.字段扩展属性不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段是否为空属性应为" + pAttrDes.AllowNull.ToString(), 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } #endregion #region 字段是否必须存在检查 if (pField.Required != bool.Parse(pAttrDes.Necessary.ToString())) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.字段扩展属性不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段是否必须属性应为" + pAttrDes.Necessary.ToString(), 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } #endregion #region 字段是否可编辑检查 #endregion #region 字段值域是否可变检查 #endregion #region 字段精度检查 //双精度类型不可设置精度(在PDB和GDB中不会出现错误,但是在SDE中会抛出“无效的列”错误) if (pfieldType != "GO_VALUETYPE_DOUBLE") { if (pField.Precision != Convert.ToInt32(pAttrDes.PrecisionEx)) { //传递错误日志 IDataErrInfo dataErrInfo = new DataErrInfo(new List <object>(new object[] { "批量检查", "数据结构检查", dataCheckParaSet.Workspace.PathName, enumErrorType.字段扩展属性不一致.GetHashCode(), "目标要素类的 " + pField.Name + " 字段精度应为" + pAttrDes.PrecisionEx.ToString(), 0, 0, pFeatureClassName, 0, "", 0, false, System.DateTime.Now.ToString() })); DataErrTreatEvent dataErrTreatEvent = new DataErrTreatEvent(dataErrInfo); DataErrTreat(Hook.DataCheckParaSet as object, dataErrTreatEvent); } } #endregion }
public void Clear(int nodeCount, Type[] dataTypes, object[] values0, object[] values1, object[] values2) { // only have init nodcount between [0,2] BasicAdjList net = new BasicAdjList(Guid.NewGuid()); for (int i = 0; i < nodeCount; i++) { net.CreateNode(); } DataAttributeMgr mgr = new DataAttributeMgr(true, net); IAttributeList [] lists = new IAttributeList[dataTypes.Length]; for (int i = 0; i < dataTypes.Length; i++) { #region Make Lists if (dataTypes[i] == typeof(int)) { lists[i] = mgr.CreateList<int>(); } else if (dataTypes[i] == typeof(float)) { lists[i] = mgr.CreateList<float>(); } else if (dataTypes[i] == typeof(double)) { lists[i] = mgr.CreateList<double>(); } else if (dataTypes[i] == typeof(string)) { lists[i] = mgr.CreateList<string>(); } else if (dataTypes[i] == typeof(bool)) { lists[i] = mgr.CreateList<bool>(); } else if (dataTypes[i] == typeof(DateTime)) { lists[i] = mgr.CreateList<DateTime>(); } else if (dataTypes[i] == typeof(Guid)) { lists[i] = mgr.CreateList<Guid>(); } #endregion } for (int i = 0; i < nodeCount; i++) { if (i == 0) mgr.SetRow(0, values0); if (i == 1) mgr.SetRow(1, values1); if (i == 2) mgr.SetRow(2, values2); } Assert.AreEqual(2, mgr.Count, "mgr.Count should equal expected"); Assert.AreEqual(nodeCount, mgr.Depth, "mgr.Depth should equal expected"); mgr.Clear(); Assert.IsNull(mgr.Network, "Network should be null"); Assert.AreEqual(0, mgr.Count, "mgr.Count should equal expected"); }
/// <summary> /// 创建库体建构 /// </summary> /// <param name="DbTemplatePath">库体配置方案模板路径</param> /// <param name="IsHisDb">是否为历史库体</param> /// <param name="ex"></param> public void CreateDataBase(string DbTemplatePath, bool IsHisDb, out Exception ex) { FrmProcessBar ProcFrm = new FrmProcessBar(); ProcFrm.Show(); ex = null; //*********************************************** //guozheng added 保存表名和建表的SQL提供用户选择 Dictionary <string, string> TableDic = new Dictionary <string, string>(); //*********************************************** ISchemeProject m_pProject = null; int m_DBScale = -1;/////比例尺信息 ProcFrm.SetFrmProcessBarText("正在加载配置方案"); #region 加载配置方案 List <string> ltablename = new List <string>(); try { m_pProject = new SchemeProjectClass(); //创建实例 int index = DbTemplatePath.LastIndexOf('.'); string lastName = DbTemplatePath.Substring(index + 1); if (lastName == "mdb") { m_pProject.Load(DbTemplatePath, e_FileType.GO_SCHEMEFILETYPE_MDB); //加载schema文件 } else if (lastName == "gosch") { m_pProject.Load(DbTemplatePath, e_FileType.GO_SCHEMEFILETYPE_GOSCH); //加载schema文件 } else { ex = new Exception("数据库配置方案文件格式不规范,请检查"); ProcFrm.Close(); return; } ///如果加载成功则获取比例尺返回true,否则返回false if (m_pProject != null) { string DBScale = m_pProject.get_MetaDataValue("Scale") as string; //获取比例尺信息(总工程中的默认比例尺) string[] DBScaleArayy = DBScale.Split(':'); m_DBScale = Convert.ToInt32(DBScaleArayy[1]); } else { ex = new Exception("加载数据库配置方案文件:" + DbTemplatePath + "失败!"); ProcFrm.Close(); return; } } catch { ex = new Exception("加载数据库配置方案文件:" + DbTemplatePath + "失败!"); ProcFrm.Close(); return; } #endregion List <string> DataSpace = new List <string>(); string sDataBaseName = string.Empty; string sNow = DateTime.Now.ToLongDateString(); #region 获取字段信息 try { IChildItemList pProjects = m_pProject as IChildItemList; //获取属性库集合信息 ISchemeItem pDBList = pProjects.get_ItemByName("ATTRDB"); IChildItemList pDBLists = pDBList as IChildItemList; //遍历属性库集合 long DBNum = pDBLists.GetCount(); for (int i = 0; i < DBNum; i++) { int m_DSScale = 0; //比例尺信息 #region 获取比例尺 //取得属性库信息 ISchemeItem pDB = pDBLists.get_ItemByIndex(i); ///获取数据集的比例尺信息,如果获取失败则,取默认比例尺信息 IAttribute pa = pDB.AttributeList.get_AttributeByName("Scale") as IAttribute; if (pa == null) { m_DSScale = m_DBScale; } else { string[] DBScaleArayy = pa.Value.ToString().Split(':'); m_DSScale = Convert.ToInt32(DBScaleArayy[1]); } #endregion IChildItemList pDBs = pDB as IChildItemList; string pDatasetName = pDB.Name; DataSpace.Add(pDatasetName); sDataBaseName = pDatasetName; //////////////////////////////////////创建库///////////////////// //创建地物类集合 //遍历属性表 long TabNum = pDBs.GetCount(); ProcFrm.SetFrmProcessBarMax(TabNum); for (int j = 0; j < TabNum; j++) { //获取属性表信息 ISchemeItem pTable = pDBs.get_ItemByIndex(j); //获取属性表对象 ProcFrm.SetFrmProcessBarValue(j); ProcFrm.SetFrmProcessBarText("正在获取属性表"); string pFeatureClassName = pTable.Name; //要素类名称 string pFeatureClassType = pTable.Value as string; //要素类类型 string sTableName = pFeatureClassName; string sTableType = pFeatureClassType; //获得地物类的类型 string sField = string.Empty; string sViewField = string.Empty; sField += ModuleData.s_KeyFieldName + " NUMBER PRIMARY KEY,"; sViewField += ModuleData.s_KeyFieldName + ","; ///////几何字段 sField = sField + ModuleData.s_GeometryFieldName + " " + "MDSYS.SDO_GEOMETRY,"; if (pFeatureClassType == "ANNO")///////注记层不予处理 { continue; } //遍历字段 IAttributeList pAttrs = pTable.AttributeList; long FNum = pAttrs.GetCount(); int lfldcnt = pAttrs.GetCount(); int n = 0; for (n = 0; n < lfldcnt; n++) { IAttribute pAttr = pAttrs.get_AttributeByIndex(n); //获取扩展属性信息 IAttributeDes pAttrDes = pAttr.Description; //以下变量用来定义字段的属性 string fieldName = pAttr.Name; //记录字段名称 string fieldType = pAttr.Type.ToString(); //记录字段类型 int fieldLen = Convert.ToInt32(pAttrDes.InputWidth); //记录字段长度 bool isNullable = pAttrDes.AllowNull; //记录字段是否允许空值 if (fieldLen <= 0) { fieldLen = 30; } int precision = Convert.ToInt32(pAttrDes.PrecisionEx); //精度 bool required = bool.Parse(pAttrDes.Necessary.ToString()); ////////////////记录字段用于创建表/////////////////// string sFildType = string.Empty; switch (fieldType) { case "GO_VALUETYPE_STRING": sFildType = "VARCHAR2(" + fieldLen.ToString() + ")"; break; case "GO_VALUETYPE_LONG": sFildType = "NUMBER"; break; case "GO_VALUETYPE_DATE": sFildType = "DATE"; break; case "GO_VALUETYPE_FLOAT": sFildType = "FLOAT"; break; case "GO_VALUETYPE_DOUBLE": sFildType = "NUMBER"; break; case "GO_VALUETYPE_BYTE": sFildType = "BLOB"; break; case "GO_VALUETYPE_BOOL": sFildType = "CHAR"; break; default: continue; break; } if (!string.IsNullOrEmpty(sFildType)) { if (fieldType == "GO_VALUETYPE_BOOL") { sFildType += " CHECK (" + fieldName + " IN('N','Y'))"; } else { //************************************ //guozheng 2010-12-8 added 增加非空判断 if (!isNullable) { sFildType += " NOT NULL"; } //************************************ } sField = sField + " " + fieldName + " " + sFildType + ","; sViewField += fieldName + ","; } else { continue; } } string sMaxvalue = DateTime.MaxValue.ToLongDateString(); ///////////////////////////////创建表/////////////sTableName,sField ProcFrm.SetFrmProcessBarText("正在组织表字段"); if (IsHisDb) /////若是历史库表后增加后缀 { sTableName = sTableName.Trim() + "_GOH"; ///////增加后缀 ///////增加字段 sField = sField + "FromDate" + " " + "VARCHAR2(30)" + " " + "DEFAULT('" + sNow + "'),"; sField = sField + "ToDate" + " " + "VARCHAR2(30)" + " " + "DEFAULT('" + sMaxvalue + "'),"; sField = sField + "SourceOID" + " " + "NUMBER" + ","; sField = sField + "State" + " " + "NUMBER" + ","; sField = sField + "VERSION" + " " + "NUMBER" + " " + "DEFAULT(0) NOT NULL,"; } //////构建建表SQL语句 string CreateSQL = string.Empty; if (sTableType != "ANNO")/////不是注记层 { sField = sField.Substring(0, sField.LastIndexOf(",")); CreateSQL = "CREATE TABLE " + this._User.Trim() + "." + sTableName.Trim() + " " + "(" + sField + ")"; } else////////注记层 { continue; } ////////// ProcFrm.SetFrmProcessBarText("记录表" + sTableName); ////////// if (!IsHisDb) { if (!TableDic.ContainsKey(sTableName.Trim())) { TableDic.Add(sTableName.Trim(), CreateSQL); } } if (IsHisDb) { int index = sTableName.IndexOf("_GOH"); if (index < 0) { ex = new Exception("历史表名称不规范"); return; } string userTableName = sTableName.Substring(0, index); string strsql = "SELECT COUNT(*) FROM " + userTableName; CreateTable(strsql, out ex); ////判断用户表是否存在 if (ex != null) ////用户表不存在,不需要建立历史表 { continue; } InitialHisTable(sTableName, CreateSQL, sViewField, out ex); //if (!TableDic.ContainsKey(sTableName.Trim())) //{ // TableDic.Add(sTableName.Trim(), CreateSQL); //} } //////////////////////////////////////////////////////////////// } } ProcFrm.Close(); if (!IsHisDb) { ProcFrm.SetFrmProcessBarText("正在创建远程日志表"); /////////建立远程日志表////// string LogSQL = "CREATE TABLE GO_DATABASE_UPDATELOG(OID NUMBER,STATE NUMBER,LAYERNAME VARCHAR2(30),LASTUPDATE DATE,VERSION NUMBER DEFAULT(0) NOT NULL,XMIN NUMBER,XMAX NUMBER,YMIN NUMBER,YMAX NUMBER)"; ltablename.Add("GO_DATABASE_UPDATELOG"); /////////远程更新日志 TableDic.Add("远程日志表:GO_DATABASE_UPDATELOG", LogSQL); /////////数据库版本表 LogSQL = "CREATE TABLE go_database_version(VERSION NUMBER DEFAULT(0) NOT NULL,USERNAME VARCHAR2(30),VERSIONTIME DATE,DES VARCHAR2(30))"; ltablename.Add("go_database_version"); TableDic.Add("数据库版本表:go_database_version", LogSQL); if (TableDic.Count > 0) { frmChooseTable fChooseTables = new frmChooseTable(TableDic, this._Server, this._User, this._Password); if (DialogResult.OK == fChooseTables.ShowDialog()) { Dictionary <string, string> getCreatedTables = fChooseTables.CreatedTable; } else { ex = new Exception("取消操作"); ProcFrm.Close(); return; } } } ProcFrm.Close(); } catch (Exception dd) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", dd.Message); ex = dd; ProcFrm.Close(); } #endregion System.Runtime.InteropServices.Marshal.ReleaseComObject(m_pProject); }