public static IFeatureClass GetHistoryFeatureClass(IFeatureClass ifeatureClass_0) { string text = ZDRegister.GetHistoryZDFeatureName(ifeatureClass_0); if (string.IsNullOrEmpty(text)) { string[] array = (ifeatureClass_0 as IDataset).Name.Split(new char[] { '.' }); text = array[array.Length - 1] + "_His"; } IFeatureWorkspace featureWorkspace = (ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace; return(featureWorkspace.OpenFeatureClass(text)); }
public void LoadParent() { this.IsLoad = true; try { ZDHistoryTable zDHistoryTable = new ZDHistoryTable(); string text = (this.Feature.Class as IDataset).Name; string[] array = text.Split(new char[] { '.' }); text = array[array.Length - 1]; if (text.Length > 4) { string a = text.Substring(text.Length - 4).ToLower(); if (a == "_his") { text = text.Substring(0, text.Length - 4); } } string historyZDFeatureName = ZDRegister.GetHistoryZDFeatureName(this.Feature.Class as IFeatureClass); string registerZDGuid = ZDRegister.GetRegisterZDGuid(this.Feature.Class as IFeatureClass); IFeatureClass ifeatureClass_ = ((this.Feature.Class as IDataset).Workspace as IFeatureWorkspace).OpenFeatureClass( historyZDFeatureName); string whereClause = string.Format("{0}='{1}' and {2}={3}", new object[] { zDHistoryTable.ZDRegisterGuidName, registerZDGuid, zDHistoryTable.NewZDOIDName, this.OID }); IQueryFilter queryFilter = new QueryFilter(); queryFilter.WhereClause = whereClause; IWorkspace workspace = AppConfigInfo.GetWorkspace(); ITable table = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName); ICursor cursor = table.Search(queryFilter, false); for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow()) { ZDChangeHistoryInfo zDChangeHistoryInfo = new ZDChangeHistoryInfo(); object fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChangeTypeFieldName); if (this.ChageType == ZDEditType.Unknown) { this.ChageType = (ZDEditType)System.Convert.ToInt32(fieldValue); } fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.ChageDateFieldName); this.ChangeDate = System.Convert.ToDateTime(fieldValue); fieldValue = RowOperator.GetFieldValue(row, zDHistoryTable.OrigineZDOIDName); int oID = System.Convert.ToInt32(fieldValue); zDChangeHistoryInfo.Feature = ZDChangeHistory.GetHisFeat(ifeatureClass_, oID); zDChangeHistoryInfo.OID = oID; zDChangeHistoryInfo.TopFeat = this.Feature; zDChangeHistoryInfo.SouceInfos = new System.Collections.Generic.List <ZDChangeHistoryInfo>(); this.SouceInfos.Add(zDChangeHistoryInfo); } ComReleaser.ReleaseCOMObject(cursor); } catch (System.Exception) { } }
public bool UnDoChange(IFeatureClass ifeatureClass_0) { bool result; if (this.CanUndo(ifeatureClass_0)) { string text = (ifeatureClass_0 as IDataset).Name; string[] array = text.Split(new char[] { '.' }); text = array[array.Length - 1]; if (text.Length > 4) { string a = text.Substring(text.Length - 4).ToLower(); if (a == "_his") { text = text.Substring(0, text.Length - 4); } } string registerZDGuid = ZDRegister.GetRegisterZDGuid(ifeatureClass_0); ZDHistoryTable zDHistoryTable = new ZDHistoryTable(); string whereClause; if (this.ChageType == ZDEditType.Create) { whereClause = string.Format("{0}='{1}' and {2} in ({3})", new object[] { zDHistoryTable.ZDRegisterGuidName, registerZDGuid, zDHistoryTable.NewZDOIDName, this.NewOIDs }); } else { whereClause = string.Format("{0}='{1}' and {2} in ({3})", new object[] { zDHistoryTable.ZDRegisterGuidName, registerZDGuid, zDHistoryTable.OrigineZDOIDName, this.OriginOIDs }); } IQueryFilter queryFilter = new QueryFilter(); queryFilter.WhereClause = whereClause; IWorkspace workspace = AppConfigInfo.GetWorkspace(); ITable table = (workspace as IFeatureWorkspace).OpenTable(zDHistoryTable.TableName); table.DeleteSearchedRows(queryFilter); string historyZDFeatureName = ZDRegister.GetHistoryZDFeatureName(ifeatureClass_0); IFeatureClass featureClass = ((ifeatureClass_0 as IDataset).Workspace as IFeatureWorkspace).OpenFeatureClass(historyZDFeatureName); string[] array2 = this.HisOIDs.Split(new char[] { ',' }); try { if (this.ChageType != ZDEditType.Delete) { queryFilter = new QueryFilter(); whereClause = string.Format("{0} in ({1}) ", ifeatureClass_0.OIDFieldName, this.NewOIDs); queryFilter.WhereClause = whereClause; (ifeatureClass_0 as ITable).DeleteSearchedRows(queryFilter); } } catch (System.Exception) { } int index = featureClass.FindField("OriginOID_"); int index2 = table.FindField(zDHistoryTable.NewZDOIDName); string[] array3 = array2; for (int i = 0; i < array3.Length; i++) { string text2 = array3[i]; if (text2 != "-1") { IFeature feature = ifeatureClass_0.CreateFeature(); IFeature feature2 = featureClass.GetFeature(System.Convert.ToInt32(text2)); int num = System.Convert.ToInt32(feature2.get_Value(index)); RowOperator.CopyFeatureToFeatureEx(feature2, feature); feature2.Delete(); whereClause = string.Format("{0}='{1}' and {2} ={3}", new object[] { zDHistoryTable.ZDRegisterGuidName, registerZDGuid, zDHistoryTable.NewZDOIDName, num }); queryFilter.WhereClause = whereClause; ICursor cursor = table.Search(queryFilter, false); for (IRow row = cursor.NextRow(); row != null; row = cursor.NextRow()) { row.set_Value(index2, feature.OID); row.Store(); } ComReleaser.ReleaseCOMObject(cursor); } } result = true; } else { result = false; } return(result); }